@syncfusion/ej2-richtexteditor 23.2.7 → 24.1.41-569421
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 +1953 -1749
- 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 +9971 -8025
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +8445 -6498
- 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 +12 -1
- 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 +16 -6
- 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 -62
- 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 +41 -18
- package/src/editor-manager/plugin/indents.d.ts +2 -2
- package/src/editor-manager/plugin/indents.js +3 -3
- 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 +85 -22
- 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 +10 -5
- package/src/editor-manager/plugin/lists.d.ts +2 -2
- package/src/editor-manager/plugin/lists.js +161 -72
- package/src/editor-manager/plugin/ms-word-clean-up.d.ts +4 -1
- package/src/editor-manager/plugin/ms-word-clean-up.js +216 -86
- package/src/editor-manager/plugin/nodecutter.d.ts +6 -6
- package/src/editor-manager/plugin/nodecutter.js +11 -8
- package/src/editor-manager/plugin/selection-commands.d.ts +3 -1
- package/src/editor-manager/plugin/selection-commands.js +249 -5
- 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 +6 -3
- package/src/editor-manager/plugin/table.js +97 -51
- 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/global.d.ts +1 -0
- 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 +13 -12
- package/src/rich-text-editor/actions/base-quick-toolbar.js +70 -23
- package/src/rich-text-editor/actions/base-toolbar.d.ts +3 -3
- package/src/rich-text-editor/actions/base-toolbar.js +36 -37
- package/src/rich-text-editor/actions/color-picker.d.ts +3 -2
- package/src/rich-text-editor/actions/color-picker.js +15 -5
- 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 +3 -2
- package/src/rich-text-editor/actions/dropdown-buttons.js +13 -7
- package/src/rich-text-editor/actions/emoji-picker.d.ts +1 -1
- package/src/rich-text-editor/actions/emoji-picker.js +17 -8
- package/src/rich-text-editor/actions/enter-key.js +10 -5
- package/src/rich-text-editor/actions/file-manager.js +1 -1
- package/src/rich-text-editor/actions/format-painter.js +5 -2
- package/src/rich-text-editor/actions/full-screen.d.ts +3 -3
- package/src/rich-text-editor/actions/full-screen.js +8 -7
- package/src/rich-text-editor/actions/html-editor.d.ts +5 -3
- package/src/rich-text-editor/actions/html-editor.js +134 -22
- 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 +6 -1
- package/src/rich-text-editor/actions/paste-clean-up.js +157 -29
- package/src/rich-text-editor/actions/quick-toolbar.d.ts +17 -9
- package/src/rich-text-editor/actions/quick-toolbar.js +68 -21
- 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 +16 -16
- package/src/rich-text-editor/actions/toolbar.js +48 -109
- 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 +125 -125
- package/src/rich-text-editor/base/classes.js +125 -125
- package/src/rich-text-editor/base/constant.d.ts +195 -150
- package/src/rich-text-editor/base/constant.js +364 -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 +96 -52
- 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 +76 -64
- package/src/rich-text-editor/base/rich-text-editor.js +247 -160
- package/src/rich-text-editor/base/util.d.ts +1 -1
- package/src/rich-text-editor/base/util.js +23 -5
- package/src/rich-text-editor/formatter/formatter.d.ts +8 -8
- package/src/rich-text-editor/formatter/formatter.js +24 -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 +31 -25
- 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 +3 -3
- 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 +23 -5
- 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 +24 -4
- 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 +265 -221
- package/src/rich-text-editor/renderer/link-module.d.ts +1 -1
- package/src/rich-text-editor/renderer/link-module.js +54 -25
- 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 +11 -2
- package/src/rich-text-editor/renderer/table-module.js +344 -169
- package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +12 -15
- package/src/rich-text-editor/renderer/toolbar-renderer.js +115 -110
- package/src/rich-text-editor/renderer/video-module.d.ts +4 -1
- package/src/rich-text-editor/renderer/video-module.js +83 -42
- package/src/rich-text-editor/renderer/view-source.d.ts +7 -6
- package/src/rich-text-editor/renderer/view-source.js +21 -11
- 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 +353 -103
- package/styles/bootstrap.css +357 -112
- package/styles/bootstrap4.css +338 -96
- package/styles/bootstrap5-dark.css +344 -97
- package/styles/bootstrap5.css +344 -97
- package/styles/fabric-dark.css +332 -90
- package/styles/fabric.css +333 -91
- package/styles/fluent-dark.css +360 -98
- package/styles/fluent.css +360 -98
- package/styles/highcontrast-light.css +332 -90
- package/styles/highcontrast.css +336 -91
- package/styles/material-dark.css +339 -92
- package/styles/material.css +339 -92
- package/styles/material3-dark.css +348 -100
- package/styles/material3-dark.scss +1 -1
- package/styles/material3.css +348 -100
- 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 -2072
- 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 +926 -837
- package/styles/rich-text-editor/bootstrap-dark.css +353 -103
- package/styles/rich-text-editor/bootstrap.css +357 -112
- package/styles/rich-text-editor/bootstrap4.css +338 -96
- package/styles/rich-text-editor/bootstrap5-dark.css +344 -97
- package/styles/rich-text-editor/bootstrap5.css +344 -97
- package/styles/rich-text-editor/fabric-dark.css +332 -90
- package/styles/rich-text-editor/fabric.css +333 -91
- package/styles/rich-text-editor/fluent-dark.css +360 -98
- package/styles/rich-text-editor/fluent.css +360 -98
- package/styles/rich-text-editor/highcontrast-light.css +332 -90
- package/styles/rich-text-editor/highcontrast.css +336 -91
- 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 +339 -92
- package/styles/rich-text-editor/material.css +339 -92
- package/styles/rich-text-editor/material3-dark.css +348 -100
- package/styles/rich-text-editor/material3-dark.scss +1 -1
- package/styles/rich-text-editor/material3.css +348 -100
- package/styles/rich-text-editor/material3.scss +1 -1
- package/styles/rich-text-editor/tailwind-dark.css +383 -113
- package/styles/rich-text-editor/tailwind.css +383 -113
- package/styles/tailwind-dark.css +383 -113
- package/styles/tailwind.css +383 -113
- 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,69 +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
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
var
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
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) {
|
|
499
|
+
continue;
|
|
500
|
+
}
|
|
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
|
+
}
|
|
485
520
|
}
|
|
486
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]);
|
|
487
528
|
}
|
|
488
|
-
var changedValue = styleProperty + valueSplit.join(';') + ';';
|
|
489
|
-
resultElem[j].setAttribute('style', changedValue);
|
|
490
|
-
}
|
|
491
|
-
else {
|
|
492
|
-
values[i] = values[i].replace(/text-indent:-(.*?)(?=;|$)/gm, '');
|
|
493
|
-
resultElem[j].setAttribute('style', values[i]);
|
|
494
529
|
}
|
|
530
|
+
fromClass = false;
|
|
495
531
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
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
|
+
}
|
|
514
549
|
}
|
|
515
550
|
}
|
|
516
551
|
}
|
|
@@ -611,6 +646,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
611
646
|
MsWordPaste.prototype.listConverter = function (listNodes) {
|
|
612
647
|
var level;
|
|
613
648
|
var data = [];
|
|
649
|
+
var listFormatOverride;
|
|
614
650
|
var collection = [];
|
|
615
651
|
var content = '';
|
|
616
652
|
var stNode;
|
|
@@ -632,6 +668,17 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
632
668
|
else {
|
|
633
669
|
level = 1;
|
|
634
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
|
+
}
|
|
635
682
|
this.listContents = [];
|
|
636
683
|
this.getListContent(listNodes[i]);
|
|
637
684
|
var type = void 0;
|
|
@@ -667,9 +714,9 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
667
714
|
startAttr = this.lowerGreekNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
|
|
668
715
|
}
|
|
669
716
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
717
|
+
}
|
|
718
|
+
if (listNodes[i].style.marginLeft !== '') {
|
|
719
|
+
styleMarginLeft = listNodes[i].style.marginLeft;
|
|
673
720
|
}
|
|
674
721
|
var tempNode = [];
|
|
675
722
|
for (var j = 1; j < this.listContents.length; j++) {
|
|
@@ -685,7 +732,8 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
685
732
|
currentListStyle = listNodes[i].getAttribute('style');
|
|
686
733
|
}
|
|
687
734
|
collection.push({
|
|
688
|
-
listType: type, content: tempNode, nestedLevel: level,
|
|
735
|
+
listType: type, content: tempNode, nestedLevel: level,
|
|
736
|
+
listFormatOverride: listFormatOverride, class: currentClassName,
|
|
689
737
|
listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft
|
|
690
738
|
});
|
|
691
739
|
}
|
|
@@ -758,6 +806,7 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
758
806
|
var prevList;
|
|
759
807
|
var listCount = 0;
|
|
760
808
|
var elem;
|
|
809
|
+
var lfo = collection[0].listFormatOverride;
|
|
761
810
|
for (var index = 0; index < collection.length; index++) {
|
|
762
811
|
var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
|
|
763
812
|
var isNormalList = false;
|
|
@@ -772,18 +821,26 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
772
821
|
!isNormalList) {
|
|
773
822
|
prevList = null;
|
|
774
823
|
}
|
|
775
|
-
var pElement = createElement('p');
|
|
824
|
+
var pElement = createElement('p', { className: 'MsoNormal' });
|
|
776
825
|
pElement.innerHTML = collection[index].content.join(' ');
|
|
777
|
-
if ((collection[index].nestedLevel === 1) &&
|
|
826
|
+
if ((collection[index].nestedLevel === 1) &&
|
|
827
|
+
(listCount === 0 || lfo !== collection[index].listFormatOverride) &&
|
|
828
|
+
collection[index].content) {
|
|
778
829
|
root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
|
|
779
830
|
prevList = createElement('li');
|
|
780
831
|
prevList.appendChild(pElement);
|
|
781
832
|
temp.appendChild(prevList);
|
|
782
833
|
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
783
|
-
|
|
834
|
+
if (collection[index].class !== 'msolistparagraph') {
|
|
835
|
+
temp.style.marginLeft = collection[index].styleMarginLeft;
|
|
836
|
+
}
|
|
837
|
+
else {
|
|
838
|
+
addClass([temp], 'marginLeftIgnore');
|
|
839
|
+
}
|
|
784
840
|
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
785
841
|
}
|
|
786
|
-
else if (collection[index].nestedLevel === pLevel
|
|
842
|
+
else if (collection[index].nestedLevel === pLevel &&
|
|
843
|
+
lfo === collection[index].listFormatOverride) {
|
|
787
844
|
if (!isNOU(prevList) && !isNOU(prevList.parentElement)
|
|
788
845
|
&& prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
|
|
789
846
|
prevList.parentElement.appendChild(prevList = createElement('li'));
|
|
@@ -846,6 +903,12 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
846
903
|
prevList.appendChild(pElement);
|
|
847
904
|
temp.appendChild(prevList);
|
|
848
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
|
+
}
|
|
849
912
|
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
850
913
|
}
|
|
851
914
|
}
|
|
@@ -869,14 +932,34 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
869
932
|
elem = elem.parentElement;
|
|
870
933
|
if (elem.attributes.getNamedItem('level')) {
|
|
871
934
|
// eslint-disable-next-line
|
|
872
|
-
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) {
|
|
873
937
|
prevList = createElement('li');
|
|
874
938
|
prevList.appendChild(pElement);
|
|
875
939
|
elem.appendChild(prevList);
|
|
876
940
|
break;
|
|
877
941
|
// eslint-disable-next-line
|
|
878
942
|
}
|
|
879
|
-
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)) {
|
|
880
963
|
elem.appendChild(temp = createElement(collection[index].listType));
|
|
881
964
|
prevList = createElement('li');
|
|
882
965
|
prevList.appendChild(pElement);
|
|
@@ -892,8 +975,9 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
892
975
|
prevList.setAttribute('class', collection[index].class);
|
|
893
976
|
prevList.setAttribute('style', (!isNOU(collection[index].listStyle) ? collection[index].listStyle : ''));
|
|
894
977
|
pLevel = collection[index].nestedLevel;
|
|
978
|
+
lfo = collection[index].listFormatOverride;
|
|
895
979
|
listCount++;
|
|
896
|
-
if (!isNOU(collection[index].start)) {
|
|
980
|
+
if (!isNOU(collection[index].start && collection[index].start !== 1 && collection[index].listType === 'ol')) {
|
|
897
981
|
temp.setAttribute('start', collection[index].start.toString());
|
|
898
982
|
}
|
|
899
983
|
}
|
|
@@ -926,6 +1010,36 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
926
1010
|
}
|
|
927
1011
|
this.listContents.push(elem.innerHTML);
|
|
928
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
|
+
};
|
|
929
1043
|
MsWordPaste.prototype.removeEmptyAnchorTag = function (element) {
|
|
930
1044
|
var removableElement = element.querySelectorAll('a:not([href])');
|
|
931
1045
|
for (var j = removableElement.length - 1; j >= 0; j--) {
|
|
@@ -936,6 +1050,22 @@ var MsWordPaste = /** @class */ (function () {
|
|
|
936
1050
|
parentElem.removeChild(removableElement[j]);
|
|
937
1051
|
}
|
|
938
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
|
+
};
|
|
939
1069
|
return MsWordPaste;
|
|
940
1070
|
}());
|
|
941
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,13 +171,16 @@ 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))) {
|
|
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
|
}
|
|
178
178
|
else {
|
|
179
179
|
var startOffset = this.GetCursorStart(indexes, range.startOffset, true);
|
|
180
180
|
this.position = range.startOffset - startOffset;
|
|
181
|
+
if (startOffset !== 0 && str[startOffset] && str[startOffset] === ' ') {
|
|
182
|
+
startOffset = startOffset + 1;
|
|
183
|
+
}
|
|
181
184
|
cursorRange.setStart(range.startContainer, startOffset);
|
|
182
185
|
cursorRange.setEnd(range.startContainer, this.GetCursorStart(indexes, range.startOffset, false));
|
|
183
186
|
}
|
|
@@ -191,7 +194,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
191
194
|
* @param {Node} node - specifies the node.
|
|
192
195
|
* @returns {Node} - returns the node value
|
|
193
196
|
* @hidden
|
|
194
|
-
|
|
197
|
+
* @deprecated
|
|
195
198
|
*/
|
|
196
199
|
NodeCutter.prototype.GetCursorNode = function (docElement, range, node) {
|
|
197
200
|
return this.GetSpliceNode(this.GetCursorRange(docElement, range, node), node);
|
|
@@ -202,7 +205,7 @@ var NodeCutter = /** @class */ (function () {
|
|
|
202
205
|
* @param {string} line - specifies the string value.
|
|
203
206
|
* @returns {string} - returns the string
|
|
204
207
|
* @hidden
|
|
205
|
-
|
|
208
|
+
* @deprecated
|
|
206
209
|
*/
|
|
207
210
|
NodeCutter.prototype.TrimLineBreak = function (line) {
|
|
208
211
|
return line.replace(/(\r\n\t|\n|\r\t)/gm, ' ');
|