@syncfusion/ej2-richtexteditor 24.2.3 → 24.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -5
- 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 +485 -193
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +472 -186
- 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/common/util.d.ts +6 -0
- package/src/common/util.js +31 -1
- package/src/editor-manager/plugin/formats.d.ts +1 -0
- package/src/editor-manager/plugin/formats.js +37 -2
- package/src/editor-manager/plugin/inserthtml.js +22 -4
- package/src/editor-manager/plugin/lists.js +14 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +87 -18
- package/src/editor-manager/plugin/nodecutter.js +1 -1
- package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
- package/src/editor-manager/plugin/selection-commands.js +56 -1
- package/src/editor-manager/plugin/table.js +1 -1
- package/src/rich-text-editor/actions/base-quick-toolbar.js +2 -2
- package/src/rich-text-editor/actions/enter-key.js +2 -2
- package/src/rich-text-editor/actions/html-editor.js +25 -12
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
- package/src/rich-text-editor/actions/paste-clean-up.js +26 -5
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.js +1 -1
- package/src/rich-text-editor/base/interface.d.ts +0 -8
- 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 +16 -6
- package/src/rich-text-editor/base/util.js +3 -0
- package/src/rich-text-editor/models/default-locale.js +8 -7
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
- package/src/rich-text-editor/renderer/image-module.js +3 -3
- package/src/rich-text-editor/renderer/table-module.d.ts +1 -0
- package/src/rich-text-editor/renderer/table-module.js +106 -98
- package/src/rich-text-editor/renderer/video-module.d.ts +2 -0
- package/src/rich-text-editor/renderer/video-module.js +33 -26
- package/src/selection/selection.js +3 -0
- package/styles/bootstrap-dark.css +25 -9
- package/styles/bootstrap.css +25 -9
- package/styles/bootstrap4.css +30 -14
- package/styles/bootstrap5-dark.css +25 -9
- package/styles/bootstrap5.css +25 -9
- package/styles/fabric-dark.css +25 -9
- package/styles/fabric.css +25 -9
- package/styles/fluent-dark.css +27 -11
- package/styles/fluent.css +27 -11
- package/styles/highcontrast-light.css +25 -9
- package/styles/highcontrast.css +25 -9
- package/styles/material-dark.css +25 -9
- package/styles/material.css +25 -9
- package/styles/material3-dark.css +33 -11
- package/styles/material3.css +33 -11
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +4 -2
- package/styles/rich-text-editor/_bootstrap-definition.scss +4 -2
- package/styles/rich-text-editor/_bootstrap4-definition.scss +8 -6
- package/styles/rich-text-editor/_bootstrap5-definition.scss +4 -2
- package/styles/rich-text-editor/_fabric-dark-definition.scss +4 -2
- package/styles/rich-text-editor/_fabric-definition.scss +4 -2
- package/styles/rich-text-editor/_fluent-definition.scss +5 -3
- package/styles/rich-text-editor/_fusionnew-definition.scss +4 -2
- package/styles/rich-text-editor/_highcontrast-definition.scss +4 -2
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +4 -2
- package/styles/rich-text-editor/_layout.scss +38 -7
- package/styles/rich-text-editor/_material-dark-definition.scss +4 -2
- package/styles/rich-text-editor/_material-definition.scss +4 -2
- package/styles/rich-text-editor/_material3-definition.scss +5 -3
- package/styles/rich-text-editor/_tailwind-definition.scss +21 -19
- package/styles/rich-text-editor/_theme.scss +21 -3
- package/styles/rich-text-editor/bootstrap-dark.css +25 -9
- package/styles/rich-text-editor/bootstrap.css +25 -9
- package/styles/rich-text-editor/bootstrap4.css +30 -14
- package/styles/rich-text-editor/bootstrap5-dark.css +25 -9
- package/styles/rich-text-editor/bootstrap5.css +25 -9
- package/styles/rich-text-editor/fabric-dark.css +25 -9
- package/styles/rich-text-editor/fabric.css +25 -9
- package/styles/rich-text-editor/fluent-dark.css +27 -11
- package/styles/rich-text-editor/fluent.css +27 -11
- package/styles/rich-text-editor/highcontrast-light.css +25 -9
- package/styles/rich-text-editor/highcontrast.css +25 -9
- package/styles/rich-text-editor/material-dark.css +25 -9
- package/styles/rich-text-editor/material.css +25 -9
- package/styles/rich-text-editor/material3-dark.css +33 -11
- package/styles/rich-text-editor/material3.css +33 -11
- package/styles/rich-text-editor/tailwind-dark.css +68 -32
- package/styles/rich-text-editor/tailwind.css +68 -32
- package/styles/tailwind-dark.css +68 -32
- package/styles/tailwind.css +68 -32
|
@@ -2668,7 +2668,7 @@ let defaultLocale = {
|
|
|
2668
2668
|
'audioLayoutOption': 'Layout option',
|
|
2669
2669
|
'videoLayoutOption': 'Layout option',
|
|
2670
2670
|
'align': 'Align',
|
|
2671
|
-
'caption': '
|
|
2671
|
+
'caption': 'Caption',
|
|
2672
2672
|
'remove': 'Remove',
|
|
2673
2673
|
'insertLink': 'Insert Link',
|
|
2674
2674
|
'display': 'Display',
|
|
@@ -2732,14 +2732,14 @@ let defaultLocale = {
|
|
|
2732
2732
|
'cellspacing': 'Cell Spacing',
|
|
2733
2733
|
'columns': 'Number of columns',
|
|
2734
2734
|
'rows': 'Number of rows',
|
|
2735
|
-
'tableRows': '
|
|
2736
|
-
'tableColumns': '
|
|
2735
|
+
'tableRows': 'Row',
|
|
2736
|
+
'tableColumns': 'Column',
|
|
2737
2737
|
'tableCellHorizontalAlign': 'Table Cell Horizontal Align',
|
|
2738
|
-
'tableCellVerticalAlign': '
|
|
2738
|
+
'tableCellVerticalAlign': 'Vertical Align',
|
|
2739
2739
|
'createTable': 'Create Table',
|
|
2740
2740
|
'removeTable': 'Remove Table',
|
|
2741
|
-
'tableHeader': '
|
|
2742
|
-
'tableRemove': '
|
|
2741
|
+
'tableHeader': 'Header Row',
|
|
2742
|
+
'tableRemove': 'Delete',
|
|
2743
2743
|
'tableCellBackground': 'Table Cell Background',
|
|
2744
2744
|
'tableEditProperties': 'Table Edit Properties',
|
|
2745
2745
|
'styles': 'Styles',
|
|
@@ -2819,6 +2819,7 @@ let defaultLocale = {
|
|
|
2819
2819
|
'emojiPickerNoResultFound': 'No results found',
|
|
2820
2820
|
'emojiPickerTrySomethingElse': 'Try something else',
|
|
2821
2821
|
'linkAriaLabel': 'Open in new window',
|
|
2822
|
+
'unsupportedImage': 'Unsupported file format'
|
|
2822
2823
|
};
|
|
2823
2824
|
let toolsLocale = {
|
|
2824
2825
|
'alignments': 'alignments',
|
|
@@ -2914,7 +2915,7 @@ let toolsLocale = {
|
|
|
2914
2915
|
'emojiPickerTypeToFind': 'Type to find',
|
|
2915
2916
|
'emojiPickerNoResultFound': 'No results found',
|
|
2916
2917
|
'emojiPickerTrySomethingElse': 'Try something else',
|
|
2917
|
-
'
|
|
2918
|
+
'imageLinkAriaLabel': 'Open in new window',
|
|
2918
2919
|
};
|
|
2919
2920
|
let fontNameLocale = [
|
|
2920
2921
|
{ locale: 'fontNameSegoeUI', value: 'Segoe UI' },
|
|
@@ -3443,6 +3444,9 @@ function updateTextNode(value, rteObj) {
|
|
|
3443
3444
|
}
|
|
3444
3445
|
const imageElm = resultElm.querySelectorAll('img');
|
|
3445
3446
|
for (let i = 0; i < imageElm.length; i++) {
|
|
3447
|
+
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
3448
|
+
continue; // Should not add the class if the image is Broken.
|
|
3449
|
+
}
|
|
3446
3450
|
if (!imageElm[i].classList.contains(CLS_RTE_IMAGE)) {
|
|
3447
3451
|
imageElm[i].classList.add(CLS_RTE_IMAGE);
|
|
3448
3452
|
}
|
|
@@ -5058,7 +5062,7 @@ class ToolbarAction {
|
|
|
5058
5062
|
if (args.item.command === 'Lists') {
|
|
5059
5063
|
if (args.originalEvent.target.classList.contains('e-caret') &&
|
|
5060
5064
|
(args.originalEvent.target.parentElement.classList.contains('e-rte-bulletformatlist-dropdown') || args.originalEvent.target.parentElement.classList.contains('e-rte-numberformatlist-dropdown'))) {
|
|
5061
|
-
|
|
5065
|
+
return;
|
|
5062
5066
|
}
|
|
5063
5067
|
}
|
|
5064
5068
|
this.parent.notify(htmlToolbarClick, args);
|
|
@@ -5668,7 +5672,7 @@ class Toolbar$2 {
|
|
|
5668
5672
|
else if (Browser.isDevice || this.parent.inlineMode.enable) {
|
|
5669
5673
|
this.isToolbar = true;
|
|
5670
5674
|
}
|
|
5671
|
-
if (isNullOrUndefined(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand) {
|
|
5675
|
+
if (isNullOrUndefined(trg) && this.parent.toolbarSettings.type === ToolbarType.Expand && this.parent.toolbarModule.getExpandTBarPopHeight() === 0) {
|
|
5672
5676
|
removeClass([this.tbElement], [CLS_EXPAND_OPEN]);
|
|
5673
5677
|
}
|
|
5674
5678
|
}
|
|
@@ -6321,7 +6325,7 @@ class BaseQuickToolbar {
|
|
|
6321
6325
|
e.target.classList.contains('e-imgbreak')) ? false : true;
|
|
6322
6326
|
let target = !isNullOrUndefined(imgWrapper) ? imgWrapper : e.target;
|
|
6323
6327
|
addClass([this.toolbarElement], [CLS_RM_WHITE_SPACE]);
|
|
6324
|
-
const targetOffsetTop = target.offsetTop;
|
|
6328
|
+
const targetOffsetTop = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetTop : target.offsetTop;
|
|
6325
6329
|
const parentOffsetTop = window.pageYOffset + e.parentData.top;
|
|
6326
6330
|
if ((targetOffsetTop - e.editTop) > e.popHeight) {
|
|
6327
6331
|
y = parentOffsetTop + e.tBarElementHeight + (targetOffsetTop - e.editTop) - e.popHeight - 5;
|
|
@@ -6334,7 +6338,7 @@ class BaseQuickToolbar {
|
|
|
6334
6338
|
}
|
|
6335
6339
|
target = isAligned ? e.target : target;
|
|
6336
6340
|
if (target.offsetWidth > e.popWidth) {
|
|
6337
|
-
x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + target.offsetLeft;
|
|
6341
|
+
x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + ((target.classList.contains("e-rte-audio")) ? target.parentElement.offsetLeft : target.offsetLeft);
|
|
6338
6342
|
}
|
|
6339
6343
|
else {
|
|
6340
6344
|
x = e.parentData.left + target.offsetLeft;
|
|
@@ -7778,7 +7782,7 @@ function updateTextNode$1(value, enterAction) {
|
|
|
7778
7782
|
tableElm[i].classList.add('e-rte-paste-table');
|
|
7779
7783
|
if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
|
|
7780
7784
|
tableElm[i].classList.remove('e-rte-paste-word-table');
|
|
7781
|
-
continue; //
|
|
7785
|
+
continue; // Skiping the removal of the border if the source is from word.
|
|
7782
7786
|
}
|
|
7783
7787
|
else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
|
|
7784
7788
|
tableElm[i].classList.remove('e-rte-paste-excel-table');
|
|
@@ -7812,6 +7816,9 @@ function updateTextNode$1(value, enterAction) {
|
|
|
7812
7816
|
}
|
|
7813
7817
|
const imageElm = resultElm.querySelectorAll('img');
|
|
7814
7818
|
for (let i = 0; i < imageElm.length; i++) {
|
|
7819
|
+
if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
|
|
7820
|
+
continue; // Should not add the class if the image is Broken.
|
|
7821
|
+
}
|
|
7815
7822
|
if (!imageElm[i].classList.contains('e-rte-image')) {
|
|
7816
7823
|
imageElm[i].classList.add('e-rte-image');
|
|
7817
7824
|
}
|
|
@@ -7882,6 +7889,33 @@ function getDefaultMDTbStatus() {
|
|
|
7882
7889
|
formats: null
|
|
7883
7890
|
};
|
|
7884
7891
|
}
|
|
7892
|
+
/**
|
|
7893
|
+
* @param {Range} range - specifies the range
|
|
7894
|
+
* @returns {void}
|
|
7895
|
+
* @hidden
|
|
7896
|
+
*/
|
|
7897
|
+
function nestedListCleanUp(range) {
|
|
7898
|
+
if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
|
|
7899
|
+
range.extractContents();
|
|
7900
|
+
while ((range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty').length > 0 ||
|
|
7901
|
+
(range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('ol :empty').length > 0) {
|
|
7902
|
+
let emptyLI = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll('li :empty');
|
|
7903
|
+
if (emptyLI.length > 0) {
|
|
7904
|
+
emptyLI.forEach((item) => {
|
|
7905
|
+
item.remove();
|
|
7906
|
+
});
|
|
7907
|
+
}
|
|
7908
|
+
}
|
|
7909
|
+
let liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
|
|
7910
|
+
if (liElem.length > 0) {
|
|
7911
|
+
liElem.forEach((item) => {
|
|
7912
|
+
if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
|
|
7913
|
+
item.style.listStyleType = "none";
|
|
7914
|
+
}
|
|
7915
|
+
});
|
|
7916
|
+
}
|
|
7917
|
+
}
|
|
7918
|
+
}
|
|
7885
7919
|
|
|
7886
7920
|
/**
|
|
7887
7921
|
* MarkdownToolbarStatus module for refresh the toolbar status
|
|
@@ -10821,6 +10855,9 @@ class NodeSelection {
|
|
|
10821
10855
|
|| this.isChildNode(nodeCollection, startNode))) {
|
|
10822
10856
|
return null;
|
|
10823
10857
|
}
|
|
10858
|
+
if (startNode.nodeType === 3 && startNode.previousSibling === endNode && endNode.nodeName === 'IMG') {
|
|
10859
|
+
return null;
|
|
10860
|
+
}
|
|
10824
10861
|
if (nodeCollection.indexOf(startNode.firstChild) === -1 && startNode.firstChild && !this.isChildNode(nodeCollection, startNode)) {
|
|
10825
10862
|
return startNode.firstChild;
|
|
10826
10863
|
}
|
|
@@ -12611,6 +12648,9 @@ class Lists {
|
|
|
12611
12648
|
isNullOrUndefined(item) && nodes[i].parentNode.style.listStyleType !== '') {
|
|
12612
12649
|
isRevert = false;
|
|
12613
12650
|
}
|
|
12651
|
+
if (nodes[i].parentNode.tagName === tagName && nodes[i].parentNode.style.listStyleType !== '') {
|
|
12652
|
+
isRevert = true;
|
|
12653
|
+
}
|
|
12614
12654
|
}
|
|
12615
12655
|
return isRevert;
|
|
12616
12656
|
}
|
|
@@ -12751,8 +12791,18 @@ class Lists {
|
|
|
12751
12791
|
if (DEFAULT_TAG && 0 === element.querySelectorAll(BLOCK_TAGS.join(', ')).length) {
|
|
12752
12792
|
const wrapperclass = isNullOrUndefined(className) ? ' class="e-rte-wrap-inner"' :
|
|
12753
12793
|
' class="' + className + ' e-rte-wrap-inner"';
|
|
12794
|
+
let parentElement = parentNode;
|
|
12795
|
+
if (!isNullOrUndefined(parentElement.style.listStyleType)) {
|
|
12796
|
+
parentNode.style.removeProperty("list-style-type");
|
|
12797
|
+
}
|
|
12798
|
+
if (!isNullOrUndefined(parentElement.style.listStyleImage)) {
|
|
12799
|
+
parentNode.style.removeProperty("list-style-image");
|
|
12800
|
+
}
|
|
12801
|
+
if (parentElement.style.length === 0) {
|
|
12802
|
+
parentNode.removeAttribute("style");
|
|
12803
|
+
}
|
|
12754
12804
|
const wrapper = '<' + DEFAULT_TAG + wrapperclass +
|
|
12755
|
-
this.domNode.attributes(
|
|
12805
|
+
this.domNode.attributes(parentElement) + '></' + DEFAULT_TAG + '>';
|
|
12756
12806
|
if (e.enterAction !== 'BR') {
|
|
12757
12807
|
this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
|
|
12758
12808
|
}
|
|
@@ -13008,7 +13058,7 @@ class NodeCutter {
|
|
|
13008
13058
|
else if (len > -1) {
|
|
13009
13059
|
this.spliceEmptyNode(fragment.childNodes[0], isStart);
|
|
13010
13060
|
}
|
|
13011
|
-
else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG' && !(fragment.classList.contains('e-video-wrap')) && !(fragment.classList.contains('e-audio-wrap'))) {
|
|
13061
|
+
else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG' && !(fragment.querySelectorAll('img').length > 0) && !(fragment.classList.contains('e-video-wrap')) && !(fragment.classList.contains('e-audio-wrap'))) {
|
|
13012
13062
|
fragment.parentNode.removeChild(fragment);
|
|
13013
13063
|
}
|
|
13014
13064
|
return fragment;
|
|
@@ -13141,6 +13191,14 @@ class Formats {
|
|
|
13141
13191
|
}
|
|
13142
13192
|
}
|
|
13143
13193
|
}
|
|
13194
|
+
getBlockParent(node, endNode) {
|
|
13195
|
+
let currentParent;
|
|
13196
|
+
while (node != endNode) {
|
|
13197
|
+
currentParent = node;
|
|
13198
|
+
node = node.parentElement;
|
|
13199
|
+
}
|
|
13200
|
+
return currentParent;
|
|
13201
|
+
}
|
|
13144
13202
|
onKeyDown(e) {
|
|
13145
13203
|
if (e.event.which === 13) {
|
|
13146
13204
|
let range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
@@ -13150,6 +13208,8 @@ class Formats {
|
|
|
13150
13208
|
? range.endContainer : range.endContainer.parentElement;
|
|
13151
13209
|
const preElem = closest(startCon, 'pre');
|
|
13152
13210
|
const endPreElem = closest(endCon, 'pre');
|
|
13211
|
+
const blockquoteEle = closest(startCon, 'blockquote');
|
|
13212
|
+
const endBlockquoteEle = closest(endCon, 'blockquote');
|
|
13153
13213
|
const liParent = !isNullOrUndefined(preElem) && !isNullOrUndefined(preElem.parentElement) && preElem.parentElement.tagName === 'LI';
|
|
13154
13214
|
if (liParent) {
|
|
13155
13215
|
return;
|
|
@@ -13161,6 +13221,17 @@ class Formats {
|
|
|
13161
13221
|
range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
13162
13222
|
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, endCon, 0);
|
|
13163
13223
|
}
|
|
13224
|
+
if (e.event.which === 13 && ((!isNullOrUndefined(blockquoteEle) && !isNullOrUndefined(endBlockquoteEle)) || (!isNullOrUndefined(blockquoteEle) && isNullOrUndefined(endBlockquoteEle)))) {
|
|
13225
|
+
let startParent = this.getBlockParent(range.startContainer, blockquoteEle);
|
|
13226
|
+
if ((startParent.textContent.charCodeAt(0) === 8203 &&
|
|
13227
|
+
startParent.textContent.length === 1) || startParent.textContent.length === 0) {
|
|
13228
|
+
if (isNullOrUndefined(startParent.nextSibling) && ((startParent.previousSibling.textContent.charCodeAt(0) === 8203 &&
|
|
13229
|
+
startParent.previousSibling.textContent.length === 1) || startParent.previousSibling.textContent.length === 0)) {
|
|
13230
|
+
e.event.preventDefault();
|
|
13231
|
+
this.paraFocus(startParent.parentElement); //Revert from blockquotes while pressing enter key
|
|
13232
|
+
}
|
|
13233
|
+
}
|
|
13234
|
+
}
|
|
13164
13235
|
if (e.event.which === 13 && !isNullOrUndefined(preElem) && !isNullOrUndefined(endPreElem)) {
|
|
13165
13236
|
e.event.preventDefault();
|
|
13166
13237
|
this.deleteContent(range);
|
|
@@ -13384,7 +13455,7 @@ class Formats {
|
|
|
13384
13455
|
replaceHTML = parentNode.innerHTML;
|
|
13385
13456
|
}
|
|
13386
13457
|
if ((e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase() &&
|
|
13387
|
-
(e.subCommand.toLowerCase() !== 'pre' ||
|
|
13458
|
+
(e.subCommand.toLowerCase() !== 'pre' && e.subCommand.toLowerCase() !== 'blockquote' ||
|
|
13388
13459
|
(!isNullOrUndefined(e.exeValue) && e.exeValue.name === 'dropDownSelect'))) ||
|
|
13389
13460
|
isNullOrUndefined(parentNode.parentNode) ||
|
|
13390
13461
|
(parentNode.tagName === 'TABLE' && e.subCommand.toLowerCase() === 'pre')) {
|
|
@@ -13393,7 +13464,21 @@ class Formats {
|
|
|
13393
13464
|
this.cleanFormats(parentNode, e.subCommand);
|
|
13394
13465
|
const replaceNode = (e.subCommand.toLowerCase() === 'pre' && parentNode.tagName.toLowerCase() === 'pre') ?
|
|
13395
13466
|
'p' : e.subCommand;
|
|
13396
|
-
const
|
|
13467
|
+
const isToggleBlockquoteList = e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase() &&
|
|
13468
|
+
e.subCommand.toLowerCase() === 'blockquote' && this.parent.domNode.isList(parentNode.firstElementChild);
|
|
13469
|
+
const isToggleBlockquote = e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase()
|
|
13470
|
+
&& e.subCommand.toLowerCase() === 'blockquote';
|
|
13471
|
+
let replaceTag;
|
|
13472
|
+
if (isToggleBlockquoteList) {
|
|
13473
|
+
replaceTag = replaceHTML.replace(/>\s+</g, '><');
|
|
13474
|
+
}
|
|
13475
|
+
else if (isToggleBlockquote) {
|
|
13476
|
+
let tagWrap = (e.enterAction == 'BR' || e.enterAction == 'P') ? 'P' : e.enterAction;
|
|
13477
|
+
replaceTag = this.parent.domNode.createTagString(tagWrap, parentNode, replaceHTML.replace(/>\s+</g, '><'));
|
|
13478
|
+
}
|
|
13479
|
+
else {
|
|
13480
|
+
replaceTag = this.parent.domNode.createTagString(replaceNode, parentNode, replaceHTML.replace(/>\s+</g, '><'));
|
|
13481
|
+
}
|
|
13397
13482
|
if (parentNode.tagName === 'LI') {
|
|
13398
13483
|
parentNode.innerHTML = '';
|
|
13399
13484
|
parentNode.insertAdjacentHTML('beforeend', replaceTag);
|
|
@@ -13536,7 +13621,12 @@ class InsertHtml {
|
|
|
13536
13621
|
lasNode.textContent.length : lasNode.childNodes.length);
|
|
13537
13622
|
range = nodeSelection.getRange(docElement);
|
|
13538
13623
|
}
|
|
13539
|
-
range.
|
|
13624
|
+
if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
|
|
13625
|
+
nestedListCleanUp(range);
|
|
13626
|
+
}
|
|
13627
|
+
else {
|
|
13628
|
+
range.extractContents();
|
|
13629
|
+
}
|
|
13540
13630
|
if (insertNode.tagName === 'TABLE') {
|
|
13541
13631
|
this.removeEmptyElements(editNode);
|
|
13542
13632
|
}
|
|
@@ -13697,12 +13787,17 @@ class InsertHtml {
|
|
|
13697
13787
|
preNode.parentNode.replaceChild(fragment, preNode);
|
|
13698
13788
|
}
|
|
13699
13789
|
else {
|
|
13790
|
+
const startContainerParent = range.startContainer.parentNode;
|
|
13791
|
+
// Get the index of the start container among its siblings
|
|
13792
|
+
const startIndex = Array.prototype.indexOf.call(startContainerParent.childNodes, range.startContainer);
|
|
13700
13793
|
range.deleteContents();
|
|
13794
|
+
range.setStart(startContainerParent, startIndex);
|
|
13795
|
+
range.setEnd(startContainerParent, startIndex);
|
|
13701
13796
|
if (!isNullOrUndefined(lasNode)) {
|
|
13702
13797
|
detach(lasNode);
|
|
13703
13798
|
}
|
|
13704
13799
|
// eslint-disable-next-line
|
|
13705
|
-
!isNullOrUndefined(sibNode) ? sibNode.parentNode.appendChild(fragment) :
|
|
13800
|
+
!isNullOrUndefined(sibNode) ? (sibNode.parentNode === editNode ? sibNode.appendChild(fragment) : sibNode.parentNode.appendChild(fragment)) : range.insertNode(fragment);
|
|
13706
13801
|
}
|
|
13707
13802
|
}
|
|
13708
13803
|
else {
|
|
@@ -13927,7 +14022,15 @@ class InsertHtml {
|
|
|
13927
14022
|
}
|
|
13928
14023
|
static imageFocus(node, nodeSelection, docElement) {
|
|
13929
14024
|
const focusNode = document.createTextNode(' ');
|
|
13930
|
-
node.parentNode
|
|
14025
|
+
if (node.parentNode && node.parentNode.nodeName === 'A') {
|
|
14026
|
+
const anchorTag = node.parentNode;
|
|
14027
|
+
const parentNode = anchorTag.parentNode;
|
|
14028
|
+
parentNode.insertBefore(focusNode, anchorTag.nextSibling);
|
|
14029
|
+
parentNode.insertBefore(node, focusNode);
|
|
14030
|
+
}
|
|
14031
|
+
else {
|
|
14032
|
+
node.parentNode.insertBefore(focusNode, node.nextSibling);
|
|
14033
|
+
}
|
|
13931
14034
|
nodeSelection.setSelectionText(docElement, node.nextSibling, node.nextSibling, 0, 0);
|
|
13932
14035
|
}
|
|
13933
14036
|
// eslint-disable-next-line
|
|
@@ -15854,7 +15957,7 @@ class TableCommand {
|
|
|
15854
15957
|
const eleArray = elements;
|
|
15855
15958
|
//eslint-disable-next-line
|
|
15856
15959
|
if (min < (max = Math.min(max, eleArray[0].length - 1))) {
|
|
15857
|
-
for (colIndex
|
|
15960
|
+
for (colIndex = min; colIndex <= max; colIndex++) {
|
|
15858
15961
|
// eslint-disable-next-line
|
|
15859
15962
|
if (!(min < colIndex && eleArray[0][colIndex] === eleArray[0][colIndex - 1]) && 1 < (index =
|
|
15860
15963
|
Math.min(parseInt(eleArray[0][colIndex].getAttribute('colspan'), 10) || 1, max - min + 1)) &&
|
|
@@ -16532,6 +16635,29 @@ class SelectionCommands {
|
|
|
16532
16635
|
const nodeCutter = new NodeCutter();
|
|
16533
16636
|
const isFormatted = new IsFormatted();
|
|
16534
16637
|
let range = domSelection.getRange(docElement);
|
|
16638
|
+
let currentAnchorNode = range.startContainer.parentElement;
|
|
16639
|
+
if (range.collapsed && !isNullOrUndefined(currentAnchorNode) &&
|
|
16640
|
+
currentAnchorNode.tagName === 'A' &&
|
|
16641
|
+
(range.startOffset === currentAnchorNode.textContent.length || range.startOffset === 0)) {
|
|
16642
|
+
const emptyTextNode = document.createTextNode('');
|
|
16643
|
+
if (range.startOffset === 0) {
|
|
16644
|
+
currentAnchorNode.parentNode.insertBefore(emptyTextNode, currentAnchorNode);
|
|
16645
|
+
}
|
|
16646
|
+
else {
|
|
16647
|
+
if (!isNullOrUndefined(currentAnchorNode.nextSibling)) {
|
|
16648
|
+
currentAnchorNode.parentElement.insertBefore(emptyTextNode, currentAnchorNode.nextSibling);
|
|
16649
|
+
}
|
|
16650
|
+
else {
|
|
16651
|
+
currentAnchorNode.parentNode.appendChild(emptyTextNode);
|
|
16652
|
+
}
|
|
16653
|
+
}
|
|
16654
|
+
// Set the range to the empty text node
|
|
16655
|
+
const newRange = docElement.createRange();
|
|
16656
|
+
range.setStart(emptyTextNode, 0);
|
|
16657
|
+
range.setEnd(emptyTextNode, 0);
|
|
16658
|
+
range.collapse(true);
|
|
16659
|
+
domSelection.setRange(docElement, newRange);
|
|
16660
|
+
}
|
|
16535
16661
|
if (Browser.userAgent.indexOf('Firefox') !== -1 && range.startContainer === range.endContainer && !isNullOrUndefined(endNode) && range.startContainer === endNode) {
|
|
16536
16662
|
const startChildNodes = range.startContainer.childNodes;
|
|
16537
16663
|
const startNode = ((startChildNodes[(range.startOffset > 0) ? (range.startOffset - 1) :
|
|
@@ -16907,7 +17033,10 @@ class SelectionCommands {
|
|
|
16907
17033
|
}
|
|
16908
17034
|
let num = index;
|
|
16909
17035
|
let liChildContent = '';
|
|
16910
|
-
|
|
17036
|
+
/* eslint-disable security/detect-object-injection */
|
|
17037
|
+
while (num >= 0 && !isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.contains(nodes[num]) &&
|
|
17038
|
+
liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
|
|
17039
|
+
/* eslint-enable security/detect-object-injection */
|
|
16911
17040
|
liChildContent = ' ' + nodes[num].textContent.trim() + liChildContent;
|
|
16912
17041
|
num--;
|
|
16913
17042
|
}
|
|
@@ -16979,6 +17108,23 @@ class SelectionCommands {
|
|
|
16979
17108
|
parentElement = parentElement.parentElement;
|
|
16980
17109
|
liElement = parentElement;
|
|
16981
17110
|
}
|
|
17111
|
+
if (format === 'fontcolor') {
|
|
17112
|
+
const parentElem = nodes[index].parentElement;
|
|
17113
|
+
if (!isNullOrUndefined(parentElem) && parentElem.childNodes) {
|
|
17114
|
+
for (let i = 0; i < parentElem.childNodes.length; i++) {
|
|
17115
|
+
if (this.concatenateTextExcludingList(nodes, index) === nodes[index].textContent) {
|
|
17116
|
+
if (parentElem.tagName === 'LI') {
|
|
17117
|
+
parentElem.style.color = value;
|
|
17118
|
+
}
|
|
17119
|
+
}
|
|
17120
|
+
// eslint-disable-next-line
|
|
17121
|
+
const childElement = parentElem.childNodes[i];
|
|
17122
|
+
if (childElement.tagName === 'OL' || childElement.tagName === 'UL') {
|
|
17123
|
+
childElement.style.color = 'initial';
|
|
17124
|
+
}
|
|
17125
|
+
}
|
|
17126
|
+
}
|
|
17127
|
+
}
|
|
16982
17128
|
if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' &&
|
|
16983
17129
|
liElement.textContent.trim() === nodes[index].textContent.trim()) {
|
|
16984
17130
|
if (format === 'fontsize') {
|
|
@@ -17278,6 +17424,18 @@ class SelectionCommands {
|
|
|
17278
17424
|
}
|
|
17279
17425
|
}
|
|
17280
17426
|
}
|
|
17427
|
+
static concatenateTextExcludingList(nodes, index) {
|
|
17428
|
+
let result = '';
|
|
17429
|
+
const parentNode = nodes[index].parentElement;
|
|
17430
|
+
for (let i = 0; i < parentNode.childNodes.length; i++) {
|
|
17431
|
+
// eslint-disable-next-line
|
|
17432
|
+
const childNode = parentNode.childNodes[i];
|
|
17433
|
+
if ((childNode.nodeType === 3) || (childNode.nodeType === 1 && (childNode.tagName !== 'OL' && childNode.tagName !== 'UL'))) {
|
|
17434
|
+
result += childNode.textContent;
|
|
17435
|
+
}
|
|
17436
|
+
}
|
|
17437
|
+
return result;
|
|
17438
|
+
}
|
|
17281
17439
|
}
|
|
17282
17440
|
SelectionCommands.enterAction = 'P';
|
|
17283
17441
|
|
|
@@ -17986,7 +18144,6 @@ class MsWordPaste {
|
|
|
17986
18144
|
if (patern.test(tempHTMLContent) || patern2.test(tempHTMLContent) || patern3.test(tempHTMLContent) ||
|
|
17987
18145
|
pattern4.test(tempHTMLContent)) {
|
|
17988
18146
|
const source = this.findSource(elm);
|
|
17989
|
-
this.imageConversion(elm, rtfData);
|
|
17990
18147
|
tempHTMLContent = tempHTMLContent.replace(/<img[^>]+>/i, '');
|
|
17991
18148
|
this.addListClass(elm);
|
|
17992
18149
|
listNodes = this.cleanUp(elm, listNodes);
|
|
@@ -17994,6 +18151,7 @@ class MsWordPaste {
|
|
|
17994
18151
|
listNodes[0].parentElement.tagName !== 'OL') {
|
|
17995
18152
|
this.listConverter(listNodes);
|
|
17996
18153
|
}
|
|
18154
|
+
this.imageConversion(elm, rtfData);
|
|
17997
18155
|
this.cleanList(elm, 'UL');
|
|
17998
18156
|
this.cleanList(elm, 'OL');
|
|
17999
18157
|
this.styleCorrection(elm, wordPasteStyleConfig);
|
|
@@ -18002,11 +18160,11 @@ class MsWordPaste {
|
|
|
18002
18160
|
this.removeEmptyElements(elm);
|
|
18003
18161
|
this.removeEmptyAnchorTag(elm);
|
|
18004
18162
|
this.breakLineAddition(elm);
|
|
18163
|
+
this.processMargin(elm);
|
|
18005
18164
|
this.removeClassName(elm);
|
|
18006
18165
|
if (pattern4.test(tempHTMLContent)) {
|
|
18007
18166
|
this.addTableBorderClass(elm);
|
|
18008
18167
|
}
|
|
18009
|
-
this.processMargin(elm);
|
|
18010
18168
|
e.callBack(elm.innerHTML, this.cropImageDimensions, source);
|
|
18011
18169
|
}
|
|
18012
18170
|
else {
|
|
@@ -18077,8 +18235,9 @@ class MsWordPaste {
|
|
|
18077
18235
|
imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0 &&
|
|
18078
18236
|
imgElem[i].getAttribute('v:shapes').indexOf('_x0000_s') < 0 &&
|
|
18079
18237
|
imgElem[i].getAttribute('v:shapes').indexOf('_x0000_i') < 0) {
|
|
18080
|
-
|
|
18238
|
+
imgElem[i].classList.add('e-rte-image-unsupported');
|
|
18081
18239
|
}
|
|
18240
|
+
imgElem[i].removeAttribute('v:shapes');
|
|
18082
18241
|
}
|
|
18083
18242
|
imgElem = elm.querySelectorAll('img');
|
|
18084
18243
|
const imgSrc = [];
|
|
@@ -18108,6 +18267,7 @@ class MsWordPaste {
|
|
|
18108
18267
|
});
|
|
18109
18268
|
}
|
|
18110
18269
|
}
|
|
18270
|
+
imgElem = elm.querySelectorAll('img:not(.e-rte-image-unsupported');
|
|
18111
18271
|
for (let i = 0; i < imgElem.length; i++) {
|
|
18112
18272
|
if (imgSrc[i].match(linkRegex)) {
|
|
18113
18273
|
imgElem[i].setAttribute('src', imgSrc[i]);
|
|
@@ -18118,7 +18278,7 @@ class MsWordPaste {
|
|
|
18118
18278
|
}
|
|
18119
18279
|
else {
|
|
18120
18280
|
imgElem[i].removeAttribute('src');
|
|
18121
|
-
imgElem[i].
|
|
18281
|
+
imgElem[i].classList.add('e-rte-image-unsupported');
|
|
18122
18282
|
}
|
|
18123
18283
|
if (!isNullOrUndefined(base64Src[i]) && base64Src[i].isCroppedImage) {
|
|
18124
18284
|
imgElem[i].classList.add('e-img-cropped');
|
|
@@ -18126,6 +18286,10 @@ class MsWordPaste {
|
|
|
18126
18286
|
}
|
|
18127
18287
|
imgElem[i].setAttribute('id', 'msWordImg-' + imgName[i]);
|
|
18128
18288
|
}
|
|
18289
|
+
imgElem = elm.querySelectorAll('.e-rte-image-unsupported');
|
|
18290
|
+
for (let i = 0; i < imgElem.length; i++) {
|
|
18291
|
+
imgElem[i].removeAttribute('src');
|
|
18292
|
+
}
|
|
18129
18293
|
}
|
|
18130
18294
|
}
|
|
18131
18295
|
checkVShape(elm) {
|
|
@@ -18199,6 +18363,9 @@ class MsWordPaste {
|
|
|
18199
18363
|
const result = [];
|
|
18200
18364
|
if (!isNullOrUndefined(fullImg)) {
|
|
18201
18365
|
for (let i = 0; i < fullImg.length; i++) {
|
|
18366
|
+
if (fullImg[i].indexOf('fIsBullet') !== -1 && fullImg[i].indexOf('wzName') === -1) {
|
|
18367
|
+
continue;
|
|
18368
|
+
}
|
|
18202
18369
|
let isCroppedImage = false;
|
|
18203
18370
|
let goalWidth = 0;
|
|
18204
18371
|
let goalHeight = 0;
|
|
@@ -18213,7 +18380,7 @@ class MsWordPaste {
|
|
|
18213
18380
|
else if (fullImg[i].indexOf('\\jpegblip') !== -1) {
|
|
18214
18381
|
imgType = 'image/jpeg';
|
|
18215
18382
|
}
|
|
18216
|
-
else if (fullImg[i].indexOf('\\
|
|
18383
|
+
else if (fullImg[i].indexOf('\\emfblip') !== -1) {
|
|
18217
18384
|
imgType = null;
|
|
18218
18385
|
}
|
|
18219
18386
|
else {
|
|
@@ -18253,7 +18420,7 @@ class MsWordPaste {
|
|
|
18253
18420
|
return parseInt(result, 10);
|
|
18254
18421
|
}
|
|
18255
18422
|
removeClassName(elm) {
|
|
18256
|
-
const elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped)');
|
|
18423
|
+
const elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped):not(.e-rte-image-unsupported)');
|
|
18257
18424
|
for (let i = 0; i < elmWithClass.length; i++) {
|
|
18258
18425
|
elmWithClass[i].removeAttribute('class');
|
|
18259
18426
|
}
|
|
@@ -18290,7 +18457,7 @@ class MsWordPaste {
|
|
|
18290
18457
|
return removableElement;
|
|
18291
18458
|
}
|
|
18292
18459
|
removeUnwantedElements(elm) {
|
|
18293
|
-
|
|
18460
|
+
const styleElm = elm.querySelector('style');
|
|
18294
18461
|
if (!isNullOrUndefined(styleElm)) {
|
|
18295
18462
|
detach(styleElm);
|
|
18296
18463
|
}
|
|
@@ -18526,6 +18693,7 @@ class MsWordPaste {
|
|
|
18526
18693
|
listConverter(listNodes) {
|
|
18527
18694
|
let level;
|
|
18528
18695
|
const data = [];
|
|
18696
|
+
let listFormatOverride;
|
|
18529
18697
|
let collection = [];
|
|
18530
18698
|
let content = '';
|
|
18531
18699
|
let stNode;
|
|
@@ -18547,6 +18715,17 @@ class MsWordPaste {
|
|
|
18547
18715
|
else {
|
|
18548
18716
|
level = 1;
|
|
18549
18717
|
}
|
|
18718
|
+
if (content && content.indexOf('mso-list:') !== -1) {
|
|
18719
|
+
let msoListValue;
|
|
18720
|
+
if (content.match(/mso-list:[^;]+;?/)) {
|
|
18721
|
+
const changedContent = content.replace('\n', '').split(' ').join('');
|
|
18722
|
+
msoListValue = changedContent.match(/mso-list:[^;]+;?/)[0].split(':l');
|
|
18723
|
+
listFormatOverride = isNullOrUndefined(msoListValue) ? null : parseInt(msoListValue[1].split('level')[0], 10);
|
|
18724
|
+
}
|
|
18725
|
+
else {
|
|
18726
|
+
listFormatOverride = null;
|
|
18727
|
+
}
|
|
18728
|
+
}
|
|
18550
18729
|
this.listContents = [];
|
|
18551
18730
|
this.getListContent(listNodes[i]);
|
|
18552
18731
|
let type;
|
|
@@ -18582,9 +18761,9 @@ class MsWordPaste {
|
|
|
18582
18761
|
startAttr = this.lowerGreekNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
|
|
18583
18762
|
}
|
|
18584
18763
|
}
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18764
|
+
}
|
|
18765
|
+
if (listNodes[i].style.marginLeft !== '') {
|
|
18766
|
+
styleMarginLeft = listNodes[i].style.marginLeft;
|
|
18588
18767
|
}
|
|
18589
18768
|
const tempNode = [];
|
|
18590
18769
|
for (let j = 1; j < this.listContents.length; j++) {
|
|
@@ -18600,7 +18779,8 @@ class MsWordPaste {
|
|
|
18600
18779
|
currentListStyle = listNodes[i].getAttribute('style');
|
|
18601
18780
|
}
|
|
18602
18781
|
collection.push({
|
|
18603
|
-
listType: type, content: tempNode, nestedLevel: level,
|
|
18782
|
+
listType: type, content: tempNode, nestedLevel: level,
|
|
18783
|
+
listFormatOverride: listFormatOverride, class: currentClassName,
|
|
18604
18784
|
listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft
|
|
18605
18785
|
});
|
|
18606
18786
|
}
|
|
@@ -18673,6 +18853,7 @@ class MsWordPaste {
|
|
|
18673
18853
|
let prevList;
|
|
18674
18854
|
let listCount = 0;
|
|
18675
18855
|
let elem;
|
|
18856
|
+
let lfo = collection[0].listFormatOverride;
|
|
18676
18857
|
for (let index = 0; index < collection.length; index++) {
|
|
18677
18858
|
const listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
|
|
18678
18859
|
let isNormalList = false;
|
|
@@ -18689,16 +18870,24 @@ class MsWordPaste {
|
|
|
18689
18870
|
}
|
|
18690
18871
|
const pElement = createElement('p', { className: 'MsoNormal' });
|
|
18691
18872
|
pElement.innerHTML = collection[index].content.join(' ');
|
|
18692
|
-
if ((collection[index].nestedLevel === 1) &&
|
|
18873
|
+
if ((collection[index].nestedLevel === 1) &&
|
|
18874
|
+
(listCount === 0 || lfo !== collection[index].listFormatOverride) &&
|
|
18875
|
+
collection[index].content) {
|
|
18693
18876
|
root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
|
|
18694
18877
|
prevList = createElement('li');
|
|
18695
18878
|
prevList.appendChild(pElement);
|
|
18696
18879
|
temp.appendChild(prevList);
|
|
18697
18880
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
18698
|
-
|
|
18881
|
+
if (collection[index].class !== 'msolistparagraph') {
|
|
18882
|
+
temp.style.marginLeft = collection[index].styleMarginLeft;
|
|
18883
|
+
}
|
|
18884
|
+
else {
|
|
18885
|
+
addClass([temp], 'marginLeftIgnore');
|
|
18886
|
+
}
|
|
18699
18887
|
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
18700
18888
|
}
|
|
18701
|
-
else if (collection[index].nestedLevel === pLevel
|
|
18889
|
+
else if (collection[index].nestedLevel === pLevel &&
|
|
18890
|
+
lfo === collection[index].listFormatOverride) {
|
|
18702
18891
|
if (!isNullOrUndefined(prevList) && !isNullOrUndefined(prevList.parentElement)
|
|
18703
18892
|
&& prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
|
|
18704
18893
|
prevList.parentElement.appendChild(prevList = createElement('li'));
|
|
@@ -18761,6 +18950,12 @@ class MsWordPaste {
|
|
|
18761
18950
|
prevList.appendChild(pElement);
|
|
18762
18951
|
temp.appendChild(prevList);
|
|
18763
18952
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
18953
|
+
if (collection[index].class !== 'msolistparagraph') {
|
|
18954
|
+
temp.style.marginLeft = collection[index].styleMarginLeft;
|
|
18955
|
+
}
|
|
18956
|
+
else {
|
|
18957
|
+
addClass([temp], 'marginLeftIgnore');
|
|
18958
|
+
}
|
|
18764
18959
|
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
18765
18960
|
}
|
|
18766
18961
|
}
|
|
@@ -18784,14 +18979,34 @@ class MsWordPaste {
|
|
|
18784
18979
|
elem = elem.parentElement;
|
|
18785
18980
|
if (elem.attributes.getNamedItem('level')) {
|
|
18786
18981
|
// eslint-disable-next-line
|
|
18787
|
-
if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel
|
|
18982
|
+
if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
|
|
18983
|
+
lfo === collection[index].listFormatOverride) {
|
|
18788
18984
|
prevList = createElement('li');
|
|
18789
18985
|
prevList.appendChild(pElement);
|
|
18790
18986
|
elem.appendChild(prevList);
|
|
18791
18987
|
break;
|
|
18792
18988
|
// eslint-disable-next-line
|
|
18793
18989
|
}
|
|
18794
|
-
else if (
|
|
18990
|
+
else if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
|
|
18991
|
+
lfo !== collection[index].listFormatOverride) {
|
|
18992
|
+
temp = createElement(collection[index].listType);
|
|
18993
|
+
prevList = createElement('li');
|
|
18994
|
+
temp.appendChild(prevList);
|
|
18995
|
+
if (collection[index].nestedLevel > 1) {
|
|
18996
|
+
for (let k = 0; k < collection[index].nestedLevel - 1; k++) {
|
|
18997
|
+
prevList.appendChild(temp = createElement(collection[index].listType));
|
|
18998
|
+
prevList = createElement('li');
|
|
18999
|
+
temp.appendChild(prevList);
|
|
19000
|
+
temp.style.listStyleType = 'none';
|
|
19001
|
+
}
|
|
19002
|
+
}
|
|
19003
|
+
prevList.appendChild(pElement);
|
|
19004
|
+
elem.appendChild(temp);
|
|
19005
|
+
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
19006
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
19007
|
+
break;
|
|
19008
|
+
}
|
|
19009
|
+
else if (collection[index].nestedLevel > parseInt(elem.attributes.getNamedItem('level').textContent, 10)) {
|
|
18795
19010
|
elem.appendChild(temp = createElement(collection[index].listType));
|
|
18796
19011
|
prevList = createElement('li');
|
|
18797
19012
|
prevList.appendChild(pElement);
|
|
@@ -18807,8 +19022,9 @@ class MsWordPaste {
|
|
|
18807
19022
|
prevList.setAttribute('class', collection[index].class);
|
|
18808
19023
|
prevList.setAttribute('style', (!isNullOrUndefined(collection[index].listStyle) ? collection[index].listStyle : ''));
|
|
18809
19024
|
pLevel = collection[index].nestedLevel;
|
|
19025
|
+
lfo = collection[index].listFormatOverride;
|
|
18810
19026
|
listCount++;
|
|
18811
|
-
if (!isNullOrUndefined(collection[index].start)) {
|
|
19027
|
+
if (!isNullOrUndefined(collection[index].start && collection[index].start !== 1 && collection[index].listType === 'ol')) {
|
|
18812
19028
|
temp.setAttribute('start', collection[index].start.toString());
|
|
18813
19029
|
}
|
|
18814
19030
|
}
|
|
@@ -18845,7 +19061,7 @@ class MsWordPaste {
|
|
|
18845
19061
|
const liChildren = element.querySelectorAll('li');
|
|
18846
19062
|
if (liChildren.length > 0) {
|
|
18847
19063
|
for (let i = 0; i < liChildren.length; i++) {
|
|
18848
|
-
if (!isNullOrUndefined((liChildren[i]).style.marginLeft)) {
|
|
19064
|
+
if (!isNullOrUndefined((liChildren[i]).style.marginLeft) && !liChildren[i].parentElement.classList.contains('marginLeftIgnore')) {
|
|
18849
19065
|
(liChildren[i]).style.marginLeft = '';
|
|
18850
19066
|
}
|
|
18851
19067
|
}
|
|
@@ -18859,6 +19075,17 @@ class MsWordPaste {
|
|
|
18859
19075
|
}
|
|
18860
19076
|
}
|
|
18861
19077
|
}
|
|
19078
|
+
const ignoredNode = element.querySelectorAll('.marginLeftIgnore li');
|
|
19079
|
+
if (ignoredNode.length > 0) {
|
|
19080
|
+
for (let i = 0; i < ignoredNode.length; i++) {
|
|
19081
|
+
if (!isNullOrUndefined((ignoredNode[i]).style.marginLeft) && (ignoredNode[i]).style.marginLeft !== '') {
|
|
19082
|
+
const marginLeft = (ignoredNode[i]).style.marginLeft;
|
|
19083
|
+
const marginLeftValue = parseFloat(marginLeft.split('in')[0]);
|
|
19084
|
+
const result = marginLeftValue - 0.5;
|
|
19085
|
+
(ignoredNode[i]).style.marginLeft = result.toString() + 'in';
|
|
19086
|
+
}
|
|
19087
|
+
}
|
|
19088
|
+
}
|
|
18862
19089
|
}
|
|
18863
19090
|
removeEmptyAnchorTag(element) {
|
|
18864
19091
|
const removableElement = element.querySelectorAll('a:not([href])');
|
|
@@ -20408,8 +20635,10 @@ const IFRAMEHEADER = `
|
|
|
20408
20635
|
span.e-selected-node {background-color: #939393;color: white;}
|
|
20409
20636
|
span.e-selected-node.e-highlight {background-color: #1d9dd8;}
|
|
20410
20637
|
body{color:#333;word-wrap:break-word;padding: 8px;box-sizing: border-box;}
|
|
20411
|
-
.e-rte-image, .e-rte-
|
|
20638
|
+
.e-rte-image, .e-rte-video {border: 0;cursor: pointer;display:
|
|
20412
20639
|
block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}
|
|
20640
|
+
.e-rte-audio {border: 0;cursor: pointer;display:
|
|
20641
|
+
block;float: none;margin: 5px auto;max-width: 100%;position: relative;}
|
|
20413
20642
|
.e-rte-image.e-imginline, .e-rte-audio.e-audio-inline, .e-rte-video.e-video-inline {display: inline-block;float: none;max-width: calc(100% - (2 * 5px));padding: 1px;vertical-align: bottom;}
|
|
20414
20643
|
.e-rte-image.e-imgcenter, .e-rte-video.e-video-center {cursor: pointer;display: block;float: none;margin: 5px auto;max-width: 100%;position: relative;}
|
|
20415
20644
|
.e-rte-image.e-imgright, .e-rte-video.e-video-right { float: right; margin: 0 auto;margin-left: 5px;text-align: right;}
|
|
@@ -20418,6 +20647,10 @@ const IFRAMEHEADER = `
|
|
|
20418
20647
|
.e-img-caption.e-caption-inline {display: inline-block;float: none;
|
|
20419
20648
|
margin: 5px auto;margin-left: 5px;margin-right: 5px;max-width: calc(100% - (2 * 5px));
|
|
20420
20649
|
position: relativetext-align: center;vertical-align: bottom;}
|
|
20650
|
+
.e-rte-img-caption.e-imgcenter {display: contents; margin-left: auto; margin-right: auto;}
|
|
20651
|
+
.e-rte-img-caption.e-imgright {display: contents; margin-left: auto; margin-right: 0;}
|
|
20652
|
+
.e-rte-img-caption.e-imgleft {display: contents;margin-left: 0;margin-right: auto;}
|
|
20653
|
+
.e-img-caption.e-rte-img-caption.e-imgbreak {display: contents;}
|
|
20421
20654
|
.e-img-inner {box-sizing: border-box;display: block;font-size: 16px;font-weight: initial;
|
|
20422
20655
|
margin: auto;opacity: .9;text-align: center;width: 100%;}
|
|
20423
20656
|
.e-img-wrap {display: inline-block;margin: auto;padding: 0;text-align: center;width: 100%;}
|
|
@@ -20431,12 +20664,12 @@ const IFRAMEHEADER = `
|
|
|
20431
20664
|
display: block;float: none;height: auto;margin: 5px auto;max-width: 100%;position: relative;}
|
|
20432
20665
|
.e-rte-image.e-img-focus:not(.e-resize), .e-audio-focus:not(.e-resize), .e-video-focus:not(.e-resize) {border: solid 2px #4a90e2;}
|
|
20433
20666
|
img.e-img-focus::selection, audio.e-audio-focus::selection, .e-video-focus::selection { background: transparent;color: transparent;}
|
|
20434
|
-
span.e-rte-imageboxmark { width: 10px; height: 10px; position: absolute; display: block;
|
|
20667
|
+
span.e-rte-imageboxmark, span.e-rte-videoboxmark { width: 10px; height: 10px; position: absolute; display: block;
|
|
20435
20668
|
background: #4a90e2; border: 1px solid #fff; z-index: 1000;}
|
|
20436
|
-
.e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }
|
|
20437
|
-
.e-mob-rte span.e-rte-imageboxmark { background: #fff; border: 1px solid #4a90e2;
|
|
20669
|
+
.e-mob-rte.e-mob-span span.e-rte-imageboxmark, .e-mob-rte.e-mob-span span.e-rte-videoboxmark { background: #4a90e2; border: 1px solid #fff; }
|
|
20670
|
+
.e-mob-rte span.e-rte-imageboxmark, .e-mob-rte span.e-rte-videoboxmark { background: #fff; border: 1px solid #4a90e2;
|
|
20438
20671
|
border-radius: 15px; height: 20px; width: 20px; }
|
|
20439
|
-
.e-mob-rte.e-mob-span span.e-rte-imageboxmark { background: #4a90e2; border: 1px solid #fff; }
|
|
20672
|
+
.e-mob-rte.e-mob-span span.e-rte-imageboxmark, .e-mob-rte.e-mob-span span.e-rte-videoboxmark { background: #4a90e2; border: 1px solid #fff; }
|
|
20440
20673
|
.e-rte-content .e-content img.e-resize, .e-rte-content .e-content video.e-resize { z-index: 1000; }
|
|
20441
20674
|
.e-img-caption .e-img-inner { outline: 0; }
|
|
20442
20675
|
.e-img-caption a:focus-visible { outline: none; }
|
|
@@ -20901,9 +21134,12 @@ class HtmlEditor {
|
|
|
20901
21134
|
const range = this.parent.getRange();
|
|
20902
21135
|
// eslint-disable-next-line
|
|
20903
21136
|
const regEx = new RegExp(String.fromCharCode(8203), 'g');
|
|
21137
|
+
const isEmptyNode = range.startContainer === range.endContainer && range.startOffset === range.endOffset &&
|
|
21138
|
+
range.startOffset === 1 && range.startContainer.textContent.length === 1 && range.startContainer.textContent.charCodeAt(0) == 8203 &&
|
|
21139
|
+
range.startContainer.textContent.replace(regEx, '').length === 0;
|
|
20904
21140
|
let pointer;
|
|
20905
21141
|
let isRootParent = false;
|
|
20906
|
-
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
|
|
21142
|
+
if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
|
|
20907
21143
|
pointer = range.startOffset;
|
|
20908
21144
|
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
20909
21145
|
range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
|
|
@@ -21025,8 +21261,13 @@ class HtmlEditor {
|
|
|
21025
21261
|
else {
|
|
21026
21262
|
this.parent.notify(enterHandler, { args: e.args });
|
|
21027
21263
|
const newRange = this.parent.getRange();
|
|
21028
|
-
if (!isNullOrUndefined(newRange.startContainer) &&
|
|
21029
|
-
newRange.startContainer.
|
|
21264
|
+
if (!isNullOrUndefined(newRange.startContainer) && this.parent.height !== 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
21265
|
+
&& !this.parent.iframeSettings.enable && newRange.startContainer.getBoundingClientRect().bottom > this.parent.element.getBoundingClientRect().bottom) {
|
|
21266
|
+
this.parent.element.querySelector('.e-rte-content').scrollTop += newRange.startContainer.getBoundingClientRect().bottom - this.parent.element.getBoundingClientRect().bottom;
|
|
21267
|
+
}
|
|
21268
|
+
else if (!isNullOrUndefined(newRange.startContainer) && this.parent.height === 'auto' && newRange.startContainer.nodeName !== '#text'
|
|
21269
|
+
&& !this.parent.iframeSettings.enable && window.innerHeight < newRange.startContainer.getBoundingClientRect().top) {
|
|
21270
|
+
newRange.startContainer.scrollIntoView({ block: 'end', inline: 'nearest' });
|
|
21030
21271
|
}
|
|
21031
21272
|
}
|
|
21032
21273
|
}
|
|
@@ -21108,11 +21349,13 @@ class HtmlEditor {
|
|
|
21108
21349
|
currentRange.startContainer.previousSibling.nodeName === 'SPAN') {
|
|
21109
21350
|
isPreviousNotContentEditable = currentRange.startContainer.previousSibling.contentEditable === 'false' ? false : true;
|
|
21110
21351
|
}
|
|
21352
|
+
const checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
|
|
21353
|
+
const isSelectedPositionNotStart = closest(currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer, 'li') ?
|
|
21354
|
+
checkNode.nodeName !== 'li' && isNullOrUndefined(checkNode.previousSibling) : true;
|
|
21111
21355
|
if (e.args.code === 'Backspace' && e.args.keyCode === 8 && currentRange.startOffset === 0 &&
|
|
21112
21356
|
currentRange.endOffset === 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.textContent.length > 0 &&
|
|
21113
21357
|
currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH' &&
|
|
21114
|
-
isPreviousNotContentEditable) {
|
|
21115
|
-
const checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
|
|
21358
|
+
isPreviousNotContentEditable && isSelectedPositionNotStart) {
|
|
21116
21359
|
if ((!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
|
|
21117
21360
|
!isNullOrUndefined(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') ||
|
|
21118
21361
|
(!isNullOrUndefined(currentRange.startContainer.previousSibling) && currentRange.startContainer.previousSibling.nodeName === 'BR')) {
|
|
@@ -21124,7 +21367,8 @@ class HtmlEditor {
|
|
|
21124
21367
|
if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
|
|
21125
21368
|
this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
|
|
21126
21369
|
liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
|
|
21127
|
-
if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR'
|
|
21370
|
+
if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR' &&
|
|
21371
|
+
isNullOrUndefined(liElement.lastElementChild.previousSibling)) {
|
|
21128
21372
|
this.rangeElement = liElement.lastElementChild;
|
|
21129
21373
|
isLiElement = true;
|
|
21130
21374
|
}
|
|
@@ -21415,9 +21659,11 @@ class HtmlEditor {
|
|
|
21415
21659
|
this.tooltipTargetEle = closest(args.originalEvent.target, '[data-tooltip-id]');
|
|
21416
21660
|
if (!isNullOrUndefined(this.tooltipTargetEle) && this.parent.showTooltip && !isNullOrUndefined(currentDocument.querySelector('.e-tooltip-wrap'))) {
|
|
21417
21661
|
this.parent.notify(destroyTooltip, { args: event });
|
|
21418
|
-
this.tooltipTargetEle.
|
|
21419
|
-
|
|
21420
|
-
|
|
21662
|
+
if (!this.tooltipTargetEle.closest('.e-rte-quick-popup')) {
|
|
21663
|
+
this.tooltipTargetEle.setAttribute('data-title', this.tooltipTargetEle.getAttribute('title'));
|
|
21664
|
+
this.tooltipTargetEle.removeAttribute('title');
|
|
21665
|
+
EventHandler.add(this.tooltipTargetEle, 'mouseout', this.mouseOutHandler, this);
|
|
21666
|
+
}
|
|
21421
21667
|
}
|
|
21422
21668
|
if (item.command !== 'FormatPainter') {
|
|
21423
21669
|
if (closestElement && !closestElement.classList.contains('e-rte-inline-popup') && !closestElement.classList.contains('e-rte-text-popup')) {
|
|
@@ -21710,6 +21956,7 @@ class PasteCleanup {
|
|
|
21710
21956
|
this.parent.on(pasteClean, this.pasteClean, this);
|
|
21711
21957
|
this.parent.on(bindCssClass, this.setCssClass, this);
|
|
21712
21958
|
this.parent.on(destroy, this.destroy, this);
|
|
21959
|
+
this.parent.on(docClick, this.docClick, this);
|
|
21713
21960
|
}
|
|
21714
21961
|
destroy() {
|
|
21715
21962
|
this.removeEventListener();
|
|
@@ -21721,6 +21968,7 @@ class PasteCleanup {
|
|
|
21721
21968
|
this.parent.off(pasteClean, this.pasteClean);
|
|
21722
21969
|
this.parent.off(bindCssClass, this.setCssClass);
|
|
21723
21970
|
this.parent.off(destroy, this.destroy);
|
|
21971
|
+
this.parent.off(docClick, this.docClick);
|
|
21724
21972
|
}
|
|
21725
21973
|
pasteClean(e) {
|
|
21726
21974
|
const args = {
|
|
@@ -21789,6 +22037,12 @@ class PasteCleanup {
|
|
|
21789
22037
|
this.saveSelection = this.nodeSelectionObj.save(range, currentDocument);
|
|
21790
22038
|
const tempDivElem = this.parent.createElement('div');
|
|
21791
22039
|
tempDivElem.innerHTML = value;
|
|
22040
|
+
const unsupportedImg = tempDivElem.querySelectorAll('.e-rte-image-unsupported');
|
|
22041
|
+
for (let index = 0; index < unsupportedImg.length; index++) {
|
|
22042
|
+
unsupportedImg[index].setAttribute('alt', this.i10n.getConstant('unsupportedImage'));
|
|
22043
|
+
unsupportedImg[index].classList.remove('e-rte-image-unsupported');
|
|
22044
|
+
}
|
|
22045
|
+
value = tempDivElem.innerHTML;
|
|
21792
22046
|
const isValueNotEmpty = tempDivElem.textContent !== '' || !isNullOrUndefined(tempDivElem.querySelector('img')) ||
|
|
21793
22047
|
!isNullOrUndefined(tempDivElem.querySelector('table'));
|
|
21794
22048
|
this.parent.notify(cleanupResizeElements, {
|
|
@@ -22068,7 +22322,9 @@ class PasteCleanup {
|
|
|
22068
22322
|
});
|
|
22069
22323
|
popupObj.close();
|
|
22070
22324
|
imgElem.style.opacity = '1';
|
|
22071
|
-
uploadObj.
|
|
22325
|
+
if (!uploadObj.isDestroyed) {
|
|
22326
|
+
uploadObj.destroy();
|
|
22327
|
+
}
|
|
22072
22328
|
this.toolbarEnableDisable(false);
|
|
22073
22329
|
}
|
|
22074
22330
|
refreshPopup(imageElement, popupObj) {
|
|
@@ -22218,7 +22474,7 @@ class PasteCleanup {
|
|
|
22218
22474
|
width: '300px',
|
|
22219
22475
|
height: '265px',
|
|
22220
22476
|
cssClass: CLS_RTE_DIALOG_MIN_HEIGHT,
|
|
22221
|
-
isModal:
|
|
22477
|
+
isModal: Browser.isDevice,
|
|
22222
22478
|
visible: false
|
|
22223
22479
|
};
|
|
22224
22480
|
this.dialogObj = this.dialogRenderObj.render(dialogModel);
|
|
@@ -22272,13 +22528,22 @@ class PasteCleanup {
|
|
|
22272
22528
|
this.updateCss(this.keepRadioButton, e);
|
|
22273
22529
|
}
|
|
22274
22530
|
destroyDialog(rteDialogWrapper) {
|
|
22275
|
-
const rteDialogContainer = this.parent.element.querySelector('.e-
|
|
22531
|
+
const rteDialogContainer = this.parent.element.querySelector('.e-rte-dialog-minheight');
|
|
22276
22532
|
detach(rteDialogContainer);
|
|
22277
22533
|
const rteDialogWrapperChildLength = rteDialogWrapper.children.length;
|
|
22278
22534
|
for (let i = 0; i < rteDialogWrapperChildLength; i++) {
|
|
22279
22535
|
detach(rteDialogWrapper.children[0]);
|
|
22280
22536
|
}
|
|
22281
22537
|
}
|
|
22538
|
+
docClick(e) {
|
|
22539
|
+
const target = e.args.target;
|
|
22540
|
+
if (target && target.classList && ((this.dialogObj && !closest(target, '[id=' + "'" + this.dialogObj.element.id + "'" + ']')))
|
|
22541
|
+
&& (!target.classList.contains('e-toolbar-item'))) {
|
|
22542
|
+
if (this.dialogObj) {
|
|
22543
|
+
this.dialogObj.hide();
|
|
22544
|
+
}
|
|
22545
|
+
}
|
|
22546
|
+
}
|
|
22282
22547
|
cleanAppleClass(elem) {
|
|
22283
22548
|
const appleClassElem = elem.querySelectorAll('br.Apple-interchange-newline');
|
|
22284
22549
|
for (let i = 0; i < appleClassElem.length; i++) {
|
|
@@ -22351,7 +22616,8 @@ class PasteCleanup {
|
|
|
22351
22616
|
this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
|
|
22352
22617
|
extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
|
|
22353
22618
|
this.parent.formatter.onSuccess(this.parent, args);
|
|
22354
|
-
if (!isNullOrUndefined(returnArgs.elements) && !isNullOrUndefined(returnArgs.imgElem)
|
|
22619
|
+
if (!isNullOrUndefined(returnArgs.elements) && !isNullOrUndefined(returnArgs.imgElem) &&
|
|
22620
|
+
returnArgs.imgElem.length > 0) {
|
|
22355
22621
|
const pasteContent = returnArgs.elements;
|
|
22356
22622
|
const imageContent = returnArgs.imgElem;
|
|
22357
22623
|
const lastElementChild = this.findLastElement(pasteContent[pasteContent.length - 1]);
|
|
@@ -22416,6 +22682,7 @@ class PasteCleanup {
|
|
|
22416
22682
|
}
|
|
22417
22683
|
}
|
|
22418
22684
|
addTableClass(element, source) {
|
|
22685
|
+
source = isNullOrUndefined(source) ? '' : source;
|
|
22419
22686
|
const tableElement = element.querySelectorAll('table');
|
|
22420
22687
|
for (let i = 0; i < tableElement.length; i++) {
|
|
22421
22688
|
if (!tableElement[i].classList.contains('e-rte-table') && (source === 'html' || source === '')) {
|
|
@@ -26019,7 +26286,7 @@ class Image$1 {
|
|
|
26019
26286
|
this.checkBoxObj.createElement = this.parent.createElement;
|
|
26020
26287
|
this.checkBoxObj.appendTo(linkTarget);
|
|
26021
26288
|
let target = this.checkBoxObj.checked ? '_blank' : null;
|
|
26022
|
-
let imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('
|
|
26289
|
+
let imageLabel = this.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null;
|
|
26023
26290
|
const linkUpdate = this.i10n.getConstant('dialogUpdate');
|
|
26024
26291
|
const linkargs = {
|
|
26025
26292
|
args: e.args,
|
|
@@ -26138,14 +26405,14 @@ class Image$1 {
|
|
|
26138
26405
|
}
|
|
26139
26406
|
if (e.selectNode[0].parentElement.nodeName === 'A') {
|
|
26140
26407
|
proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
|
|
26141
|
-
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('
|
|
26408
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
26142
26409
|
subCommand: e.args.item.subCommand
|
|
26143
26410
|
});
|
|
26144
26411
|
proxy.dialogObj.hide({ returnValue: true });
|
|
26145
26412
|
return;
|
|
26146
26413
|
}
|
|
26147
26414
|
proxy.parent.formatter.process(proxy.parent, e.args, e.args, {
|
|
26148
|
-
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('
|
|
26415
|
+
url: url, target: proxy.checkBoxObj.checked ? '_blank' : null, ariaLabel: proxy.checkBoxObj.checked ? this.i10n.getConstant('imageLinkAriaLabel') : null, selectNode: e.selectNode,
|
|
26149
26416
|
subCommand: e.args.item.subCommand, selection: e.selection
|
|
26150
26417
|
});
|
|
26151
26418
|
const captionEle = closest(e.selectNode[0], '.e-img-caption');
|
|
@@ -28170,6 +28437,7 @@ class Video {
|
|
|
28170
28437
|
this.isAllowedTypes = true;
|
|
28171
28438
|
this.pageX = null;
|
|
28172
28439
|
this.pageY = null;
|
|
28440
|
+
this.mouseX = null;
|
|
28173
28441
|
this.deletedVid = [];
|
|
28174
28442
|
this.parent = parent;
|
|
28175
28443
|
this.rteID = parent.element.id;
|
|
@@ -28566,62 +28834,50 @@ class Video {
|
|
|
28566
28834
|
if (isNullOrUndefined(vidEleStyle)) {
|
|
28567
28835
|
return;
|
|
28568
28836
|
}
|
|
28569
|
-
|
|
28570
|
-
|
|
28837
|
+
/* eslint-disable */
|
|
28838
|
+
let width = vidEleStyle.width !== '' ? vidEleStyle.width.match(/^\d+(\.\d*)?%$/g) ? parseFloat(vidEleStyle.width) :
|
|
28571
28839
|
parseInt(vidEleStyle.width, 10) : vid.style.width !== '' ? vid.style.width : vid.width;
|
|
28572
|
-
|
|
28840
|
+
let height = vidEleStyle.height !== '' ? parseInt(vidEleStyle.height, 10) : vid.style.height !== '' ? vid.style.height : vid.height;
|
|
28841
|
+
width = width.toString().match(/\b\d+(\.\d*)?(%|$)\b/g) ? parseFloat(width.toString()) : parseInt(width.toString(), 10);
|
|
28842
|
+
height = height.toString().match(/\b\d+(\.\d*)?(%|$)\b/g) ? parseFloat(height.toString()) : parseInt(height.toString(), 10);
|
|
28843
|
+
/* eslint-enable */
|
|
28573
28844
|
if (width > height) {
|
|
28574
28845
|
vid.style.minWidth = this.parent.insertVideoSettings.minWidth === 0 ? '200px' : formatUnit(this.parent.insertVideoSettings.minWidth);
|
|
28575
28846
|
vid.style.minHeight = this.parent.insertVideoSettings.minHeight === 0 ? '90px' : formatUnit(this.parent.insertVideoSettings.minHeight);
|
|
28576
28847
|
if (this.parent.insertVideoSettings.resizeByPercent) {
|
|
28577
|
-
|
|
28578
|
-
const percentageValue = this.pixToPerc((parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY), (vid.previousElementSibling || vid.parentElement));
|
|
28579
|
-
vid.style.width = Math.min(Math.round((percentageValue / vid.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
|
|
28580
|
-
}
|
|
28581
|
-
else {
|
|
28582
|
-
vid.style.width = this.pixToPerc(parseInt(width.toString(), 10) / parseInt(height.toString(), 10) * expectedY, (vid.previousElementSibling || vid.parentElement)) + '%';
|
|
28583
|
-
}
|
|
28584
|
-
vid.style.height = null;
|
|
28585
|
-
vid.removeAttribute('height');
|
|
28848
|
+
this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
|
|
28586
28849
|
}
|
|
28587
28850
|
else if ((vid.style.width === '' && vid.style.height !== '') || (vidEleStyle.width === '' && vidEleStyle.height !== '')) {
|
|
28588
28851
|
vid.style.height = expectedY + 'px';
|
|
28589
28852
|
}
|
|
28590
28853
|
else if ((vid.style.width !== '' && vid.style.height === '') || (vidEleStyle.width !== '' && vidEleStyle.height === '')) {
|
|
28591
|
-
const currentWidth = ((
|
|
28592
|
-
|
|
28854
|
+
const currentWidth = ((width / height * expectedY) +
|
|
28855
|
+
width / height) <
|
|
28593
28856
|
(this.parent.inputElement.getBoundingClientRect().right - 32) ?
|
|
28594
|
-
((
|
|
28595
|
-
|
|
28857
|
+
((width / height * expectedY) +
|
|
28858
|
+
width / height) :
|
|
28596
28859
|
(this.parent.inputElement.getBoundingClientRect().right - 32);
|
|
28597
28860
|
vid.style.width = currentWidth.toString() + 'px';
|
|
28598
28861
|
}
|
|
28599
28862
|
else if (vid.style.width !== '' || vidEleStyle.width !== '') {
|
|
28600
|
-
const currentWidth = (
|
|
28863
|
+
const currentWidth = (width / height * expectedY) <
|
|
28601
28864
|
(this.parent.inputElement.getBoundingClientRect().right - 32) ?
|
|
28602
|
-
(
|
|
28865
|
+
(width / height * expectedY) :
|
|
28603
28866
|
(this.parent.inputElement.getBoundingClientRect().right - 32);
|
|
28604
28867
|
vid.style.width = currentWidth + 'px';
|
|
28605
28868
|
vid.style.height = expectedY + 'px';
|
|
28606
28869
|
}
|
|
28607
28870
|
else {
|
|
28608
|
-
vid.setAttribute('width', (parseInt(((
|
|
28871
|
+
vid.setAttribute('width', (parseInt(((width / height * expectedY) + width / height).toString(), 10)).toString());
|
|
28609
28872
|
}
|
|
28610
28873
|
}
|
|
28611
28874
|
else if (height > width) {
|
|
28612
28875
|
if (this.parent.insertVideoSettings.resizeByPercent) {
|
|
28613
|
-
|
|
28614
|
-
vid.style.width = Math.min(Math.round((parseInt(width.toString(), 10) / vid.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
|
|
28615
|
-
}
|
|
28616
|
-
else {
|
|
28617
|
-
vid.style.width = this.pixToPerc((expectedX / parseInt(height.toString(), 10) * expectedY), (vid.previousElementSibling || vid.parentElement)) + '%';
|
|
28618
|
-
}
|
|
28619
|
-
vid.style.height = null;
|
|
28620
|
-
vid.removeAttribute('height');
|
|
28876
|
+
this.updateVidEleWidth(vid, width, height, expectedX, expectedY);
|
|
28621
28877
|
}
|
|
28622
28878
|
else if (vid.style.width !== '' || vidEleStyle.width !== '') {
|
|
28623
28879
|
vid.style.width = expectedX + 'px';
|
|
28624
|
-
vid.style.height = (
|
|
28880
|
+
vid.style.height = (height / width * expectedX) + 'px';
|
|
28625
28881
|
}
|
|
28626
28882
|
else {
|
|
28627
28883
|
vid.setAttribute('width', this.resizeBtnStat.botRight ? (this.getPointX(e.event) - vid.getBoundingClientRect().left).toString() : expectedX.toString());
|
|
@@ -28639,6 +28895,23 @@ class Video {
|
|
|
28639
28895
|
}
|
|
28640
28896
|
}
|
|
28641
28897
|
}
|
|
28898
|
+
updateVidEleWidth(vid, width, height, expectedX, expectedY) {
|
|
28899
|
+
if (parseInt('' + vid.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
|
|
28900
|
+
const original = vid.offsetWidth + this.mouseX;
|
|
28901
|
+
const finalWidthByPerc = (original / vid.offsetWidth) * (parseFloat(vid.style.width).toString() === 'NaN' ? (vid.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) : parseFloat(vid.style.width));
|
|
28902
|
+
vid.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
|
|
28903
|
+
}
|
|
28904
|
+
else {
|
|
28905
|
+
if (width > height) {
|
|
28906
|
+
vid.style.width = this.pixToPerc(width / height * expectedY, (vid.previousElementSibling || vid.parentElement)) + '%';
|
|
28907
|
+
}
|
|
28908
|
+
else {
|
|
28909
|
+
vid.style.width = this.pixToPerc((expectedX / height * expectedY), (vid.previousElementSibling || vid.parentElement)) + '%';
|
|
28910
|
+
}
|
|
28911
|
+
}
|
|
28912
|
+
vid.style.height = null;
|
|
28913
|
+
vid.removeAttribute('height');
|
|
28914
|
+
}
|
|
28642
28915
|
pixToPerc(expected, parentEle) {
|
|
28643
28916
|
return expected / parseFloat(getComputedStyle(parentEle).width) * 100;
|
|
28644
28917
|
}
|
|
@@ -28679,6 +28952,7 @@ class Video {
|
|
|
28679
28952
|
const height = parseInt(this.vidDupPos.height, 10) + mouseY;
|
|
28680
28953
|
this.pageX = pageX;
|
|
28681
28954
|
this.pageY = pageY;
|
|
28955
|
+
this.mouseX = mouseX;
|
|
28682
28956
|
if (this.resizeBtnStat.botRight) {
|
|
28683
28957
|
this.vidDupMouseMove(width + 'px', height + 'px', e);
|
|
28684
28958
|
}
|
|
@@ -30502,11 +30776,11 @@ class Table {
|
|
|
30502
30776
|
colReEle.classList.add(CLS_RTE_TABLE_RESIZE, CLS_TB_COL_RES);
|
|
30503
30777
|
if (columns.length === i) {
|
|
30504
30778
|
colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
|
|
30505
|
-
'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth) + 'px;';
|
|
30779
|
+
'px; left:' + (pos.left + this.calcPos(columns[i - 1]).left + columns[i - 1].offsetWidth - 2) + 'px;';
|
|
30506
30780
|
}
|
|
30507
30781
|
else {
|
|
30508
30782
|
colReEle.style.cssText = 'height: ' + height + 'px; width: 4px; top: ' + pos.top +
|
|
30509
|
-
'px; left:' + (pos.left + this.calcPos(columns[i]).left) + 'px;';
|
|
30783
|
+
'px; left:' + (pos.left + this.calcPos(columns[i]).left - 2) + 'px;';
|
|
30510
30784
|
}
|
|
30511
30785
|
this.contentModule.getEditPanel().appendChild(colReEle);
|
|
30512
30786
|
}
|
|
@@ -30538,7 +30812,7 @@ class Table {
|
|
|
30538
30812
|
}
|
|
30539
30813
|
removeResizeElement() {
|
|
30540
30814
|
const item = this.parent.contentModule.getEditPanel().
|
|
30541
|
-
querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box
|
|
30815
|
+
querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box');
|
|
30542
30816
|
if (item.length > 0) {
|
|
30543
30817
|
for (let i = 0; i < item.length; i++) {
|
|
30544
30818
|
detach(item[i]);
|
|
@@ -30631,6 +30905,44 @@ class Table {
|
|
|
30631
30905
|
}
|
|
30632
30906
|
else {
|
|
30633
30907
|
this.currentColumnResize = 'middle';
|
|
30908
|
+
const cellColl = this.curTable.rows[0].cells;
|
|
30909
|
+
let cellCount = 0;
|
|
30910
|
+
for (let cell = 0; cell < cellColl.length; cell++) {
|
|
30911
|
+
cellCount = cellCount + cellColl[cell].colSpan;
|
|
30912
|
+
}
|
|
30913
|
+
const sizes = new Array(cellCount);
|
|
30914
|
+
const colGroupEle = createElement('colgroup');
|
|
30915
|
+
const rowSpanCells = new Map();
|
|
30916
|
+
for (let i = 0; i < this.curTable.rows.length; i++) {
|
|
30917
|
+
let currentColIndex = 0;
|
|
30918
|
+
for (let k = 0; k < this.curTable.rows[i].cells.length; k++) {
|
|
30919
|
+
for (let l = 1; l < this.curTable.rows[i].cells[k].rowSpan; l++) {
|
|
30920
|
+
const key = `${i + l}${currentColIndex}`;
|
|
30921
|
+
rowSpanCells.set(key, this.curTable.rows[i].cells[k]);
|
|
30922
|
+
}
|
|
30923
|
+
const cellIndex = this.getCellIndex(rowSpanCells, i, k);
|
|
30924
|
+
if (cellIndex > currentColIndex) {
|
|
30925
|
+
currentColIndex = cellIndex;
|
|
30926
|
+
}
|
|
30927
|
+
const width = this.curTable.rows[i].cells[k].offsetWidth;
|
|
30928
|
+
if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
|
|
30929
|
+
sizes[currentColIndex] = width;
|
|
30930
|
+
}
|
|
30931
|
+
currentColIndex += 1 + this.curTable.rows[i].cells[k].colSpan - 1;
|
|
30932
|
+
}
|
|
30933
|
+
}
|
|
30934
|
+
for (let size = 0; size < sizes.length; size++) {
|
|
30935
|
+
const cell = createElement('col');
|
|
30936
|
+
cell.appendChild(createElement('br'));
|
|
30937
|
+
cell.style.width = this.convertPixelToPercentage(sizes[size], parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
|
|
30938
|
+
colGroupEle.appendChild(cell);
|
|
30939
|
+
}
|
|
30940
|
+
this.curTable.insertBefore(colGroupEle, this.curTable.firstChild);
|
|
30941
|
+
for (let i = 0; i < this.curTable.rows.length; i++) {
|
|
30942
|
+
for (let k = 0; k < this.curTable.rows[i].cells.length; k++) {
|
|
30943
|
+
this.curTable.rows[i].cells[k].style.width = '';
|
|
30944
|
+
}
|
|
30945
|
+
}
|
|
30634
30946
|
}
|
|
30635
30947
|
this.columnEle = this.curTable.rows[this.calMaxCol(this.curTable)].cells[parseInt(target.getAttribute('data-col'), 10)];
|
|
30636
30948
|
}
|
|
@@ -30663,6 +30975,16 @@ class Table {
|
|
|
30663
30975
|
EventHandler.add(this.contentModule.getDocument(), Browser.touchEndEvent, this.resizeEnd, this);
|
|
30664
30976
|
}
|
|
30665
30977
|
}
|
|
30978
|
+
getCellIndex(rowSpanCells, rowIndex, colIndex) {
|
|
30979
|
+
const cellKey = `${rowIndex}${colIndex}`;
|
|
30980
|
+
const spannedCell = rowSpanCells.get(cellKey);
|
|
30981
|
+
if (spannedCell) {
|
|
30982
|
+
return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
|
|
30983
|
+
}
|
|
30984
|
+
else {
|
|
30985
|
+
return colIndex;
|
|
30986
|
+
}
|
|
30987
|
+
}
|
|
30666
30988
|
removeHelper(e) {
|
|
30667
30989
|
const cls = e.target.classList;
|
|
30668
30990
|
if (!(cls.contains('e-reicon')) && this.helper) {
|
|
@@ -30691,12 +31013,12 @@ class Table {
|
|
|
30691
31013
|
this.helper.classList.add('e-column-helper');
|
|
30692
31014
|
this.helper.style.cssText = 'height: ' + getComputedStyle(this.curTable).height + '; top: ' +
|
|
30693
31015
|
pos.top + 'px; left:' + ((pos.left + this.calcPos(this.columnEle).left) +
|
|
30694
|
-
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth
|
|
31016
|
+
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1) + 'px;';
|
|
30695
31017
|
}
|
|
30696
31018
|
else {
|
|
30697
31019
|
this.helper.classList.add('e-row-helper');
|
|
30698
31020
|
this.helper.style.cssText = 'width: ' + getComputedStyle(this.curTable).width + '; top: ' +
|
|
30699
|
-
(this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight) +
|
|
31021
|
+
(this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1) +
|
|
30700
31022
|
'px; left:' + (this.calcPos(this.rowEle).left + pos.left) + 'px;';
|
|
30701
31023
|
}
|
|
30702
31024
|
}
|
|
@@ -30704,11 +31026,12 @@ class Table {
|
|
|
30704
31026
|
const pos = this.calcPos(this.curTable);
|
|
30705
31027
|
if (this.resizeBtnStat.column) {
|
|
30706
31028
|
const left = (pos.left + this.calcPos(this.columnEle).left) +
|
|
30707
|
-
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth
|
|
31029
|
+
(this.currentColumnResize === 'last' ? this.columnEle.offsetWidth : 0) - 1;
|
|
30708
31030
|
this.helper.style.left = left + 'px';
|
|
31031
|
+
this.helper.style.height = this.curTable.offsetHeight + 'px';
|
|
30709
31032
|
}
|
|
30710
31033
|
else {
|
|
30711
|
-
const top = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight;
|
|
31034
|
+
const top = this.calcPos(this.rowEle).top + pos.top + this.rowEle.offsetHeight - 1;
|
|
30712
31035
|
this.helper.style.top = top + 'px';
|
|
30713
31036
|
}
|
|
30714
31037
|
}
|
|
@@ -30733,10 +31056,6 @@ class Table {
|
|
|
30733
31056
|
let maxiumWidth;
|
|
30734
31057
|
const currentTdElement = this.curTable.closest('td');
|
|
30735
31058
|
const args = { event: e, requestType: 'table' };
|
|
30736
|
-
let isRowCellsMerged = false;
|
|
30737
|
-
let isColCellsMerged = false;
|
|
30738
|
-
let mergedCellIndex;
|
|
30739
|
-
let mergedElement;
|
|
30740
31059
|
this.parent.trigger(onResize, args, (resizingArgs) => {
|
|
30741
31060
|
if (resizingArgs.cancel) {
|
|
30742
31061
|
this.cancelResizeAction();
|
|
@@ -30761,7 +31080,7 @@ class Table {
|
|
|
30761
31080
|
widthCompare = rteWidth;
|
|
30762
31081
|
}
|
|
30763
31082
|
if (this.resizeBtnStat.column) {
|
|
30764
|
-
const
|
|
31083
|
+
const colGroup = this.curTable.querySelectorAll('colgroup > col');
|
|
30765
31084
|
const cellRow = this.curTable.rows[0].cells[0].nodeName === 'TH' ? 1 : 0;
|
|
30766
31085
|
let currentTableWidth;
|
|
30767
31086
|
if (this.curTable.style.width !== '' && this.curTable.style.width.includes('%')) {
|
|
@@ -30814,98 +31133,36 @@ class Table {
|
|
|
30814
31133
|
}
|
|
30815
31134
|
}
|
|
30816
31135
|
else {
|
|
30817
|
-
const
|
|
30818
|
-
|
|
30819
|
-
const totalwid =
|
|
30820
|
-
|
|
30821
|
-
|
|
30822
|
-
const
|
|
30823
|
-
|
|
30824
|
-
|
|
30825
|
-
const rightColWidth = actualwid;
|
|
30826
|
-
let index;
|
|
30827
|
-
let isMergedEleResize = false;
|
|
30828
|
-
let leftTableCell;
|
|
30829
|
-
let rightTableCell;
|
|
30830
|
-
isColCellsMerged = false;
|
|
30831
|
-
isRowCellsMerged = false;
|
|
30832
|
-
/* eslint-disable */
|
|
30833
|
-
for (let j = 0; j < currentRow.cells.length; j++) {
|
|
30834
|
-
if (currentRow.cells[j].hasAttribute('rowspan') && j <= this.colIndex) {
|
|
30835
|
-
isRowCellsMerged = true;
|
|
30836
|
-
mergedCellIndex = i;
|
|
30837
|
-
mergedElement = currentRow.cells[j];
|
|
30838
|
-
}
|
|
30839
|
-
else if (currentRow.cells[j].hasAttribute('colspan') && j <= currentRow.cells.length) {
|
|
30840
|
-
isColCellsMerged = true;
|
|
30841
|
-
mergedCellIndex = i;
|
|
30842
|
-
mergedElement = currentRow.cells[j];
|
|
30843
|
-
}
|
|
30844
|
-
}
|
|
30845
|
-
if (!isNullOrUndefined(currentRow.cells[i]) && currentRow.cells[i].hasAttribute('colspan')) {
|
|
30846
|
-
index = parseInt(currentRow.cells[i].getAttribute('colspan'), 10) - 1;
|
|
30847
|
-
}
|
|
30848
|
-
else {
|
|
30849
|
-
index = this.colIndex;
|
|
30850
|
-
}
|
|
30851
|
-
if (isRowCellsMerged || isColCellsMerged) {
|
|
30852
|
-
let currentResizeRow;
|
|
30853
|
-
if (currentRow.cells.length < cellColl.length) {
|
|
30854
|
-
index = currentRow.cells.length === this.colIndex || currentRow === this.curTable.rows[this.curTable.rows.length - 1] ?
|
|
30855
|
-
this.colIndex - 1 : this.colIndex;
|
|
30856
|
-
currentResizeRow = this.curTable.rows[!isNullOrUndefined(mergedCellIndex) ?
|
|
30857
|
-
mergedCellIndex : this.colIndex - 1];
|
|
30858
|
-
if (currentResizeRow && currentResizeRow !== currentRow && (currentResizeRow.cells[this.colIndex - 1] === mergedElement ||
|
|
30859
|
-
currentResizeRow.cells[currentResizeRow.cells.length - 1] === mergedElement)) {
|
|
30860
|
-
isMergedEleResize = true;
|
|
30861
|
-
}
|
|
30862
|
-
else {
|
|
30863
|
-
isMergedEleResize = false;
|
|
30864
|
-
}
|
|
30865
|
-
}
|
|
30866
|
-
else {
|
|
30867
|
-
index = this.colIndex;
|
|
30868
|
-
}
|
|
30869
|
-
leftTableCell = !isMergedEleResize ? currentRow.cells[index - 1] : (currentResizeRow &&
|
|
30870
|
-
currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement) ?
|
|
30871
|
-
currentResizeRow.cells[this.colIndex - 1] : currentRow.cells[currentRow.cells.length - 1];
|
|
30872
|
-
rightTableCell = !isMergedEleResize ? currentRow.cells[index] : rightTableCell && rightTableCell.hasAttribute('rowspan') ?
|
|
30873
|
-
currentResizeRow.cells[this.colIndex] : currentResizeRow && currentResizeRow.cells[currentResizeRow.cells.length - 1] !== mergedElement ?
|
|
30874
|
-
currentRow.cells[index - 1] : currentResizeRow.cells[currentResizeRow.cells.length - 1];
|
|
30875
|
-
}
|
|
30876
|
-
if (!isNullOrUndefined(currentRow.cells[index - 1]) && !isRowCellsMerged && !isColCellsMerged) {
|
|
30877
|
-
currentRow.cells[index - 1].style.width =
|
|
30878
|
-
this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
30879
|
-
}
|
|
30880
|
-
else {
|
|
30881
|
-
if (leftTableCell) {
|
|
30882
|
-
leftTableCell.style.width =
|
|
30883
|
-
this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
30884
|
-
}
|
|
30885
|
-
}
|
|
30886
|
-
if (!isNullOrUndefined(currentRow.cells[index]) && !isRowCellsMerged && !isColCellsMerged) {
|
|
30887
|
-
currentRow.cells[index].style.width =
|
|
30888
|
-
this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
30889
|
-
}
|
|
30890
|
-
else {
|
|
30891
|
-
if (rightTableCell) {
|
|
30892
|
-
rightTableCell.style.width =
|
|
30893
|
-
this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
30894
|
-
}
|
|
30895
|
-
}
|
|
30896
|
-
/* eslint-enable */
|
|
30897
|
-
}
|
|
31136
|
+
const actualwid = colGroup[this.colIndex].offsetWidth - mouseX;
|
|
31137
|
+
// eslint-disable-next-line
|
|
31138
|
+
const totalwid = colGroup[this.colIndex].offsetWidth + colGroup[this.colIndex - 1].offsetWidth;
|
|
31139
|
+
if ((totalwid - actualwid) > 20 && actualwid > 20) {
|
|
31140
|
+
const leftColumnWidth = totalwid - actualwid;
|
|
31141
|
+
const rightColWidth = actualwid;
|
|
31142
|
+
colGroup[this.colIndex - 1].style.width = this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
|
|
31143
|
+
colGroup[this.colIndex].style.width = this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
|
|
30898
31144
|
}
|
|
30899
31145
|
}
|
|
30900
31146
|
this.updateHelper();
|
|
30901
31147
|
}
|
|
30902
31148
|
else if (this.resizeBtnStat.row) {
|
|
30903
31149
|
this.parent.preventDefaultResize(e);
|
|
30904
|
-
const
|
|
30905
|
-
|
|
30906
|
-
|
|
31150
|
+
const tableTrElementPixel = [];
|
|
31151
|
+
const currentTableTrElement = this.curTable.querySelectorAll('tr');
|
|
31152
|
+
for (let i = 0; i < currentTableTrElement.length; i++) {
|
|
31153
|
+
if (this.rowEle !== currentTableTrElement[i]) {
|
|
31154
|
+
tableTrElementPixel[i] = (parseFloat(currentTableTrElement[i].clientHeight.toString()));
|
|
31155
|
+
}
|
|
31156
|
+
}
|
|
31157
|
+
this.curTable.style.height = (parseFloat(this.curTable.clientHeight.toString()) + mouseY) + 'px';
|
|
31158
|
+
for (let i = 0; i < currentTableTrElement.length; i++) {
|
|
31159
|
+
if (this.rowEle === currentTableTrElement[i]) {
|
|
31160
|
+
currentTableTrElement[i].style.height = (parseFloat(currentTableTrElement[i].clientHeight.toString()) + mouseY) + 'px';
|
|
31161
|
+
}
|
|
31162
|
+
else {
|
|
31163
|
+
currentTableTrElement[i].style.height = tableTrElementPixel[i] + 'px';
|
|
31164
|
+
}
|
|
30907
31165
|
}
|
|
30908
|
-
this.curTable.style.height = '';
|
|
30909
31166
|
if (!isNullOrUndefined(tableReBox)) {
|
|
30910
31167
|
tableReBox.style.cssText = 'top: ' + (this.calcPos(this.curTable).top + tableHeight - 4) +
|
|
30911
31168
|
'px; left:' + (this.calcPos(this.curTable).left + tableWidth - 4) + 'px;';
|
|
@@ -30968,9 +31225,34 @@ class Table {
|
|
|
30968
31225
|
detach(this.helper);
|
|
30969
31226
|
this.helper = null;
|
|
30970
31227
|
}
|
|
31228
|
+
const colHelper = this.parent.element.querySelectorAll('.e-table-rhelper.e-column-helper');
|
|
31229
|
+
Array.from(colHelper).forEach((element) => {
|
|
31230
|
+
if (element.parentNode) {
|
|
31231
|
+
element.parentNode.removeChild(element);
|
|
31232
|
+
}
|
|
31233
|
+
});
|
|
31234
|
+
for (let i = 0; i < this.curTable.rows.length; i++) {
|
|
31235
|
+
for (let k = 0; k < this.curTable.rows[i].cells.length; k++) {
|
|
31236
|
+
const width = this.convertPixelToPercentage(this.curTable.rows[i].cells[k].offsetWidth, parseInt(getComputedStyle(this.curTable).width, 10)) + '%';
|
|
31237
|
+
this.curTable.rows[i].cells[k].style.width = width;
|
|
31238
|
+
}
|
|
31239
|
+
}
|
|
31240
|
+
const colGroup = this.curTable.querySelector('colgroup');
|
|
31241
|
+
if (colGroup) {
|
|
31242
|
+
this.curTable.removeChild(colGroup);
|
|
31243
|
+
}
|
|
30971
31244
|
this.pageX = null;
|
|
30972
31245
|
this.pageY = null;
|
|
30973
31246
|
this.moveEle = null;
|
|
31247
|
+
const currentTableTrElement = this.curTable.querySelectorAll("tr");
|
|
31248
|
+
const tableTrPercentage = [];
|
|
31249
|
+
for (let i = 0; i < currentTableTrElement.length; i++) {
|
|
31250
|
+
const percentage = (parseFloat(currentTableTrElement[i].clientHeight.toString()) / parseFloat(this.curTable.clientHeight.toString())) * 100;
|
|
31251
|
+
tableTrPercentage[i] = percentage;
|
|
31252
|
+
}
|
|
31253
|
+
for (let i = 0; i < currentTableTrElement.length; i++) {
|
|
31254
|
+
currentTableTrElement[i].style.height = tableTrPercentage[i] + '%';
|
|
31255
|
+
}
|
|
30974
31256
|
const args = { event: e, requestType: 'table' };
|
|
30975
31257
|
this.parent.trigger(resizeStop, args);
|
|
30976
31258
|
this.parent.formatter.saveData();
|
|
@@ -32663,10 +32945,10 @@ class EnterKeyAction {
|
|
|
32663
32945
|
}
|
|
32664
32946
|
const previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
|
|
32665
32947
|
const nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
|
|
32666
|
-
if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style')) {
|
|
32948
|
+
if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style') && previousBlockNode.nodeName !== 'TABLE') {
|
|
32667
32949
|
insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
|
|
32668
32950
|
}
|
|
32669
|
-
if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style')) {
|
|
32951
|
+
if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style') && nextBlockNode.nodeName !== 'TABLE') {
|
|
32670
32952
|
insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
|
|
32671
32953
|
}
|
|
32672
32954
|
return insertElem;
|
|
@@ -33421,6 +33703,16 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
33421
33703
|
keyUp(e) {
|
|
33422
33704
|
if (this.editorMode === 'HTML') {
|
|
33423
33705
|
const range = this.getRange();
|
|
33706
|
+
if (!isNullOrUndefined(e) && !isNullOrUndefined(e.code) && (e.code === 'Backspace' || e.code === 'Delete')) {
|
|
33707
|
+
// To prevent the reformatting the content removed browser behavior.
|
|
33708
|
+
const currentRange = this.getRange();
|
|
33709
|
+
const selection = this.iframeSettings.enable ? this.contentModule.getPanel().ownerDocument.getSelection() :
|
|
33710
|
+
this.contentModule.getDocument().getSelection();
|
|
33711
|
+
if (selection.rangeCount > 0) {
|
|
33712
|
+
selection.removeAllRanges();
|
|
33713
|
+
selection.addRange(currentRange);
|
|
33714
|
+
}
|
|
33715
|
+
}
|
|
33424
33716
|
if (Browser.userAgent.indexOf('Firefox') !== -1 && range.startContainer.nodeName === '#text' &&
|
|
33425
33717
|
range.startContainer.parentElement === this.inputElement && this.enterKey !== 'BR') {
|
|
33426
33718
|
const range = this.getRange();
|
|
@@ -34020,7 +34312,7 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
34020
34312
|
if (this.valueContainer) {
|
|
34021
34313
|
this.valueContainer.value = (this.enableHtmlEncode) ? this.value : value;
|
|
34022
34314
|
}
|
|
34023
|
-
if (this.editorMode === 'HTML' && this.inputElement && this.inputElement.innerHTML.
|
|
34315
|
+
if (this.editorMode === 'HTML' && this.inputElement && this.inputElement.innerHTML.trim() !== value.trim()) {
|
|
34024
34316
|
this.inputElement.innerHTML = value;
|
|
34025
34317
|
}
|
|
34026
34318
|
else if (this.editorMode === 'Markdown' && this.inputElement
|
|
@@ -34041,9 +34333,6 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
34041
34333
|
}
|
|
34042
34334
|
else {
|
|
34043
34335
|
this.inputElement.innerHTML = '<p><br/></p>';
|
|
34044
|
-
if (value === '' && this.formatter && this.inputElement) {
|
|
34045
|
-
this.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), this.inputElement.firstElementChild, this.inputElement.firstElementChild.childElementCount);
|
|
34046
|
-
}
|
|
34047
34336
|
}
|
|
34048
34337
|
}
|
|
34049
34338
|
else {
|
|
@@ -34291,10 +34580,10 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
34291
34580
|
if (this.iframeSettings.resources) {
|
|
34292
34581
|
const styleSrc = this.iframeSettings.resources.styles;
|
|
34293
34582
|
const scriptSrc = this.iframeSettings.resources.scripts;
|
|
34294
|
-
if (this.iframeSettings.resources.scripts.length > 0) {
|
|
34583
|
+
if (!isNullOrUndefined(this.iframeSettings.resources.scripts) && this.iframeSettings.resources.scripts.length > 0) {
|
|
34295
34584
|
this.InjectSheet(true, scriptSrc);
|
|
34296
34585
|
}
|
|
34297
|
-
if (this.iframeSettings.resources.styles.length > 0) {
|
|
34586
|
+
if (!isNullOrUndefined(this.iframeSettings.resources.styles) && this.iframeSettings.resources.styles.length > 0) {
|
|
34298
34587
|
this.InjectSheet(false, styleSrc);
|
|
34299
34588
|
}
|
|
34300
34589
|
}
|
|
@@ -35201,6 +35490,9 @@ let RichTextEditor = class RichTextEditor extends Component {
|
|
|
35201
35490
|
if (item[j].classList.length === 0) {
|
|
35202
35491
|
item[j].removeAttribute('class');
|
|
35203
35492
|
}
|
|
35493
|
+
if (item[j].nodeName === 'IMG' && item[j].style.outline !== '') {
|
|
35494
|
+
item[j].style.outline = '';
|
|
35495
|
+
}
|
|
35204
35496
|
}
|
|
35205
35497
|
}
|
|
35206
35498
|
}
|