@syncfusion/ej2-richtexteditor 24.1.41 → 24.1.43-569781
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/.eslintrc.json +259 -259
- package/CHANGELOG.md +1927 -1775
- package/README.md +76 -76
- package/dist/ej2-richtexteditor.umd.min.js +1 -10
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +2601 -1077
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +2706 -1181
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/helpers/e2e/index.js +3 -3
- package/helpers/e2e/rte-helper.js +13 -13
- package/license +9 -9
- package/package.json +74 -74
- package/src/common/config.d.ts +7 -0
- package/src/common/config.js +11 -0
- package/src/common/constant.d.ts +6 -0
- package/src/common/constant.js +6 -0
- package/src/common/interface.d.ts +19 -7
- package/src/common/types.d.ts +6 -0
- package/src/common/util.d.ts +6 -0
- package/src/common/util.js +61 -20
- package/src/editor-manager/base/classes.d.ts +1 -1
- package/src/editor-manager/base/classes.js +1 -1
- package/src/editor-manager/base/constant.d.ts +6 -0
- package/src/editor-manager/base/constant.js +6 -0
- package/src/editor-manager/base/editor-manager.d.ts +8 -3
- package/src/editor-manager/base/editor-manager.js +62 -3
- package/src/editor-manager/base/enum.d.ts +2 -2
- package/src/editor-manager/base/interface.d.ts +17 -9
- package/src/editor-manager/base/types.d.ts +1 -1
- package/src/editor-manager/plugin/alignments.d.ts +2 -2
- package/src/editor-manager/plugin/alignments.js +2 -2
- package/src/editor-manager/plugin/audio.d.ts +3 -3
- package/src/editor-manager/plugin/audio.js +3 -3
- package/src/editor-manager/plugin/clearformat-exec.d.ts +2 -2
- package/src/editor-manager/plugin/clearformat-exec.js +2 -2
- package/src/editor-manager/plugin/clearformat.d.ts +1 -1
- package/src/editor-manager/plugin/clearformat.js +1 -1
- package/src/editor-manager/plugin/dom-node.d.ts +39 -35
- package/src/editor-manager/plugin/dom-node.js +203 -49
- package/src/editor-manager/plugin/format-painter-actions.d.ts +2 -1
- package/src/editor-manager/plugin/format-painter-actions.js +20 -2
- package/src/editor-manager/plugin/formats.d.ts +3 -2
- package/src/editor-manager/plugin/formats.js +40 -5
- package/src/editor-manager/plugin/image.d.ts +3 -3
- package/src/editor-manager/plugin/image.js +15 -19
- package/src/editor-manager/plugin/indents.d.ts +2 -2
- package/src/editor-manager/plugin/indents.js +2 -2
- package/src/editor-manager/plugin/insert-methods.d.ts +4 -4
- package/src/editor-manager/plugin/insert-methods.js +4 -4
- package/src/editor-manager/plugin/insert-text.d.ts +2 -2
- package/src/editor-manager/plugin/insert-text.js +2 -2
- package/src/editor-manager/plugin/inserthtml-exec.d.ts +2 -2
- package/src/editor-manager/plugin/inserthtml-exec.js +2 -2
- package/src/editor-manager/plugin/inserthtml.d.ts +3 -2
- package/src/editor-manager/plugin/inserthtml.js +64 -7
- package/src/editor-manager/plugin/isformatted.d.ts +8 -8
- package/src/editor-manager/plugin/isformatted.js +8 -8
- package/src/editor-manager/plugin/link.d.ts +2 -2
- package/src/editor-manager/plugin/link.js +6 -3
- package/src/editor-manager/plugin/lists.d.ts +2 -2
- package/src/editor-manager/plugin/lists.js +123 -67
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +4 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +213 -86
- package/src/editor-manager/plugin/nodecutter.d.ts +6 -6
- package/src/editor-manager/plugin/nodecutter.js +8 -8
- package/src/editor-manager/plugin/selection-commands.d.ts +2 -1
- package/src/editor-manager/plugin/selection-commands.js +127 -4
- package/src/editor-manager/plugin/selection-exec.d.ts +2 -2
- package/src/editor-manager/plugin/selection-exec.js +2 -2
- package/src/editor-manager/plugin/table.d.ts +2 -3
- package/src/editor-manager/plugin/table.js +35 -32
- package/src/editor-manager/plugin/toolbar-status.d.ts +4 -4
- package/src/editor-manager/plugin/toolbar-status.js +22 -12
- package/src/editor-manager/plugin/undo.d.ts +7 -6
- package/src/editor-manager/plugin/undo.js +27 -7
- package/src/editor-manager/plugin/video.d.ts +3 -3
- package/src/editor-manager/plugin/video.js +3 -3
- package/src/markdown-parser/base/interface.d.ts +10 -10
- package/src/markdown-parser/base/markdown-parser.d.ts +3 -3
- package/src/markdown-parser/base/markdown-parser.js +3 -3
- package/src/markdown-parser/base/types.d.ts +1 -1
- package/src/markdown-parser/plugin/clearformat.d.ts +2 -2
- package/src/markdown-parser/plugin/clearformat.js +2 -2
- package/src/markdown-parser/plugin/formats.d.ts +2 -2
- package/src/markdown-parser/plugin/formats.js +2 -2
- package/src/markdown-parser/plugin/insert-text.d.ts +2 -2
- package/src/markdown-parser/plugin/insert-text.js +2 -2
- package/src/markdown-parser/plugin/link.d.ts +2 -2
- package/src/markdown-parser/plugin/link.js +2 -2
- package/src/markdown-parser/plugin/markdown-selection.d.ts +14 -14
- package/src/markdown-parser/plugin/markdown-selection.js +14 -14
- package/src/markdown-parser/plugin/md-selection-formats.d.ts +1 -1
- package/src/markdown-parser/plugin/md-selection-formats.js +1 -1
- package/src/markdown-parser/plugin/table.d.ts +3 -3
- package/src/markdown-parser/plugin/table.js +3 -3
- package/src/markdown-parser/plugin/undo.d.ts +6 -6
- package/src/markdown-parser/plugin/undo.js +6 -6
- package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +12 -12
- package/src/rich-text-editor/actions/base-quick-toolbar.js +57 -20
- package/src/rich-text-editor/actions/base-toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/base-toolbar.js +35 -37
- package/src/rich-text-editor/actions/color-picker.d.ts +3 -2
- package/src/rich-text-editor/actions/color-picker.js +12 -2
- package/src/rich-text-editor/actions/count.d.ts +3 -3
- package/src/rich-text-editor/actions/count.js +4 -4
- package/src/rich-text-editor/actions/dropdown-buttons.d.ts +2 -2
- package/src/rich-text-editor/actions/dropdown-buttons.js +23 -4
- package/src/rich-text-editor/actions/emoji-picker.d.ts +1 -1
- package/src/rich-text-editor/actions/emoji-picker.js +4 -4
- package/src/rich-text-editor/actions/enter-key.js +4 -3
- package/src/rich-text-editor/actions/full-screen.d.ts +3 -3
- package/src/rich-text-editor/actions/full-screen.js +6 -5
- package/src/rich-text-editor/actions/html-editor.d.ts +5 -5
- package/src/rich-text-editor/actions/html-editor.js +129 -45
- package/src/rich-text-editor/actions/keyboard-model.d.ts +16 -16
- package/src/rich-text-editor/actions/keyboard.d.ts +1 -1
- package/src/rich-text-editor/actions/keyboard.js +23 -21
- package/src/rich-text-editor/actions/markdown-editor.d.ts +2 -2
- package/src/rich-text-editor/actions/markdown-editor.js +5 -3
- package/src/rich-text-editor/actions/paste-clean-up.d.ts +4 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +87 -12
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +16 -9
- package/src/rich-text-editor/actions/quick-toolbar.js +33 -18
- package/src/rich-text-editor/actions/resize.js +2 -1
- package/src/rich-text-editor/actions/toolbar-action.js +1 -1
- package/src/rich-text-editor/actions/toolbar.d.ts +15 -16
- package/src/rich-text-editor/actions/toolbar.js +31 -100
- package/src/rich-text-editor/actions/xhtml-validation.d.ts +1 -1
- package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
- package/src/rich-text-editor/base/classes.d.ts +121 -126
- package/src/rich-text-editor/base/classes.js +121 -126
- package/src/rich-text-editor/base/constant.d.ts +190 -150
- package/src/rich-text-editor/base/constant.js +359 -150
- package/src/rich-text-editor/base/enum.d.ts +1 -1
- package/src/rich-text-editor/base/enum.js +1 -1
- package/src/rich-text-editor/base/interface.d.ts +87 -53
- package/src/rich-text-editor/base/interface.js +1 -1
- package/src/rich-text-editor/base/rich-text-editor-model.d.ts +891 -891
- package/src/rich-text-editor/base/rich-text-editor.d.ts +68 -65
- package/src/rich-text-editor/base/rich-text-editor.js +232 -199
- package/src/rich-text-editor/base/util.d.ts +5 -1
- package/src/rich-text-editor/base/util.js +47 -4
- package/src/rich-text-editor/formatter/formatter.d.ts +8 -8
- package/src/rich-text-editor/formatter/formatter.js +23 -12
- package/src/rich-text-editor/formatter/html-formatter.d.ts +2 -2
- package/src/rich-text-editor/formatter/html-formatter.js +15 -15
- package/src/rich-text-editor/formatter/markdown-formatter.d.ts +2 -2
- package/src/rich-text-editor/formatter/markdown-formatter.js +15 -15
- package/src/rich-text-editor/models/default-locale.js +30 -26
- package/src/rich-text-editor/models/iframe-settings-model.d.ts +26 -26
- package/src/rich-text-editor/models/iframe-settings.js +19 -19
- package/src/rich-text-editor/models/inline-mode-model.d.ts +11 -11
- package/src/rich-text-editor/models/inline-mode.js +19 -19
- package/src/rich-text-editor/models/items.js +2 -2
- package/src/rich-text-editor/models/toolbar-settings-model.d.ts +760 -760
- package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
- package/src/rich-text-editor/models/toolbar-settings.js +20 -20
- package/src/rich-text-editor/renderer/audio-module.d.ts +2 -1
- package/src/rich-text-editor/renderer/audio-module.js +14 -1
- package/src/rich-text-editor/renderer/content-renderer.d.ts +6 -6
- package/src/rich-text-editor/renderer/content-renderer.js +6 -6
- package/src/rich-text-editor/renderer/dialog-renderer.d.ts +4 -2
- package/src/rich-text-editor/renderer/dialog-renderer.js +14 -3
- package/src/rich-text-editor/renderer/iframe-content-renderer.d.ts +4 -4
- package/src/rich-text-editor/renderer/iframe-content-renderer.js +19 -18
- package/src/rich-text-editor/renderer/image-module.d.ts +10 -2
- package/src/rich-text-editor/renderer/image-module.js +200 -168
- package/src/rich-text-editor/renderer/link-module.d.ts +1 -1
- package/src/rich-text-editor/renderer/link-module.js +11 -2
- package/src/rich-text-editor/renderer/markdown-renderer.d.ts +6 -6
- package/src/rich-text-editor/renderer/markdown-renderer.js +6 -6
- package/src/rich-text-editor/renderer/popup-renderer.d.ts +5 -5
- package/src/rich-text-editor/renderer/popup-renderer.js +5 -5
- package/src/rich-text-editor/renderer/render.d.ts +2 -2
- package/src/rich-text-editor/renderer/render.js +2 -2
- package/src/rich-text-editor/renderer/table-module.d.ts +9 -2
- package/src/rich-text-editor/renderer/table-module.js +289 -137
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +13 -9
- package/src/rich-text-editor/renderer/toolbar-renderer.js +103 -24
- package/src/rich-text-editor/renderer/video-module.d.ts +4 -1
- package/src/rich-text-editor/renderer/video-module.js +62 -35
- package/src/rich-text-editor/renderer/view-source.d.ts +7 -6
- package/src/rich-text-editor/renderer/view-source.js +18 -10
- package/src/rich-text-editor/services/renderer-factory.d.ts +3 -3
- package/src/rich-text-editor/services/renderer-factory.js +3 -3
- package/src/rich-text-editor/services/service-locator.d.ts +3 -3
- package/src/rich-text-editor/services/service-locator.js +3 -3
- package/src/selection/selection.d.ts +22 -22
- package/src/selection/selection.js +25 -22
- package/styles/_all.scss +1 -1
- package/styles/bootstrap-dark.css +153 -49
- package/styles/bootstrap.css +158 -57
- package/styles/bootstrap4.css +145 -45
- package/styles/bootstrap5-dark.css +150 -45
- package/styles/bootstrap5.css +150 -45
- package/styles/fabric-dark.css +139 -39
- package/styles/fabric.css +140 -40
- package/styles/fluent-dark.css +147 -41
- package/styles/fluent.css +147 -41
- package/styles/highcontrast-light.css +139 -39
- package/styles/highcontrast.css +143 -40
- package/styles/material-dark.css +143 -39
- package/styles/material.css +143 -39
- package/styles/material3-dark.css +155 -49
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +155 -49
- package/styles/material3.scss +1 -1
- package/styles/rich-text-editor/_all.scss +2 -2
- package/styles/rich-text-editor/_bds-definition.scss +279 -0
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +281 -277
- package/styles/rich-text-editor/_bootstrap-definition.scss +337 -334
- package/styles/rich-text-editor/_bootstrap4-definition.scss +464 -460
- package/styles/rich-text-editor/_bootstrap5-definition.scss +266 -262
- package/styles/rich-text-editor/_fabric-dark-definition.scss +263 -259
- package/styles/rich-text-editor/_fabric-definition.scss +261 -257
- package/styles/rich-text-editor/_fluent-definition.scss +267 -263
- package/styles/rich-text-editor/_fusionnew-definition.scss +265 -261
- package/styles/rich-text-editor/_highcontrast-definition.scss +261 -257
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +261 -257
- package/styles/rich-text-editor/_layout.scss +2249 -2147
- package/styles/rich-text-editor/_material-dark-definition.scss +266 -262
- package/styles/rich-text-editor/_material-definition.scss +264 -260
- package/styles/rich-text-editor/_material3-definition.scss +266 -262
- package/styles/rich-text-editor/_tailwind-definition.scss +261 -257
- package/styles/rich-text-editor/_theme.scss +906 -837
- package/styles/rich-text-editor/bootstrap-dark.css +153 -49
- package/styles/rich-text-editor/bootstrap.css +158 -57
- package/styles/rich-text-editor/bootstrap4.css +145 -45
- package/styles/rich-text-editor/bootstrap5-dark.css +150 -45
- package/styles/rich-text-editor/bootstrap5.css +150 -45
- package/styles/rich-text-editor/fabric-dark.css +139 -39
- package/styles/rich-text-editor/fabric.css +140 -40
- package/styles/rich-text-editor/fluent-dark.css +147 -41
- package/styles/rich-text-editor/fluent.css +147 -41
- package/styles/rich-text-editor/highcontrast-light.css +139 -39
- package/styles/rich-text-editor/highcontrast.css +143 -40
- package/styles/rich-text-editor/icons/_bds.scss +348 -0
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap4.scss +349 -349
- package/styles/rich-text-editor/icons/_bootstrap5.scss +348 -348
- package/styles/rich-text-editor/icons/_fabric-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_fabric.scss +349 -349
- package/styles/rich-text-editor/icons/_fluent.scss +348 -348
- package/styles/rich-text-editor/icons/_fusionnew.scss +348 -348
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +349 -349
- package/styles/rich-text-editor/icons/_highcontrast.scss +349 -349
- package/styles/rich-text-editor/icons/_material-dark.scss +349 -349
- package/styles/rich-text-editor/icons/_material.scss +349 -349
- package/styles/rich-text-editor/icons/_material3.scss +348 -348
- package/styles/rich-text-editor/icons/_tailwind.scss +348 -348
- package/styles/rich-text-editor/material-dark.css +143 -39
- package/styles/rich-text-editor/material.css +143 -39
- package/styles/rich-text-editor/material3-dark.css +155 -49
- package/styles/rich-text-editor/material3-dark.scss +1 -1
- package/styles/rich-text-editor/material3.css +155 -49
- package/styles/rich-text-editor/material3.scss +1 -1
- package/styles/rich-text-editor/tailwind-dark.css +194 -66
- package/styles/rich-text-editor/tailwind.css +194 -66
- package/styles/tailwind-dark.css +194 -66
- package/styles/tailwind.css +194 -66
- package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
- package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
- package/dist/ej2-richtexteditor.min.js +0 -10
- package/dist/global/ej2-richtexteditor.min.js +0 -11
- package/dist/global/ej2-richtexteditor.min.js.map +0 -1
- package/dist/global/index.d.ts +0 -14
- package/tslint.json +0 -111
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as EVENTS from '../../common/constant';
|
|
2
|
-
import { createElement, isNullOrUndefined as isNOU, detach } from '@syncfusion/ej2-base';
|
|
2
|
+
import { createElement, isNullOrUndefined as isNOU, detach, addClass, Browser } from '@syncfusion/ej2-base';
|
|
3
|
+
import { PASTE_SOURCE } from '../base/constant';
|
|
3
4
|
/**
|
|
4
5
|
* PasteCleanup for MsWord content
|
|
5
6
|
*
|
|
6
7
|
* @hidden
|
|
7
|
-
|
|
8
|
+
* @deprecated
|
|
8
9
|
*/
|
|
9
10
|
var MsWordPaste = /** @class */ (function () {
|
|
10
11
|
function MsWordPaste(parent) {
|
|
@@ -43,7 +44,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
43
44
|
'x', 'xi', 'xii', 'xiii', 'xiv', 'xv', 'xvi', 'xvii', 'xviii', 'xix', 'xx'];
|
|
44
45
|
this.lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
|
|
45
46
|
'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
|
|
46
|
-
this.removableElements = ['o:p', 'style'];
|
|
47
|
+
this.removableElements = ['o:p', 'style', 'w:sdt'];
|
|
47
48
|
this.listContents = [];
|
|
48
49
|
this.cropImageDimensions = [];
|
|
49
50
|
this.parent = parent;
|
|
@@ -60,13 +61,14 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
60
61
|
var elm = createElement('p');
|
|
61
62
|
elm.setAttribute('id', 'MSWord-Content');
|
|
62
63
|
elm.innerHTML = tempHTMLContent;
|
|
64
|
+
this.addDoubleBr(elm);
|
|
63
65
|
var patern = /class='?Mso|style='[^ ]*\bmso-/i;
|
|
64
66
|
var patern2 = /class="?Mso|style="[^ ]*\bmso-/i;
|
|
65
67
|
var patern3 = /(class="?Mso|class='?Mso|class="?Xl|class='?Xl|class=Xl|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument)/gi;
|
|
66
68
|
var pattern4 = /style='mso-width-source:/i;
|
|
67
69
|
if (patern.test(tempHTMLContent) || patern2.test(tempHTMLContent) || patern3.test(tempHTMLContent) ||
|
|
68
70
|
pattern4.test(tempHTMLContent)) {
|
|
69
|
-
this.
|
|
71
|
+
var source = this.findSource(elm);
|
|
70
72
|
tempHTMLContent = tempHTMLContent.replace(/<img[^>]+>/i, '');
|
|
71
73
|
this.addListClass(elm);
|
|
72
74
|
listNodes = this.cleanUp(elm, listNodes);
|
|
@@ -74,6 +76,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
74
76
|
listNodes[0].parentElement.tagName !== 'OL') {
|
|
75
77
|
this.listConverter(listNodes);
|
|
76
78
|
}
|
|
79
|
+
this.imageConversion(elm, rtfData);
|
|
77
80
|
this.cleanList(elm, 'UL');
|
|
78
81
|
this.cleanList(elm, 'OL');
|
|
79
82
|
this.styleCorrection(elm, wordPasteStyleConfig);
|
|
@@ -82,25 +85,37 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
82
85
|
this.removeEmptyElements(elm);
|
|
83
86
|
this.removeEmptyAnchorTag(elm);
|
|
84
87
|
this.breakLineAddition(elm);
|
|
88
|
+
this.processMargin(elm);
|
|
85
89
|
this.removeClassName(elm);
|
|
86
90
|
if (pattern4.test(tempHTMLContent)) {
|
|
87
91
|
this.addTableBorderClass(elm);
|
|
88
92
|
}
|
|
89
|
-
|
|
90
|
-
var liChildren = elm.querySelectorAll('li');
|
|
91
|
-
if (liChildren.length > 0) {
|
|
92
|
-
for (var i = 0; i < liChildren.length; i++) {
|
|
93
|
-
if (!isNOU(liChildren[i].style.marginLeft)) {
|
|
94
|
-
liChildren[i].style.marginLeft = '';
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
e.callBack(elm.innerHTML, this.cropImageDimensions);
|
|
93
|
+
e.callBack(elm.innerHTML, this.cropImageDimensions, source);
|
|
99
94
|
}
|
|
100
95
|
else {
|
|
101
96
|
e.callBack(elm.innerHTML);
|
|
102
97
|
}
|
|
103
98
|
};
|
|
99
|
+
MsWordPaste.prototype.addDoubleBr = function (elm) {
|
|
100
|
+
var newline = elm.querySelector('.Apple-interchange-newline');
|
|
101
|
+
if (!isNOU(newline) && Browser.userAgent.indexOf('Chrome') !== -1 && newline.parentElement.nodeName === 'P' && elm !== newline.parentElement) {
|
|
102
|
+
for (var i = 0; i < elm.childNodes.length; i++) {
|
|
103
|
+
// eslint-disable-next-line
|
|
104
|
+
var node = elm.childNodes[i];
|
|
105
|
+
if (node.nodeType === Node.COMMENT_NODE && node.nodeValue.includes('StartFragment')) {
|
|
106
|
+
var newElement = document.createElement('p');
|
|
107
|
+
newElement.innerHTML = '<br>';
|
|
108
|
+
var cssText = newline.parentElement.style.cssText;
|
|
109
|
+
var currentStyle = newElement.getAttribute('style') || '';
|
|
110
|
+
var newStyle = currentStyle + cssText;
|
|
111
|
+
newElement.setAttribute('style', newStyle);
|
|
112
|
+
elm.insertBefore(newElement, node.nextSibling);
|
|
113
|
+
detach(newline);
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
104
119
|
MsWordPaste.prototype.cleanList = function (elm, listTag) {
|
|
105
120
|
var replacableElem = elm.querySelectorAll(listTag + ' div');
|
|
106
121
|
for (var j = replacableElem.length - 1; j >= 0; j--) {
|
|
@@ -165,8 +180,9 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
165
180
|
imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0 &&
|
|
166
181
|
imgElem[i].getAttribute('v:shapes').indexOf('_x0000_s') < 0 &&
|
|
167
182
|
imgElem[i].getAttribute('v:shapes').indexOf('_x0000_i') < 0) {
|
|
168
|
-
|
|
183
|
+
imgElem[i].classList.add('e-rte-image-unsupported');
|
|
169
184
|
}
|
|
185
|
+
imgElem[i].removeAttribute('v:shapes');
|
|
170
186
|
}
|
|
171
187
|
imgElem = elm.querySelectorAll('img');
|
|
172
188
|
var imgSrc = [];
|
|
@@ -196,6 +212,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
196
212
|
});
|
|
197
213
|
}
|
|
198
214
|
}
|
|
215
|
+
imgElem = elm.querySelectorAll('img:not(.e-rte-image-unsupported');
|
|
199
216
|
for (var i = 0; i < imgElem.length; i++) {
|
|
200
217
|
if (imgSrc[i].match(linkRegex)) {
|
|
201
218
|
imgElem[i].setAttribute('src', imgSrc[i]);
|
|
@@ -206,7 +223,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
206
223
|
}
|
|
207
224
|
else {
|
|
208
225
|
imgElem[i].removeAttribute('src');
|
|
209
|
-
imgElem[i].
|
|
226
|
+
imgElem[i].classList.add('e-rte-image-unsupported');
|
|
210
227
|
}
|
|
211
228
|
if (!isNOU(base64Src[i]) && base64Src[i].isCroppedImage) {
|
|
212
229
|
imgElem[i].classList.add('e-img-cropped');
|
|
@@ -214,6 +231,10 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
214
231
|
}
|
|
215
232
|
imgElem[i].setAttribute('id', 'msWordImg-' + imgName[i]);
|
|
216
233
|
}
|
|
234
|
+
imgElem = elm.querySelectorAll('.e-rte-image-unsupported');
|
|
235
|
+
for (var i = 0; i < imgElem.length; i++) {
|
|
236
|
+
imgElem[i].removeAttribute('src');
|
|
237
|
+
}
|
|
217
238
|
}
|
|
218
239
|
};
|
|
219
240
|
MsWordPaste.prototype.checkVShape = function (elm) {
|
|
@@ -287,6 +308,9 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
287
308
|
var result = [];
|
|
288
309
|
if (!isNOU(fullImg)) {
|
|
289
310
|
for (var i = 0; i < fullImg.length; i++) {
|
|
311
|
+
if (fullImg[i].indexOf('fIsBullet') !== -1 && fullImg[i].indexOf('wzName') === -1) {
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
290
314
|
var isCroppedImage = false;
|
|
291
315
|
var goalWidth = 0;
|
|
292
316
|
var goalHeight = 0;
|
|
@@ -301,7 +325,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
301
325
|
else if (fullImg[i].indexOf('\\jpegblip') !== -1) {
|
|
302
326
|
imgType = 'image/jpeg';
|
|
303
327
|
}
|
|
304
|
-
else if (fullImg[i].indexOf('\\
|
|
328
|
+
else if (fullImg[i].indexOf('\\emfblip') !== -1) {
|
|
305
329
|
imgType = null;
|
|
306
330
|
}
|
|
307
331
|
else {
|
|
@@ -341,7 +365,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
341
365
|
return parseInt(result, 10);
|
|
342
366
|
};
|
|
343
367
|
MsWordPaste.prototype.removeClassName = function (elm) {
|
|
344
|
-
var elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped)');
|
|
368
|
+
var elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped):not(.e-rte-image-unsupported)');
|
|
345
369
|
for (var i = 0; i < elmWithClass.length; i++) {
|
|
346
370
|
elmWithClass[i].removeAttribute('class');
|
|
347
371
|
}
|
|
@@ -385,7 +409,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
385
409
|
var innerElement = elm.innerHTML;
|
|
386
410
|
for (var i = 0; i < this.removableElements.length; i++) {
|
|
387
411
|
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
388
|
-
var regExpStartElem = new RegExp('<' + this.removableElements[i] + '
|
|
412
|
+
var regExpStartElem = new RegExp('<' + this.removableElements[i] + '\\s*[^>]*>', 'g');
|
|
389
413
|
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
390
414
|
var regExpEndElem = new RegExp('</' + this.removableElements[i] + '>', 'g');
|
|
391
415
|
innerElement = innerElement.replace(regExpStartElem, '');
|
|
@@ -448,72 +472,80 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
448
472
|
};
|
|
449
473
|
MsWordPaste.prototype.styleCorrection = function (elm, wordPasteStyleConfig) {
|
|
450
474
|
var styleElement = elm.querySelectorAll('style');
|
|
475
|
+
var styles = [];
|
|
451
476
|
if (styleElement.length > 0) {
|
|
452
|
-
|
|
477
|
+
if (!isNOU(styleElement[0].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi))) {
|
|
478
|
+
styles = styleElement[0].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);
|
|
479
|
+
}
|
|
480
|
+
else if (styleElement.length > 1) {
|
|
481
|
+
styles = styleElement[1].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);
|
|
482
|
+
}
|
|
453
483
|
var styleClassObject_1 = !isNOU(styles) ? this.findStyleObject(styles) : null;
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
470
|
-
else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') < 0) {
|
|
471
|
-
resultElem = elm.getElementsByTagName(keys[i]);
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
resultElem = elm.querySelectorAll(keys[i]);
|
|
475
|
-
}
|
|
476
|
-
for (var j = 0; j < resultElem.length; j++) {
|
|
477
|
-
if (resultElem[j].closest('li') && keys[i] === 'p') {
|
|
484
|
+
if (!isNOU(styleClassObject_1)) {
|
|
485
|
+
var keys = Object.keys(styleClassObject_1);
|
|
486
|
+
var values = keys.map(function (key) {
|
|
487
|
+
return styleClassObject_1["" + key];
|
|
488
|
+
});
|
|
489
|
+
values = this.removeUnwantedStyle(values, wordPasteStyleConfig);
|
|
490
|
+
this.filterStyles(elm, wordPasteStyleConfig);
|
|
491
|
+
var resultElem = void 0;
|
|
492
|
+
var fromClass = false;
|
|
493
|
+
for (var i = 0; i < keys.length; i++) {
|
|
494
|
+
if (keys[i].split('.')[0] === '') {
|
|
495
|
+
resultElem = elm.getElementsByClassName(keys[i].split('.')[1]);
|
|
496
|
+
fromClass = true;
|
|
497
|
+
}
|
|
498
|
+
else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') >= 0) {
|
|
478
499
|
continue;
|
|
479
500
|
}
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
501
|
+
else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') < 0) {
|
|
502
|
+
resultElem = elm.getElementsByTagName(keys[i]);
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
resultElem = elm.querySelectorAll(keys[i]);
|
|
506
|
+
}
|
|
507
|
+
for (var j = 0; j < resultElem.length; j++) {
|
|
508
|
+
if (resultElem[j].closest('li') && keys[i] === 'p') {
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
var styleProperty = resultElem[j].getAttribute('style');
|
|
512
|
+
if (!isNOU(styleProperty) && styleProperty.trim() !== '') {
|
|
513
|
+
var valueSplit = values[i].split(';');
|
|
514
|
+
if (!fromClass) {
|
|
515
|
+
for (var k = 0; k < valueSplit.length; k++) {
|
|
516
|
+
if (styleProperty.indexOf(valueSplit[k].split(':')[0]) >= 0) {
|
|
517
|
+
valueSplit.splice(k, 1);
|
|
518
|
+
k--;
|
|
519
|
+
}
|
|
488
520
|
}
|
|
489
521
|
}
|
|
522
|
+
var changedValue = styleProperty + valueSplit.join(';') + ';';
|
|
523
|
+
resultElem[j].setAttribute('style', changedValue);
|
|
524
|
+
}
|
|
525
|
+
else {
|
|
526
|
+
values[i] = values[i].replace(/text-indent:-(.*?)(?=;|$)/gm, '');
|
|
527
|
+
resultElem[j].setAttribute('style', values[i]);
|
|
490
528
|
}
|
|
491
|
-
var changedValue = styleProperty + valueSplit.join(';') + ';';
|
|
492
|
-
resultElem[j].setAttribute('style', changedValue);
|
|
493
|
-
}
|
|
494
|
-
else {
|
|
495
|
-
values[i] = values[i].replace(/text-indent:-(.*?)(?=;|$)/gm, '');
|
|
496
|
-
resultElem[j].setAttribute('style', values[i]);
|
|
497
529
|
}
|
|
530
|
+
fromClass = false;
|
|
498
531
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
|
|
532
|
+
var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
|
|
533
|
+
for (var i = 0; i < listClass.length; i++) {
|
|
534
|
+
if (keys.indexOf('li.' + listClass[i]) > -1) {
|
|
535
|
+
var olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
|
|
536
|
+
for (var j = 0; j < olULElems.length; j++) {
|
|
537
|
+
var styleProperty = olULElems[j].getAttribute('style');
|
|
538
|
+
if (!isNOU(styleProperty) && styleProperty.trim() !== '' && olULElems[j].style.marginLeft !== '') {
|
|
539
|
+
var valueSplit = values[keys.indexOf('li.' + listClass[i])].split(';');
|
|
540
|
+
for (var k = 0; k < valueSplit.length; k++) {
|
|
541
|
+
if ('margin-left'.indexOf(valueSplit[k].split(':')[0]) >= 0) {
|
|
542
|
+
if (!isNOU(valueSplit[k].split(':')[1]) &&
|
|
543
|
+
valueSplit[k].split(':')[1].indexOf('in') >= 0 &&
|
|
544
|
+
olULElems[j].style.marginLeft.indexOf('in') >= 0) {
|
|
545
|
+
var classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
|
|
546
|
+
var inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
|
|
547
|
+
olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
|
|
548
|
+
}
|
|
517
549
|
}
|
|
518
550
|
}
|
|
519
551
|
}
|
|
@@ -614,6 +646,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
614
646
|
MsWordPaste.prototype.listConverter = function (listNodes) {
|
|
615
647
|
var level;
|
|
616
648
|
var data = [];
|
|
649
|
+
var listFormatOverride;
|
|
617
650
|
var collection = [];
|
|
618
651
|
var content = '';
|
|
619
652
|
var stNode;
|
|
@@ -635,6 +668,17 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
635
668
|
else {
|
|
636
669
|
level = 1;
|
|
637
670
|
}
|
|
671
|
+
if (content && content.indexOf('mso-list:') !== -1) {
|
|
672
|
+
var msoListValue = void 0;
|
|
673
|
+
if (content.match(/mso-list:[^;]+;?/)) {
|
|
674
|
+
var changedContent = content.replace('\n', '').split(' ').join('');
|
|
675
|
+
msoListValue = changedContent.match(/mso-list:[^;]+;?/)[0].split(':l');
|
|
676
|
+
listFormatOverride = isNOU(msoListValue) ? null : parseInt(msoListValue[1].split('level')[0], 10);
|
|
677
|
+
}
|
|
678
|
+
else {
|
|
679
|
+
listFormatOverride = null;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
638
682
|
this.listContents = [];
|
|
639
683
|
this.getListContent(listNodes[i]);
|
|
640
684
|
var type = void 0;
|
|
@@ -670,9 +714,9 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
670
714
|
startAttr = this.lowerGreekNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
|
|
671
715
|
}
|
|
672
716
|
}
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
717
|
+
}
|
|
718
|
+
if (listNodes[i].style.marginLeft !== '') {
|
|
719
|
+
styleMarginLeft = listNodes[i].style.marginLeft;
|
|
676
720
|
}
|
|
677
721
|
var tempNode = [];
|
|
678
722
|
for (var j = 1; j < this.listContents.length; j++) {
|
|
@@ -688,7 +732,8 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
688
732
|
currentListStyle = listNodes[i].getAttribute('style');
|
|
689
733
|
}
|
|
690
734
|
collection.push({
|
|
691
|
-
listType: type, content: tempNode, nestedLevel: level,
|
|
735
|
+
listType: type, content: tempNode, nestedLevel: level,
|
|
736
|
+
listFormatOverride: listFormatOverride, class: currentClassName,
|
|
692
737
|
listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft
|
|
693
738
|
});
|
|
694
739
|
}
|
|
@@ -761,6 +806,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
761
806
|
var prevList;
|
|
762
807
|
var listCount = 0;
|
|
763
808
|
var elem;
|
|
809
|
+
var lfo = collection[0].listFormatOverride;
|
|
764
810
|
for (var index = 0; index < collection.length; index++) {
|
|
765
811
|
var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
|
|
766
812
|
var isNormalList = false;
|
|
@@ -777,16 +823,24 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
777
823
|
}
|
|
778
824
|
var pElement = createElement('p', { className: 'MsoNormal' });
|
|
779
825
|
pElement.innerHTML = collection[index].content.join(' ');
|
|
780
|
-
if ((collection[index].nestedLevel === 1) &&
|
|
826
|
+
if ((collection[index].nestedLevel === 1) &&
|
|
827
|
+
(listCount === 0 || lfo !== collection[index].listFormatOverride) &&
|
|
828
|
+
collection[index].content) {
|
|
781
829
|
root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
|
|
782
830
|
prevList = createElement('li');
|
|
783
831
|
prevList.appendChild(pElement);
|
|
784
832
|
temp.appendChild(prevList);
|
|
785
833
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
786
|
-
|
|
834
|
+
if (collection[index].class !== 'msolistparagraph') {
|
|
835
|
+
temp.style.marginLeft = collection[index].styleMarginLeft;
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
addClass([temp], 'marginLeftIgnore');
|
|
839
|
+
}
|
|
787
840
|
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
788
841
|
}
|
|
789
|
-
else if (collection[index].nestedLevel === pLevel
|
|
842
|
+
else if (collection[index].nestedLevel === pLevel &&
|
|
843
|
+
lfo === collection[index].listFormatOverride) {
|
|
790
844
|
if (!isNOU(prevList) && !isNOU(prevList.parentElement)
|
|
791
845
|
&& prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
|
|
792
846
|
prevList.parentElement.appendChild(prevList = createElement('li'));
|
|
@@ -849,6 +903,12 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
849
903
|
prevList.appendChild(pElement);
|
|
850
904
|
temp.appendChild(prevList);
|
|
851
905
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
906
|
+
if (collection[index].class !== 'msolistparagraph') {
|
|
907
|
+
temp.style.marginLeft = collection[index].styleMarginLeft;
|
|
908
|
+
}
|
|
909
|
+
else {
|
|
910
|
+
addClass([temp], 'marginLeftIgnore');
|
|
911
|
+
}
|
|
852
912
|
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
853
913
|
}
|
|
854
914
|
}
|
|
@@ -872,14 +932,34 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
872
932
|
elem = elem.parentElement;
|
|
873
933
|
if (elem.attributes.getNamedItem('level')) {
|
|
874
934
|
// eslint-disable-next-line
|
|
875
|
-
if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel
|
|
935
|
+
if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
|
|
936
|
+
lfo === collection[index].listFormatOverride) {
|
|
876
937
|
prevList = createElement('li');
|
|
877
938
|
prevList.appendChild(pElement);
|
|
878
939
|
elem.appendChild(prevList);
|
|
879
940
|
break;
|
|
880
941
|
// eslint-disable-next-line
|
|
881
942
|
}
|
|
882
|
-
else if (
|
|
943
|
+
else if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
|
|
944
|
+
lfo !== collection[index].listFormatOverride) {
|
|
945
|
+
temp = createElement(collection[index].listType);
|
|
946
|
+
prevList = createElement('li');
|
|
947
|
+
temp.appendChild(prevList);
|
|
948
|
+
if (collection[index].nestedLevel > 1) {
|
|
949
|
+
for (var k = 0; k < collection[index].nestedLevel - 1; k++) {
|
|
950
|
+
prevList.appendChild(temp = createElement(collection[index].listType));
|
|
951
|
+
prevList = createElement('li');
|
|
952
|
+
temp.appendChild(prevList);
|
|
953
|
+
temp.style.listStyleType = 'none';
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
prevList.appendChild(pElement);
|
|
957
|
+
elem.appendChild(temp);
|
|
958
|
+
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
959
|
+
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
960
|
+
break;
|
|
961
|
+
}
|
|
962
|
+
else if (collection[index].nestedLevel > parseInt(elem.attributes.getNamedItem('level').textContent, 10)) {
|
|
883
963
|
elem.appendChild(temp = createElement(collection[index].listType));
|
|
884
964
|
prevList = createElement('li');
|
|
885
965
|
prevList.appendChild(pElement);
|
|
@@ -895,8 +975,9 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
895
975
|
prevList.setAttribute('class', collection[index].class);
|
|
896
976
|
prevList.setAttribute('style', (!isNOU(collection[index].listStyle) ? collection[index].listStyle : ''));
|
|
897
977
|
pLevel = collection[index].nestedLevel;
|
|
978
|
+
lfo = collection[index].listFormatOverride;
|
|
898
979
|
listCount++;
|
|
899
|
-
if (!isNOU(collection[index].start)) {
|
|
980
|
+
if (!isNOU(collection[index].start && collection[index].start !== 1 && collection[index].listType === 'ol')) {
|
|
900
981
|
temp.setAttribute('start', collection[index].start.toString());
|
|
901
982
|
}
|
|
902
983
|
}
|
|
@@ -929,6 +1010,36 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
929
1010
|
}
|
|
930
1011
|
this.listContents.push(elem.innerHTML);
|
|
931
1012
|
};
|
|
1013
|
+
MsWordPaste.prototype.processMargin = function (element) {
|
|
1014
|
+
var liChildren = element.querySelectorAll('li');
|
|
1015
|
+
if (liChildren.length > 0) {
|
|
1016
|
+
for (var i = 0; i < liChildren.length; i++) {
|
|
1017
|
+
if (!isNOU((liChildren[i]).style.marginLeft) && !liChildren[i].parentElement.classList.contains('marginLeftIgnore')) {
|
|
1018
|
+
(liChildren[i]).style.marginLeft = '';
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
var tableChildren = element.querySelectorAll('table');
|
|
1023
|
+
if (tableChildren.length > 0) {
|
|
1024
|
+
for (var i = 0; i < tableChildren.length; i++) {
|
|
1025
|
+
if (!isNOU((tableChildren[i]).style.marginLeft) &&
|
|
1026
|
+
(tableChildren[i]).style.marginLeft.indexOf('-') >= 0) {
|
|
1027
|
+
(tableChildren[i]).style.marginLeft = '';
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
var ignoredNode = element.querySelectorAll('.marginLeftIgnore li');
|
|
1032
|
+
if (ignoredNode.length > 0) {
|
|
1033
|
+
for (var i = 0; i < ignoredNode.length; i++) {
|
|
1034
|
+
if (!isNOU((ignoredNode[i]).style.marginLeft) && (ignoredNode[i]).style.marginLeft !== '') {
|
|
1035
|
+
var marginLeft = (ignoredNode[i]).style.marginLeft;
|
|
1036
|
+
var marginLeftValue = parseFloat(marginLeft.split('in')[0]);
|
|
1037
|
+
var result = marginLeftValue - 0.5;
|
|
1038
|
+
(ignoredNode[i]).style.marginLeft = result.toString() + 'in';
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
932
1043
|
MsWordPaste.prototype.removeEmptyAnchorTag = function (element) {
|
|
933
1044
|
var removableElement = element.querySelectorAll('a:not([href])');
|
|
934
1045
|
for (var j = removableElement.length - 1; j >= 0; j--) {
|
|
@@ -939,6 +1050,22 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
939
1050
|
parentElem.removeChild(removableElement[j]);
|
|
940
1051
|
}
|
|
941
1052
|
};
|
|
1053
|
+
MsWordPaste.prototype.findSource = function (element) {
|
|
1054
|
+
var metaNodes = element.querySelectorAll('meta');
|
|
1055
|
+
for (var i = 0; i < metaNodes.length; i++) {
|
|
1056
|
+
var metaNode = metaNodes[i];
|
|
1057
|
+
var content = metaNode.getAttribute('content');
|
|
1058
|
+
var name_1 = metaNode.getAttribute('name');
|
|
1059
|
+
if (name_1 && name_1.toLowerCase().indexOf('generator') >= 0 && content && content.toLowerCase().indexOf('microsoft') >= 0) {
|
|
1060
|
+
for (var j = 0; j < PASTE_SOURCE.length; j++) {
|
|
1061
|
+
if (content.toLowerCase().indexOf(PASTE_SOURCE[j]) >= 0) {
|
|
1062
|
+
return PASTE_SOURCE[j];
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
return 'html';
|
|
1068
|
+
};
|
|
942
1069
|
return MsWordPaste;
|
|
943
1070
|
}());
|
|
944
1071
|
export { MsWordPaste };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Split the Node based on selection
|
|
3
3
|
*
|
|
4
4
|
* @hidden
|
|
5
|
-
|
|
5
|
+
* @deprecated
|
|
6
6
|
*/
|
|
7
7
|
export declare class NodeCutter {
|
|
8
8
|
enterAction: string;
|
|
@@ -15,7 +15,7 @@ export declare class NodeCutter {
|
|
|
15
15
|
* @param {HTMLElement} node - specifies the node element.
|
|
16
16
|
* @returns {Node} - returns the node value
|
|
17
17
|
* @hidden
|
|
18
|
-
|
|
18
|
+
* @deprecated
|
|
19
19
|
*/
|
|
20
20
|
GetSpliceNode(range: Range, node: HTMLElement): Node;
|
|
21
21
|
/**
|
|
@@ -24,7 +24,7 @@ export declare class NodeCutter {
|
|
|
24
24
|
* @param {boolean} isCollapsed - specifies the boolean value
|
|
25
25
|
* @returns {HTMLElement} - returns the element
|
|
26
26
|
* @hidden
|
|
27
|
-
|
|
27
|
+
* @deprecated
|
|
28
28
|
*/
|
|
29
29
|
SplitNode(range: Range, node: HTMLElement, isCollapsed: boolean): HTMLElement;
|
|
30
30
|
private isRteElm;
|
|
@@ -38,7 +38,7 @@ export declare class NodeCutter {
|
|
|
38
38
|
* @param {Node} node - specifies the node.
|
|
39
39
|
* @returns {Range} - returns the range value
|
|
40
40
|
* @hidden
|
|
41
|
-
|
|
41
|
+
* @deprecated
|
|
42
42
|
*/
|
|
43
43
|
GetCursorRange(docElement: Document, range: Range, node: Node): Range;
|
|
44
44
|
/**
|
|
@@ -49,7 +49,7 @@ export declare class NodeCutter {
|
|
|
49
49
|
* @param {Node} node - specifies the node.
|
|
50
50
|
* @returns {Node} - returns the node value
|
|
51
51
|
* @hidden
|
|
52
|
-
|
|
52
|
+
* @deprecated
|
|
53
53
|
*/
|
|
54
54
|
GetCursorNode(docElement: Document, range: Range, node: Node): Node;
|
|
55
55
|
/**
|
|
@@ -58,7 +58,7 @@ export declare class NodeCutter {
|
|
|
58
58
|
* @param {string} line - specifies the string value.
|
|
59
59
|
* @returns {string} - returns the string
|
|
60
60
|
* @hidden
|
|
61
|
-
|
|
61
|
+
* @deprecated
|
|
62
62
|
*/
|
|
63
63
|
TrimLineBreak(line: string): string;
|
|
64
64
|
}
|
|
@@ -5,7 +5,7 @@ import { InsertMethods } from './insert-methods';
|
|
|
5
5
|
* Split the Node based on selection
|
|
6
6
|
*
|
|
7
7
|
* @hidden
|
|
8
|
-
|
|
8
|
+
* @deprecated
|
|
9
9
|
*/
|
|
10
10
|
var NodeCutter = /** @class */ (function () {
|
|
11
11
|
function NodeCutter() {
|
|
@@ -21,7 +21,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
21
21
|
* @param {HTMLElement} node - specifies the node element.
|
|
22
22
|
* @returns {Node} - returns the node value
|
|
23
23
|
* @hidden
|
|
24
|
-
|
|
24
|
+
* @deprecated
|
|
25
25
|
*/
|
|
26
26
|
NodeCutter.prototype.GetSpliceNode = function (range, node) {
|
|
27
27
|
node = this.SplitNode(range, node, true);
|
|
@@ -34,7 +34,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
34
34
|
* @param {boolean} isCollapsed - specifies the boolean value
|
|
35
35
|
* @returns {HTMLElement} - returns the element
|
|
36
36
|
* @hidden
|
|
37
|
-
|
|
37
|
+
* @deprecated
|
|
38
38
|
*/
|
|
39
39
|
NodeCutter.prototype.SplitNode = function (range, node, isCollapsed) {
|
|
40
40
|
if (node) {
|
|
@@ -125,7 +125,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
125
125
|
else if (len > -1) {
|
|
126
126
|
this.spliceEmptyNode(fragment.childNodes[0], isStart);
|
|
127
127
|
}
|
|
128
|
-
else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG' && !(fragment.classList.contains('e-video-wrap')) && !(fragment.classList.contains('e-audio-wrap'))) {
|
|
128
|
+
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'))) {
|
|
129
129
|
fragment.parentNode.removeChild(fragment);
|
|
130
130
|
}
|
|
131
131
|
return fragment;
|
|
@@ -147,7 +147,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
147
147
|
* @param {Node} node - specifies the node.
|
|
148
148
|
* @returns {Range} - returns the range value
|
|
149
149
|
* @hidden
|
|
150
|
-
|
|
150
|
+
* @deprecated
|
|
151
151
|
*/
|
|
152
152
|
NodeCutter.prototype.GetCursorRange = function (docElement, range, node) {
|
|
153
153
|
var cursorRange = docElement.createRange();
|
|
@@ -171,7 +171,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
171
171
|
if ((indexes.indexOf(range.startOffset) >= 0)
|
|
172
172
|
|| ((indexes.indexOf(range.startOffset - 1) >= 0) && (range.startOffset !== 1
|
|
173
173
|
|| (range.startOffset === 1 && new RegExp('\\s').test(str[0])))
|
|
174
|
-
|| (((indexes[indexes.length - 1] - 1) === range.startOffset) && !new RegExp('\\s').test(str[0])))) {
|
|
174
|
+
|| (((indexes[indexes.length - 1] - 1) === range.startOffset) && range.endOffset !== (str.length - 1) && !new RegExp('\\s').test(str[0])))) {
|
|
175
175
|
cursorRange = range;
|
|
176
176
|
this.position = 1;
|
|
177
177
|
}
|
|
@@ -191,7 +191,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
191
191
|
* @param {Node} node - specifies the node.
|
|
192
192
|
* @returns {Node} - returns the node value
|
|
193
193
|
* @hidden
|
|
194
|
-
|
|
194
|
+
* @deprecated
|
|
195
195
|
*/
|
|
196
196
|
NodeCutter.prototype.GetCursorNode = function (docElement, range, node) {
|
|
197
197
|
return this.GetSpliceNode(this.GetCursorRange(docElement, range, node), node);
|
|
@@ -202,7 +202,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
202
202
|
* @param {string} line - specifies the string value.
|
|
203
203
|
* @returns {string} - returns the string
|
|
204
204
|
* @hidden
|
|
205
|
-
|
|
205
|
+
* @deprecated
|
|
206
206
|
*/
|
|
207
207
|
NodeCutter.prototype.TrimLineBreak = function (line) {
|
|
208
208
|
return line.replace(/(\r\n\t|\n|\r\t)/gm, ' ');
|
|
@@ -13,7 +13,7 @@ export declare class SelectionCommands {
|
|
|
13
13
|
* @param {FormatPainterValue} painterValues specifies the element created and last child
|
|
14
14
|
* @returns {void}
|
|
15
15
|
* @hidden
|
|
16
|
-
|
|
16
|
+
* @deprecated
|
|
17
17
|
*/
|
|
18
18
|
static applyFormat(docElement: Document, format: string, endNode: Node, enterAction: string, value?: string, selector?: string, painterValues?: FormatPainterValue): void;
|
|
19
19
|
private static insertCursorNode;
|
|
@@ -29,4 +29,5 @@ export declare class SelectionCommands {
|
|
|
29
29
|
private static updateStyles;
|
|
30
30
|
private static insertFormatPainterElem;
|
|
31
31
|
private static formatPainterCleanup;
|
|
32
|
+
private static concatenateTextExcludingList;
|
|
32
33
|
}
|