@syncfusion/ej2-richtexteditor 29.2.4-760237 → 29.2.4-771571
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 +260 -262
- package/dist/ej2-richtexteditor.umd.min.js +1 -1
- package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es2015.js +22 -2
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +23 -2
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/package.json +1 -1
- package/src/common/util.js +21 -1
- package/src/editor-manager/plugin/inserthtml.js +2 -1
- package/styles/bds-lite.css +278 -29
- package/styles/bds.css +289 -30
- package/styles/bootstrap-dark-lite.css +276 -27
- package/styles/bootstrap-dark.css +288 -29
- package/styles/bootstrap-lite.css +278 -29
- package/styles/bootstrap.css +290 -31
- package/styles/bootstrap4-lite.css +276 -27
- package/styles/bootstrap4.css +287 -28
- package/styles/bootstrap5-dark-lite.css +278 -29
- package/styles/bootstrap5-dark.css +289 -30
- package/styles/bootstrap5-lite.css +278 -29
- package/styles/bootstrap5.3-lite.css +276 -27
- package/styles/bootstrap5.3.css +288 -29
- package/styles/bootstrap5.css +289 -30
- package/styles/fabric-dark-lite.css +276 -27
- package/styles/fabric-dark.css +287 -28
- package/styles/fabric-lite.css +276 -27
- package/styles/fabric.css +287 -28
- package/styles/fluent-dark-lite.css +278 -29
- package/styles/fluent-dark.css +289 -31
- package/styles/fluent-lite.css +278 -29
- package/styles/fluent.css +289 -31
- package/styles/fluent2-lite.css +280 -31
- package/styles/fluent2.css +292 -33
- package/styles/highcontrast-light-lite.css +276 -27
- package/styles/highcontrast-light.css +287 -28
- package/styles/highcontrast-lite.css +276 -27
- package/styles/highcontrast.css +287 -28
- package/styles/material-dark-lite.css +276 -27
- package/styles/material-dark.css +287 -28
- package/styles/material-lite.css +276 -27
- package/styles/material.css +287 -28
- package/styles/material3-dark-lite.css +278 -27
- package/styles/material3-dark.css +289 -28
- package/styles/material3-lite.css +278 -27
- package/styles/material3.css +289 -28
- package/styles/rich-text-editor/_bds-definition.scss +9 -1
- package/styles/rich-text-editor/_bigger.scss +16 -3
- package/styles/rich-text-editor/_bootstrap-dark-definition.scss +9 -1
- package/styles/rich-text-editor/_bootstrap-definition.scss +10 -2
- package/styles/rich-text-editor/_bootstrap4-definition.scss +9 -1
- package/styles/rich-text-editor/_bootstrap5-definition.scss +10 -2
- package/styles/rich-text-editor/_bootstrap5.3-definition.scss +9 -1
- package/styles/rich-text-editor/_fabric-dark-definition.scss +9 -1
- package/styles/rich-text-editor/_fabric-definition.scss +9 -1
- package/styles/rich-text-editor/_fluent-definition.scss +9 -2
- package/styles/rich-text-editor/_fluent2-definition.scss +10 -2
- package/styles/rich-text-editor/_fusionnew-definition.scss +8 -1
- package/styles/rich-text-editor/_highcontrast-definition.scss +9 -1
- package/styles/rich-text-editor/_highcontrast-light-definition.scss +9 -1
- package/styles/rich-text-editor/_layout.scss +208 -25
- package/styles/rich-text-editor/_material-dark-definition.scss +9 -1
- package/styles/rich-text-editor/_material-definition.scss +9 -1
- package/styles/rich-text-editor/_material3-definition.scss +9 -1
- package/styles/rich-text-editor/_tailwind-definition.scss +9 -1
- package/styles/rich-text-editor/_tailwind3-definition.scss +11 -3
- package/styles/rich-text-editor/_theme.scss +3 -0
- package/styles/rich-text-editor/bds.css +289 -30
- package/styles/rich-text-editor/bootstrap-dark.css +288 -29
- package/styles/rich-text-editor/bootstrap.css +290 -31
- package/styles/rich-text-editor/bootstrap4.css +287 -28
- package/styles/rich-text-editor/bootstrap5-dark.css +289 -30
- package/styles/rich-text-editor/bootstrap5.3.css +288 -29
- package/styles/rich-text-editor/bootstrap5.css +289 -30
- package/styles/rich-text-editor/fabric-dark.css +287 -28
- package/styles/rich-text-editor/fabric.css +287 -28
- package/styles/rich-text-editor/fluent-dark.css +289 -31
- package/styles/rich-text-editor/fluent.css +289 -31
- package/styles/rich-text-editor/fluent2.css +292 -33
- package/styles/rich-text-editor/highcontrast-light.css +287 -28
- package/styles/rich-text-editor/highcontrast.css +287 -28
- package/styles/rich-text-editor/icons/_bds.scss +4 -1
- package/styles/rich-text-editor/icons/_bootstrap-dark.scss +4 -1
- package/styles/rich-text-editor/icons/_bootstrap.scss +4 -2
- package/styles/rich-text-editor/icons/_bootstrap4.scss +4 -2
- package/styles/rich-text-editor/icons/_bootstrap5.3.scss +4 -2
- package/styles/rich-text-editor/icons/_bootstrap5.scss +4 -2
- package/styles/rich-text-editor/icons/_fabric-dark.scss +4 -2
- package/styles/rich-text-editor/icons/_fabric.scss +4 -2
- package/styles/rich-text-editor/icons/_fluent.scss +5 -1
- package/styles/rich-text-editor/icons/_fluent2.scss +4 -2
- package/styles/rich-text-editor/icons/_fusionnew.scss +4 -2
- package/styles/rich-text-editor/icons/_highcontrast-light.scss +5 -1
- package/styles/rich-text-editor/icons/_highcontrast.scss +5 -1
- package/styles/rich-text-editor/icons/_material-dark.scss +5 -1
- package/styles/rich-text-editor/icons/_material.scss +5 -1
- package/styles/rich-text-editor/icons/_material3.scss +5 -1
- package/styles/rich-text-editor/icons/_tailwind.scss +5 -1
- package/styles/rich-text-editor/icons/_tailwind3.scss +5 -1
- package/styles/rich-text-editor/material-dark.css +287 -28
- package/styles/rich-text-editor/material.css +287 -28
- package/styles/rich-text-editor/material3-dark.css +289 -28
- package/styles/rich-text-editor/material3.css +289 -28
- package/styles/rich-text-editor/tailwind-dark.css +289 -30
- package/styles/rich-text-editor/tailwind.css +289 -30
- package/styles/rich-text-editor/tailwind3.css +291 -32
- package/styles/tailwind-dark-lite.css +278 -29
- package/styles/tailwind-dark.css +289 -30
- package/styles/tailwind-lite.css +278 -29
- package/styles/tailwind.css +289 -30
- package/styles/tailwind3-lite.css +280 -31
- package/styles/tailwind3.css +291 -32
- package/aceconfig.js +0 -17
- package/blazorGlobalSrc/common/config.d.ts +0 -63
- package/blazorGlobalSrc/common/config.js +0 -123
- package/blazorGlobalSrc/common/constant.d.ts +0 -117
- package/blazorGlobalSrc/common/constant.js +0 -23
- package/blazorGlobalSrc/common/editor-styles.d.ts +0 -1
- package/blazorGlobalSrc/common/editor-styles.js +0 -5
- package/blazorGlobalSrc/common/index.d.ts +0 -7
- package/blazorGlobalSrc/common/index.js +0 -9
- package/blazorGlobalSrc/common/interface.d.ts +0 -119
- package/blazorGlobalSrc/common/interface.js +0 -4
- package/blazorGlobalSrc/common/types.d.ts +0 -25
- package/blazorGlobalSrc/common/types.js +0 -4
- package/blazorGlobalSrc/common/user-agent.d.ts +0 -41
- package/blazorGlobalSrc/common/user-agent.js +0 -71
- package/blazorGlobalSrc/common/util.d.ts +0 -70
- package/blazorGlobalSrc/common/util.js +0 -222
- package/blazorGlobalSrc/components.d.ts +0 -8
- package/blazorGlobalSrc/components.js +0 -12
- package/blazorGlobalSrc/editor-manager/base/classes.d.ts +0 -31
- package/blazorGlobalSrc/editor-manager/base/classes.js +0 -28
- package/blazorGlobalSrc/editor-manager/base/constant.d.ts +0 -97
- package/blazorGlobalSrc/editor-manager/base/constant.js +0 -41
- package/blazorGlobalSrc/editor-manager/base/editor-manager.d.ts +0 -95
- package/blazorGlobalSrc/editor-manager/base/editor-manager.js +0 -339
- package/blazorGlobalSrc/editor-manager/base/enum.d.ts +0 -17
- package/blazorGlobalSrc/editor-manager/base/enum.js +0 -4
- package/blazorGlobalSrc/editor-manager/base/interface.d.ts +0 -263
- package/blazorGlobalSrc/editor-manager/base/interface.js +0 -4
- package/blazorGlobalSrc/editor-manager/base/types.d.ts +0 -7
- package/blazorGlobalSrc/editor-manager/base/types.js +0 -4
- package/blazorGlobalSrc/editor-manager/base.d.ts +0 -8
- package/blazorGlobalSrc/editor-manager/base.js +0 -10
- package/blazorGlobalSrc/editor-manager/index.d.ts +0 -5
- package/blazorGlobalSrc/editor-manager/index.js +0 -9
- package/blazorGlobalSrc/editor-manager/plugin/alignments.d.ts +0 -26
- package/blazorGlobalSrc/editor-manager/plugin/alignments.js +0 -105
- package/blazorGlobalSrc/editor-manager/plugin/audio.d.ts +0 -34
- package/blazorGlobalSrc/editor-manager/plugin/audio.js +0 -145
- package/blazorGlobalSrc/editor-manager/plugin/clearformat-exec.d.ts +0 -24
- package/blazorGlobalSrc/editor-manager/plugin/clearformat-exec.js +0 -47
- package/blazorGlobalSrc/editor-manager/plugin/clearformat.d.ts +0 -29
- package/blazorGlobalSrc/editor-manager/plugin/clearformat.js +0 -249
- package/blazorGlobalSrc/editor-manager/plugin/dom-node.d.ts +0 -351
- package/blazorGlobalSrc/editor-manager/plugin/dom-node.js +0 -737
- package/blazorGlobalSrc/editor-manager/plugin/dom-tree.d.ts +0 -84
- package/blazorGlobalSrc/editor-manager/plugin/dom-tree.js +0 -164
- package/blazorGlobalSrc/editor-manager/plugin/emoji-picker-action.d.ts +0 -10
- package/blazorGlobalSrc/editor-manager/plugin/emoji-picker-action.js +0 -86
- package/blazorGlobalSrc/editor-manager/plugin/format-painter-actions.d.ts +0 -47
- package/blazorGlobalSrc/editor-manager/plugin/format-painter-actions.js +0 -622
- package/blazorGlobalSrc/editor-manager/plugin/formats.d.ts +0 -43
- package/blazorGlobalSrc/editor-manager/plugin/formats.js +0 -597
- package/blazorGlobalSrc/editor-manager/plugin/image.d.ts +0 -48
- package/blazorGlobalSrc/editor-manager/plugin/image.js +0 -399
- package/blazorGlobalSrc/editor-manager/plugin/indents.d.ts +0 -24
- package/blazorGlobalSrc/editor-manager/plugin/indents.js +0 -106
- package/blazorGlobalSrc/editor-manager/plugin/insert-methods.d.ts +0 -48
- package/blazorGlobalSrc/editor-manager/plugin/insert-methods.js +0 -37
- package/blazorGlobalSrc/editor-manager/plugin/insert-text.d.ts +0 -22
- package/blazorGlobalSrc/editor-manager/plugin/insert-text.js +0 -36
- package/blazorGlobalSrc/editor-manager/plugin/inserthtml-exec.d.ts +0 -22
- package/blazorGlobalSrc/editor-manager/plugin/inserthtml-exec.js +0 -49
- package/blazorGlobalSrc/editor-manager/plugin/inserthtml.d.ts +0 -51
- package/blazorGlobalSrc/editor-manager/plugin/inserthtml.js +0 -985
- package/blazorGlobalSrc/editor-manager/plugin/isformatted.d.ts +0 -89
- package/blazorGlobalSrc/editor-manager/plugin/isformatted.js +0 -199
- package/blazorGlobalSrc/editor-manager/plugin/link.d.ts +0 -41
- package/blazorGlobalSrc/editor-manager/plugin/link.js +0 -550
- package/blazorGlobalSrc/editor-manager/plugin/lists.d.ts +0 -74
- package/blazorGlobalSrc/editor-manager/plugin/lists.js +0 -1503
- package/blazorGlobalSrc/editor-manager/plugin/ms-word-clean-up.d.ts +0 -61
- package/blazorGlobalSrc/editor-manager/plugin/ms-word-clean-up.js +0 -1136
- package/blazorGlobalSrc/editor-manager/plugin/nodecutter.d.ts +0 -64
- package/blazorGlobalSrc/editor-manager/plugin/nodecutter.js +0 -167
- package/blazorGlobalSrc/editor-manager/plugin/selection-commands.d.ts +0 -41
- package/blazorGlobalSrc/editor-manager/plugin/selection-commands.js +0 -1069
- package/blazorGlobalSrc/editor-manager/plugin/selection-exec.d.ts +0 -24
- package/blazorGlobalSrc/editor-manager/plugin/selection-exec.js +0 -49
- package/blazorGlobalSrc/editor-manager/plugin/table-selection.d.ts +0 -26
- package/blazorGlobalSrc/editor-manager/plugin/table-selection.js +0 -210
- package/blazorGlobalSrc/editor-manager/plugin/table.d.ts +0 -56
- package/blazorGlobalSrc/editor-manager/plugin/table.js +0 -1100
- package/blazorGlobalSrc/editor-manager/plugin/toolbar-status.d.ts +0 -39
- package/blazorGlobalSrc/editor-manager/plugin/toolbar-status.js +0 -384
- package/blazorGlobalSrc/editor-manager/plugin/undo.d.ts +0 -85
- package/blazorGlobalSrc/editor-manager/plugin/undo.js +0 -216
- package/blazorGlobalSrc/editor-manager/plugin/video.d.ts +0 -38
- package/blazorGlobalSrc/editor-manager/plugin/video.js +0 -311
- package/blazorGlobalSrc/editor-manager/plugin.d.ts +0 -27
- package/blazorGlobalSrc/editor-manager/plugin.js +0 -31
- package/blazorGlobalSrc/global.d.ts +0 -1
- package/blazorGlobalSrc/global.js +0 -3
- package/blazorGlobalSrc/index.d.ts +0 -8
- package/blazorGlobalSrc/index.js +0 -12
- package/blazorGlobalSrc/markdown-parser/base/constant.d.ts +0 -39
- package/blazorGlobalSrc/markdown-parser/base/constant.js +0 -10
- package/blazorGlobalSrc/markdown-parser/base/interface.d.ts +0 -169
- package/blazorGlobalSrc/markdown-parser/base/interface.js +0 -4
- package/blazorGlobalSrc/markdown-parser/base/markdown-parser.d.ts +0 -69
- package/blazorGlobalSrc/markdown-parser/base/markdown-parser.js +0 -87
- package/blazorGlobalSrc/markdown-parser/base/types.d.ts +0 -7
- package/blazorGlobalSrc/markdown-parser/base/types.js +0 -4
- package/blazorGlobalSrc/markdown-parser/base.d.ts +0 -7
- package/blazorGlobalSrc/markdown-parser/base.js +0 -9
- package/blazorGlobalSrc/markdown-parser/index.d.ts +0 -5
- package/blazorGlobalSrc/markdown-parser/index.js +0 -9
- package/blazorGlobalSrc/markdown-parser/plugin/clearformat.d.ts +0 -28
- package/blazorGlobalSrc/markdown-parser/plugin/clearformat.js +0 -110
- package/blazorGlobalSrc/markdown-parser/plugin/formats.d.ts +0 -32
- package/blazorGlobalSrc/markdown-parser/plugin/formats.js +0 -225
- package/blazorGlobalSrc/markdown-parser/plugin/insert-text.d.ts +0 -24
- package/blazorGlobalSrc/markdown-parser/plugin/insert-text.js +0 -49
- package/blazorGlobalSrc/markdown-parser/plugin/link.d.ts +0 -24
- package/blazorGlobalSrc/markdown-parser/plugin/link.js +0 -50
- package/blazorGlobalSrc/markdown-parser/plugin/lists.d.ts +0 -39
- package/blazorGlobalSrc/markdown-parser/plugin/lists.js +0 -462
- package/blazorGlobalSrc/markdown-parser/plugin/markdown-selection.d.ts +0 -140
- package/blazorGlobalSrc/markdown-parser/plugin/markdown-selection.js +0 -104
- package/blazorGlobalSrc/markdown-parser/plugin/md-selection-formats.d.ts +0 -31
- package/blazorGlobalSrc/markdown-parser/plugin/md-selection-formats.js +0 -335
- package/blazorGlobalSrc/markdown-parser/plugin/table.d.ts +0 -52
- package/blazorGlobalSrc/markdown-parser/plugin/table.js +0 -216
- package/blazorGlobalSrc/markdown-parser/plugin/undo.d.ts +0 -83
- package/blazorGlobalSrc/markdown-parser/plugin/undo.js +0 -147
- package/blazorGlobalSrc/markdown-parser/plugin.d.ts +0 -11
- package/blazorGlobalSrc/markdown-parser/plugin.js +0 -15
- package/blazorGlobalSrc/rich-text-editor/actions/base-quick-toolbar.d.ts +0 -114
- package/blazorGlobalSrc/rich-text-editor/actions/base-quick-toolbar.js +0 -465
- package/blazorGlobalSrc/rich-text-editor/actions/base-toolbar.d.ts +0 -58
- package/blazorGlobalSrc/rich-text-editor/actions/base-toolbar.js +0 -216
- package/blazorGlobalSrc/rich-text-editor/actions/color-picker.d.ts +0 -52
- package/blazorGlobalSrc/rich-text-editor/actions/color-picker.js +0 -241
- package/blazorGlobalSrc/rich-text-editor/actions/count.d.ts +0 -55
- package/blazorGlobalSrc/rich-text-editor/actions/count.js +0 -117
- package/blazorGlobalSrc/rich-text-editor/actions/dropdown-buttons.d.ts +0 -72
- package/blazorGlobalSrc/rich-text-editor/actions/dropdown-buttons.js +0 -552
- package/blazorGlobalSrc/rich-text-editor/actions/emoji-picker.d.ts +0 -51
- package/blazorGlobalSrc/rich-text-editor/actions/emoji-picker.js +0 -853
- package/blazorGlobalSrc/rich-text-editor/actions/enter-key.d.ts +0 -28
- package/blazorGlobalSrc/rich-text-editor/actions/enter-key.js +0 -821
- package/blazorGlobalSrc/rich-text-editor/actions/execute-command-callback.d.ts +0 -11
- package/blazorGlobalSrc/rich-text-editor/actions/execute-command-callback.js +0 -28
- package/blazorGlobalSrc/rich-text-editor/actions/file-manager.d.ts +0 -45
- package/blazorGlobalSrc/rich-text-editor/actions/file-manager.js +0 -249
- package/blazorGlobalSrc/rich-text-editor/actions/format-painter.d.ts +0 -25
- package/blazorGlobalSrc/rich-text-editor/actions/format-painter.js +0 -156
- package/blazorGlobalSrc/rich-text-editor/actions/full-screen.d.ts +0 -40
- package/blazorGlobalSrc/rich-text-editor/actions/full-screen.js +0 -148
- package/blazorGlobalSrc/rich-text-editor/actions/html-attributes.d.ts +0 -15
- package/blazorGlobalSrc/rich-text-editor/actions/html-attributes.js +0 -50
- package/blazorGlobalSrc/rich-text-editor/actions/html-editor.d.ts +0 -120
- package/blazorGlobalSrc/rich-text-editor/actions/html-editor.js +0 -1244
- package/blazorGlobalSrc/rich-text-editor/actions/html-toolbar-status.d.ts +0 -14
- package/blazorGlobalSrc/rich-text-editor/actions/html-toolbar-status.js +0 -47
- package/blazorGlobalSrc/rich-text-editor/actions/import-export.d.ts +0 -21
- package/blazorGlobalSrc/rich-text-editor/actions/import-export.js +0 -117
- package/blazorGlobalSrc/rich-text-editor/actions/keyboard-model.d.ts +0 -30
- package/blazorGlobalSrc/rich-text-editor/actions/keyboard.d.ts +0 -110
- package/blazorGlobalSrc/rich-text-editor/actions/keyboard.js +0 -163
- package/blazorGlobalSrc/rich-text-editor/actions/markdown-editor.d.ts +0 -66
- package/blazorGlobalSrc/rich-text-editor/actions/markdown-editor.js +0 -142
- package/blazorGlobalSrc/rich-text-editor/actions/markdown-toolbar-status.d.ts +0 -23
- package/blazorGlobalSrc/rich-text-editor/actions/markdown-toolbar-status.js +0 -124
- package/blazorGlobalSrc/rich-text-editor/actions/paste-clean-up.d.ts +0 -86
- package/blazorGlobalSrc/rich-text-editor/actions/paste-clean-up.js +0 -1071
- package/blazorGlobalSrc/rich-text-editor/actions/quick-toolbar.d.ts +0 -151
- package/blazorGlobalSrc/rich-text-editor/actions/quick-toolbar.js +0 -548
- package/blazorGlobalSrc/rich-text-editor/actions/resize.d.ts +0 -37
- package/blazorGlobalSrc/rich-text-editor/actions/resize.js +0 -188
- package/blazorGlobalSrc/rich-text-editor/actions/sanitize-helper.d.ts +0 -11
- package/blazorGlobalSrc/rich-text-editor/actions/sanitize-helper.js +0 -168
- package/blazorGlobalSrc/rich-text-editor/actions/toolbar-action.d.ts +0 -18
- package/blazorGlobalSrc/rich-text-editor/actions/toolbar-action.js +0 -76
- package/blazorGlobalSrc/rich-text-editor/actions/toolbar.d.ts +0 -185
- package/blazorGlobalSrc/rich-text-editor/actions/toolbar.js +0 -512
- package/blazorGlobalSrc/rich-text-editor/actions/xhtml-validation.d.ts +0 -25
- package/blazorGlobalSrc/rich-text-editor/actions/xhtml-validation.js +0 -166
- package/blazorGlobalSrc/rich-text-editor/actions.d.ts +0 -26
- package/blazorGlobalSrc/rich-text-editor/actions.js +0 -30
- package/blazorGlobalSrc/rich-text-editor/audio.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor/audio.js +0 -8
- package/blazorGlobalSrc/rich-text-editor/base/classes.d.ts +0 -628
- package/blazorGlobalSrc/rich-text-editor/base/classes.js +0 -129
- package/blazorGlobalSrc/rich-text-editor/base/constant.d.ts +0 -808
- package/blazorGlobalSrc/rich-text-editor/base/constant.js +0 -334
- package/blazorGlobalSrc/rich-text-editor/base/enum.d.ts +0 -81
- package/blazorGlobalSrc/rich-text-editor/base/enum.js +0 -37
- package/blazorGlobalSrc/rich-text-editor/base/interface.d.ts +0 -1577
- package/blazorGlobalSrc/rich-text-editor/base/interface.js +0 -194
- package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor-model.d.ts +0 -1032
- package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor.d.ts +0 -1699
- package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor.js +0 -2645
- package/blazorGlobalSrc/rich-text-editor/base/util.d.ts +0 -212
- package/blazorGlobalSrc/rich-text-editor/base/util.js +0 -610
- package/blazorGlobalSrc/rich-text-editor/base.d.ts +0 -10
- package/blazorGlobalSrc/rich-text-editor/base.js +0 -13
- package/blazorGlobalSrc/rich-text-editor/formatter/formatter.d.ts +0 -87
- package/blazorGlobalSrc/rich-text-editor/formatter/formatter.js +0 -223
- package/blazorGlobalSrc/rich-text-editor/formatter/html-formatter.d.ts +0 -34
- package/blazorGlobalSrc/rich-text-editor/formatter/html-formatter.js +0 -44
- package/blazorGlobalSrc/rich-text-editor/formatter/markdown-formatter.d.ts +0 -39
- package/blazorGlobalSrc/rich-text-editor/formatter/markdown-formatter.js +0 -48
- package/blazorGlobalSrc/rich-text-editor/formatter.d.ts +0 -6
- package/blazorGlobalSrc/rich-text-editor/formatter.js +0 -10
- package/blazorGlobalSrc/rich-text-editor/html-editor.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor/html-editor.js +0 -8
- package/blazorGlobalSrc/rich-text-editor/image.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor/image.js +0 -8
- package/blazorGlobalSrc/rich-text-editor/index.d.ts +0 -9
- package/blazorGlobalSrc/rich-text-editor/index.js +0 -12
- package/blazorGlobalSrc/rich-text-editor/link.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor/link.js +0 -8
- package/blazorGlobalSrc/rich-text-editor/markdown-editor.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor/markdown-editor.js +0 -8
- package/blazorGlobalSrc/rich-text-editor/models/default-locale.d.ts +0 -25
- package/blazorGlobalSrc/rich-text-editor/models/default-locale.js +0 -391
- package/blazorGlobalSrc/rich-text-editor/models/iframe-settings-model.d.ts +0 -68
- package/blazorGlobalSrc/rich-text-editor/models/iframe-settings.d.ts +0 -61
- package/blazorGlobalSrc/rich-text-editor/models/iframe-settings.js +0 -60
- package/blazorGlobalSrc/rich-text-editor/models/inline-mode-model.d.ts +0 -24
- package/blazorGlobalSrc/rich-text-editor/models/inline-mode.d.ts +0 -20
- package/blazorGlobalSrc/rich-text-editor/models/inline-mode.js +0 -37
- package/blazorGlobalSrc/rich-text-editor/models/items.d.ts +0 -36
- package/blazorGlobalSrc/rich-text-editor/models/items.js +0 -1011
- package/blazorGlobalSrc/rich-text-editor/models/models.d.ts +0 -7
- package/blazorGlobalSrc/rich-text-editor/models/models.js +0 -4
- package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings-model.d.ts +0 -40
- package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings.d.ts +0 -50
- package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings.js +0 -143
- package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings-model.d.ts +0 -1130
- package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings.d.ts +0 -992
- package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings.js +0 -510
- package/blazorGlobalSrc/rich-text-editor/models.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor/models.js +0 -4
- package/blazorGlobalSrc/rich-text-editor/quick-toolbar.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor/quick-toolbar.js +0 -8
- package/blazorGlobalSrc/rich-text-editor/renderer/audio-module.d.ts +0 -82
- package/blazorGlobalSrc/rich-text-editor/renderer/audio-module.js +0 -886
- package/blazorGlobalSrc/rich-text-editor/renderer/content-renderer.d.ts +0 -65
- package/blazorGlobalSrc/rich-text-editor/renderer/content-renderer.js +0 -49
- package/blazorGlobalSrc/rich-text-editor/renderer/dialog-renderer.d.ts +0 -39
- package/blazorGlobalSrc/rich-text-editor/renderer/dialog-renderer.js +0 -111
- package/blazorGlobalSrc/rich-text-editor/renderer/iframe-content-renderer.d.ts +0 -33
- package/blazorGlobalSrc/rich-text-editor/renderer/iframe-content-renderer.js +0 -101
- package/blazorGlobalSrc/rich-text-editor/renderer/image-module.d.ts +0 -199
- package/blazorGlobalSrc/rich-text-editor/renderer/image-module.js +0 -2494
- package/blazorGlobalSrc/rich-text-editor/renderer/link-module.d.ts +0 -63
- package/blazorGlobalSrc/rich-text-editor/renderer/link-module.js +0 -596
- package/blazorGlobalSrc/rich-text-editor/renderer/markdown-renderer.d.ts +0 -65
- package/blazorGlobalSrc/rich-text-editor/renderer/markdown-renderer.js +0 -38
- package/blazorGlobalSrc/rich-text-editor/renderer/popup-renderer.d.ts +0 -54
- package/blazorGlobalSrc/rich-text-editor/renderer/popup-renderer.js +0 -35
- package/blazorGlobalSrc/rich-text-editor/renderer/render.d.ts +0 -46
- package/blazorGlobalSrc/rich-text-editor/renderer/render.js +0 -70
- package/blazorGlobalSrc/rich-text-editor/renderer/slash-menu.d.ts +0 -20
- package/blazorGlobalSrc/rich-text-editor/renderer/slash-menu.js +0 -224
- package/blazorGlobalSrc/rich-text-editor/renderer/table-module.d.ts +0 -155
- package/blazorGlobalSrc/rich-text-editor/renderer/table-module.js +0 -2206
- package/blazorGlobalSrc/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -131
- package/blazorGlobalSrc/rich-text-editor/renderer/toolbar-renderer.js +0 -747
- package/blazorGlobalSrc/rich-text-editor/renderer/video-module.d.ts +0 -120
- package/blazorGlobalSrc/rich-text-editor/renderer/video-module.js +0 -1507
- package/blazorGlobalSrc/rich-text-editor/renderer/view-source.d.ts +0 -74
- package/blazorGlobalSrc/rich-text-editor/renderer/view-source.js +0 -225
- package/blazorGlobalSrc/rich-text-editor/renderer.d.ts +0 -17
- package/blazorGlobalSrc/rich-text-editor/renderer.js +0 -21
- package/blazorGlobalSrc/rich-text-editor/services/renderer-factory.d.ts +0 -33
- package/blazorGlobalSrc/rich-text-editor/services/renderer-factory.js +0 -29
- package/blazorGlobalSrc/rich-text-editor/services/service-locator.d.ts +0 -29
- package/blazorGlobalSrc/rich-text-editor/services/service-locator.js +0 -25
- package/blazorGlobalSrc/rich-text-editor/services.d.ts +0 -5
- package/blazorGlobalSrc/rich-text-editor/services.js +0 -9
- package/blazorGlobalSrc/rich-text-editor/toolbar.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor/toolbar.js +0 -8
- package/blazorGlobalSrc/rich-text-editor/video.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor/video.js +0 -8
- package/blazorGlobalSrc/rich-text-editor.d.ts +0 -4
- package/blazorGlobalSrc/rich-text-editor.js +0 -8
- package/blazorGlobalSrc/selection/index.d.ts +0 -4
- package/blazorGlobalSrc/selection/index.js +0 -8
- package/blazorGlobalSrc/selection/selection.d.ts +0 -244
- package/blazorGlobalSrc/selection/selection.js +0 -309
- package/helpers/e2e/index.d.ts +0 -1
- package/helpers/e2e/index.js +0 -8
- package/helpers/e2e/rte-helper.d.ts +0 -79
- package/helpers/e2e/rte-helper.js +0 -81
- package/src/global.d.ts +0 -1
- package/tslint.json +0 -111
|
@@ -1,1136 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "../../common/constant", "@syncfusion/ej2-base", "../base/constant", "./insert-methods"], function (require, exports, EVENTS, ej2_base_1, constant_1, insert_methods_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
var MsWordPaste = (function () {
|
|
5
|
-
function MsWordPaste(parent) {
|
|
6
|
-
this.olData = [
|
|
7
|
-
'decimal',
|
|
8
|
-
'decimal-leading-zero',
|
|
9
|
-
'lower-alpha',
|
|
10
|
-
'lower-roman',
|
|
11
|
-
'upper-alpha',
|
|
12
|
-
'upper-roman',
|
|
13
|
-
'lower-greek'
|
|
14
|
-
];
|
|
15
|
-
this.ulData = [
|
|
16
|
-
'disc',
|
|
17
|
-
'square',
|
|
18
|
-
'circle',
|
|
19
|
-
'disc',
|
|
20
|
-
'square',
|
|
21
|
-
'circle'
|
|
22
|
-
];
|
|
23
|
-
this.ignorableNodes = ['A', 'APPLET', 'B', 'BLOCKQUOTE', 'BR',
|
|
24
|
-
'BUTTON', 'CENTER', 'CODE', 'COL', 'COLGROUP', 'DD', 'DEL', 'DFN', 'DIR', 'DIV',
|
|
25
|
-
'DL', 'DT', 'EM', 'FIELDSET', 'FONT', 'FORM', 'FRAME', 'FRAMESET', 'H1', 'H2',
|
|
26
|
-
'H3', 'H4', 'H5', 'H6', 'HR', 'I', 'IMG', 'IFRAME', 'INPUT', 'INS', 'LABEL',
|
|
27
|
-
'LI', 'OL', 'OPTION', 'P', 'PARAM', 'PRE', 'Q', 'S', 'SELECT', 'SPAN', 'STRIKE',
|
|
28
|
-
'STRONG', 'SUB', 'SUP', 'TABLE', 'TBODY', 'TD', 'TEXTAREA', 'TFOOT', 'TH',
|
|
29
|
-
'THEAD', 'TITLE', 'TR', 'TT', 'U', 'UL'];
|
|
30
|
-
this.blockNode = ['div', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
|
|
31
|
-
'address', 'blockquote', 'button', 'center', 'dd', 'dir', 'dl', 'dt', 'fieldset',
|
|
32
|
-
'frameset', 'hr', 'iframe', 'isindex', 'li', 'map', 'menu', 'noframes', 'noscript',
|
|
33
|
-
'object', 'ol', 'pre', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'ul',
|
|
34
|
-
'header', 'article', 'nav', 'footer', 'section', 'aside', 'main', 'figure', 'figcaption'];
|
|
35
|
-
this.borderStyle = ['border-top', 'border-right', 'border-bottom', 'border-left'];
|
|
36
|
-
this.upperRomanNumber = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX',
|
|
37
|
-
'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX'];
|
|
38
|
-
this.lowerRomanNumber = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix',
|
|
39
|
-
'x', 'xi', 'xii', 'xiii', 'xiv', 'xv', 'xvi', 'xvii', 'xviii', 'xix', 'xx'];
|
|
40
|
-
this.lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
|
|
41
|
-
'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
|
|
42
|
-
this.removableElements = ['o:p', 'style', 'w:sdt'];
|
|
43
|
-
this.listContents = [];
|
|
44
|
-
this.cropImageDimensions = [];
|
|
45
|
-
this.parent = parent;
|
|
46
|
-
this.addEventListener();
|
|
47
|
-
}
|
|
48
|
-
MsWordPaste.prototype.addEventListener = function () {
|
|
49
|
-
this.parent.observer.on(EVENTS.MS_WORD_CLEANUP_PLUGIN, this.wordCleanup, this);
|
|
50
|
-
this.parent.observer.on(EVENTS.INTERNAL_DESTROY, this.destroy, this);
|
|
51
|
-
};
|
|
52
|
-
MsWordPaste.prototype.removeEventListener = function () {
|
|
53
|
-
this.parent.observer.off(EVENTS.MS_WORD_CLEANUP_PLUGIN, this.wordCleanup);
|
|
54
|
-
this.parent.observer.off(EVENTS.INTERNAL_DESTROY, this.destroy);
|
|
55
|
-
};
|
|
56
|
-
MsWordPaste.prototype.wordCleanup = function (e) {
|
|
57
|
-
var wordPasteStyleConfig = !ej2_base_1.isNullOrUndefined(e.allowedStylePropertiesArray) ? e.allowedStylePropertiesArray : [];
|
|
58
|
-
var listNodes = [];
|
|
59
|
-
var tempHTMLContent = e.args.clipboardData.getData('text/HTML');
|
|
60
|
-
var rtfData = e.args.clipboardData.getData('text/rtf');
|
|
61
|
-
var elm = ej2_base_1.createElement('p');
|
|
62
|
-
elm.setAttribute('id', 'MSWord-Content');
|
|
63
|
-
elm.innerHTML = tempHTMLContent;
|
|
64
|
-
this.addDoubleBr(elm);
|
|
65
|
-
var patern = /class='?Mso|style='[^ ]*\bmso-/i;
|
|
66
|
-
var patern2 = /class="?Mso|style="[^ ]*\bmso-/i;
|
|
67
|
-
var patern3 = /(class="?Mso|class='?Mso|class="?Xl|class='?Xl|class=Xl|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument)/gi;
|
|
68
|
-
var pattern4 = /style='mso-width-source:/i;
|
|
69
|
-
var source = this.findSource(elm);
|
|
70
|
-
if (patern.test(tempHTMLContent) || patern2.test(tempHTMLContent) || patern3.test(tempHTMLContent) ||
|
|
71
|
-
pattern4.test(tempHTMLContent)) {
|
|
72
|
-
tempHTMLContent = tempHTMLContent.replace(/<img[^>]+>/i, '');
|
|
73
|
-
this.addListClass(elm);
|
|
74
|
-
listNodes = this.cleanUp(elm, listNodes);
|
|
75
|
-
if (!ej2_base_1.isNullOrUndefined(listNodes[0]) && listNodes[0].parentElement.tagName !== 'UL' &&
|
|
76
|
-
listNodes[0].parentElement.tagName !== 'OL') {
|
|
77
|
-
this.listConverter(listNodes);
|
|
78
|
-
}
|
|
79
|
-
this.imageConversion(elm, rtfData);
|
|
80
|
-
this.cleanList(elm, 'UL');
|
|
81
|
-
this.cleanList(elm, 'OL');
|
|
82
|
-
this.styleCorrection(elm, wordPasteStyleConfig);
|
|
83
|
-
this.removingComments(elm);
|
|
84
|
-
this.removeUnwantedElements(elm);
|
|
85
|
-
this.removeEmptyElements(elm);
|
|
86
|
-
this.removeEmptyAnchorTag(elm);
|
|
87
|
-
this.breakLineAddition(elm);
|
|
88
|
-
this.processMargin(elm);
|
|
89
|
-
this.removeClassName(elm);
|
|
90
|
-
if (pattern4.test(tempHTMLContent)) {
|
|
91
|
-
this.addTableBorderClass(elm);
|
|
92
|
-
}
|
|
93
|
-
e.callBack(elm.innerHTML, this.cropImageDimensions, source);
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
if (source === constant_1.PASTE_SOURCE[2]) {
|
|
97
|
-
this.handleOneNoteContent(elm);
|
|
98
|
-
}
|
|
99
|
-
this.removeEmptyMetaTags(elm);
|
|
100
|
-
e.callBack(elm.innerHTML, null, source);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
MsWordPaste.prototype.addDoubleBr = function (elm) {
|
|
104
|
-
var newline = elm.querySelector('.Apple-interchange-newline');
|
|
105
|
-
if (!ej2_base_1.isNullOrUndefined(newline) && ej2_base_1.Browser.userAgent.indexOf('Chrome') !== -1 && newline.parentElement.nodeName === 'P' && elm !== newline.parentElement) {
|
|
106
|
-
for (var i = 0; i < elm.childNodes.length; i++) {
|
|
107
|
-
var node = elm.childNodes[i];
|
|
108
|
-
if (node.nodeType === Node.COMMENT_NODE && node.nodeValue.includes('StartFragment')) {
|
|
109
|
-
var newElement = document.createElement('p');
|
|
110
|
-
newElement.innerHTML = '<br>';
|
|
111
|
-
var cssText = newline.parentElement.style.cssText;
|
|
112
|
-
var currentStyle = newElement.getAttribute('style') || '';
|
|
113
|
-
var newStyle = currentStyle + cssText;
|
|
114
|
-
newElement.style.cssText = newStyle;
|
|
115
|
-
elm.insertBefore(newElement, node.nextSibling);
|
|
116
|
-
ej2_base_1.detach(newline);
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
MsWordPaste.prototype.cleanList = function (elm, listTag) {
|
|
123
|
-
var replacableElem = elm.querySelectorAll(listTag + ' div');
|
|
124
|
-
for (var j = replacableElem.length - 1; j >= 0; j--) {
|
|
125
|
-
var parentElem = replacableElem[j].parentNode;
|
|
126
|
-
while (replacableElem[j].firstChild) {
|
|
127
|
-
parentElem.insertBefore(replacableElem[j].firstChild, replacableElem[j]);
|
|
128
|
-
}
|
|
129
|
-
var closestListElem = this.findClosestListElem(replacableElem[j]);
|
|
130
|
-
if (closestListElem) {
|
|
131
|
-
this.insertAfter(replacableElem[j], closestListElem);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
MsWordPaste.prototype.insertAfter = function (newNode, referenceNode) {
|
|
136
|
-
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
|
137
|
-
};
|
|
138
|
-
MsWordPaste.prototype.findClosestListElem = function (listElem) {
|
|
139
|
-
var closestListElem;
|
|
140
|
-
while (!ej2_base_1.isNullOrUndefined(listElem)) {
|
|
141
|
-
listElem = !ej2_base_1.isNullOrUndefined(listElem.closest('ul')) && listElem.tagName !== 'UL' ?
|
|
142
|
-
listElem.closest('ul') : (listElem.tagName !== 'OL' ? listElem.closest('ol') : null);
|
|
143
|
-
closestListElem = !ej2_base_1.isNullOrUndefined(listElem) ? listElem : closestListElem;
|
|
144
|
-
}
|
|
145
|
-
return closestListElem;
|
|
146
|
-
};
|
|
147
|
-
MsWordPaste.prototype.addListClass = function (elm) {
|
|
148
|
-
var allNodes = elm.querySelectorAll('*');
|
|
149
|
-
for (var index = 0; index < allNodes.length; index++) {
|
|
150
|
-
if (!ej2_base_1.isNullOrUndefined(allNodes[index].getAttribute('style')) && allNodes[index].getAttribute('style').replace(/ /g, '').replace('\n', '').indexOf('mso-list:l') >= 0 &&
|
|
151
|
-
allNodes[index].className.toLowerCase().indexOf('msolistparagraph') === -1 &&
|
|
152
|
-
allNodes[index].tagName.charAt(0) !== 'H' && allNodes[index].tagName !== 'LI' &&
|
|
153
|
-
allNodes[index].tagName !== 'OL' && allNodes[index].tagName !== 'UL') {
|
|
154
|
-
allNodes[index].classList.add('msolistparagraph');
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
MsWordPaste.prototype.addTableBorderClass = function (elm) {
|
|
159
|
-
var allTableElm = elm.querySelectorAll('table');
|
|
160
|
-
var hasTableBorder = false;
|
|
161
|
-
for (var i = 0; i < allTableElm.length; i++) {
|
|
162
|
-
for (var j = 0; j < this.borderStyle.length; j++) {
|
|
163
|
-
if (allTableElm[i].innerHTML.indexOf(this.borderStyle[j]) >= 0) {
|
|
164
|
-
hasTableBorder = true;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
if (hasTableBorder) {
|
|
169
|
-
allTableElm[i].classList.add('e-rte-table-border');
|
|
170
|
-
hasTableBorder = false;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
MsWordPaste.prototype.imageConversion = function (elm, rtfData) {
|
|
175
|
-
this.checkVShape(elm);
|
|
176
|
-
var imgElem = elm.querySelectorAll('img');
|
|
177
|
-
for (var i = 0; i < imgElem.length; i++) {
|
|
178
|
-
if (!ej2_base_1.isNullOrUndefined(imgElem[i].getAttribute('v:shapes')) &&
|
|
179
|
-
imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 &&
|
|
180
|
-
imgElem[i].getAttribute('v:shapes').indexOf('Chart') < 0 &&
|
|
181
|
-
imgElem[i].getAttribute('v:shapes').indexOf('圖片') < 0 &&
|
|
182
|
-
imgElem[i].getAttribute('v:shapes').indexOf('Grafik') < 0 &&
|
|
183
|
-
imgElem[i].getAttribute('v:shapes').toLowerCase().indexOf('image') < 0 &&
|
|
184
|
-
imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0 &&
|
|
185
|
-
imgElem[i].getAttribute('v:shapes').indexOf('_x0000_s') < 0 &&
|
|
186
|
-
imgElem[i].getAttribute('v:shapes').indexOf('_x0000_i') < 0 &&
|
|
187
|
-
imgElem[i].getAttribute('v:shapes').indexOf('img1') < 0 &&
|
|
188
|
-
imgElem[i].getAttribute('v:shapes').indexOf('Immagine') < 0) {
|
|
189
|
-
imgElem[i].classList.add('e-rte-image-unsupported');
|
|
190
|
-
}
|
|
191
|
-
imgElem[i].removeAttribute('v:shapes');
|
|
192
|
-
}
|
|
193
|
-
imgElem = elm.querySelectorAll('img');
|
|
194
|
-
var imgSrc = [];
|
|
195
|
-
var base64Src = [];
|
|
196
|
-
var imgName = [];
|
|
197
|
-
var linkRegex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.)|(blob\:))(\S+))/gi);
|
|
198
|
-
if (imgElem.length > 0) {
|
|
199
|
-
for (var i = 0; i < imgElem.length; i++) {
|
|
200
|
-
if (!imgElem[i].classList.contains('e-rte-image-unsupported')) {
|
|
201
|
-
imgSrc.push(imgElem[i].getAttribute('src'));
|
|
202
|
-
var imageName = imgElem[i].getAttribute('src').split('/')[imgElem[i].getAttribute('src').split('/').length - 1].split('.')[0] + i;
|
|
203
|
-
imgName.push(imageName);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
var hexValue = this.hexConversion(rtfData);
|
|
207
|
-
for (var i = 0; i < hexValue.length; i++) {
|
|
208
|
-
base64Src.push({
|
|
209
|
-
base64Data: !ej2_base_1.isNullOrUndefined(hexValue[i].hex) ? this.convertToBase64(hexValue[i]) : null,
|
|
210
|
-
isCroppedImage: hexValue[i].isCroppedImage
|
|
211
|
-
});
|
|
212
|
-
if (hexValue[i].isCroppedImage) {
|
|
213
|
-
this.cropImageDimensions.push({
|
|
214
|
-
goalWidth: hexValue[i].goalWidth,
|
|
215
|
-
goalHeight: hexValue[i].goalHeight,
|
|
216
|
-
cropLength: hexValue[i].cropLength,
|
|
217
|
-
cropTop: hexValue[i].cropTop,
|
|
218
|
-
cropR: hexValue[i].cropR,
|
|
219
|
-
cropB: hexValue[i].cropB
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
imgElem = elm.querySelectorAll('img:not(.e-rte-image-unsupported');
|
|
224
|
-
for (var i = 0; i < imgElem.length; i++) {
|
|
225
|
-
if (imgSrc[i].match(linkRegex)) {
|
|
226
|
-
imgElem[i].setAttribute('src', imgSrc[i]);
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
if (!ej2_base_1.isNullOrUndefined(base64Src[i]) && !ej2_base_1.isNullOrUndefined(base64Src[i].base64Data)) {
|
|
230
|
-
imgElem[i].setAttribute('src', base64Src[i].base64Data);
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
imgElem[i].removeAttribute('src');
|
|
234
|
-
imgElem[i].classList.add('e-rte-image-unsupported');
|
|
235
|
-
}
|
|
236
|
-
if (!ej2_base_1.isNullOrUndefined(base64Src[i]) && base64Src[i].isCroppedImage) {
|
|
237
|
-
imgElem[i].classList.add('e-img-cropped');
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
imgElem[i].setAttribute('id', 'msWordImg-' + imgName[i]);
|
|
241
|
-
}
|
|
242
|
-
imgElem = elm.querySelectorAll('.e-rte-image-unsupported');
|
|
243
|
-
for (var i = 0; i < imgElem.length; i++) {
|
|
244
|
-
imgElem[i].removeAttribute('src');
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
MsWordPaste.prototype.checkVShape = function (elm) {
|
|
249
|
-
var allNodes = elm.querySelectorAll('*');
|
|
250
|
-
for (var i = 0; i < allNodes.length; i++) {
|
|
251
|
-
switch (allNodes[i].nodeName) {
|
|
252
|
-
case 'V:SHAPETYPE':
|
|
253
|
-
ej2_base_1.detach(allNodes[i]);
|
|
254
|
-
break;
|
|
255
|
-
case 'V:SHAPE':
|
|
256
|
-
if (allNodes[i].firstElementChild.nodeName === 'V:IMAGEDATA') {
|
|
257
|
-
var src = allNodes[i].firstElementChild.getAttribute('src');
|
|
258
|
-
var imgElement = ej2_base_1.createElement('img');
|
|
259
|
-
imgElement.setAttribute('src', src);
|
|
260
|
-
allNodes[i].parentElement.insertBefore(imgElement, allNodes[i]);
|
|
261
|
-
ej2_base_1.detach(allNodes[i]);
|
|
262
|
-
}
|
|
263
|
-
break;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
MsWordPaste.prototype.convertToBase64 = function (hexValue) {
|
|
268
|
-
var byteArr = this.conHexStringToBytes(hexValue.hex);
|
|
269
|
-
var base64String = this.conBytesToBase64(byteArr);
|
|
270
|
-
var base64 = hexValue.type ? 'data:' + hexValue.type + ';base64,' + base64String : null;
|
|
271
|
-
return base64;
|
|
272
|
-
};
|
|
273
|
-
MsWordPaste.prototype.conBytesToBase64 = function (byteArr) {
|
|
274
|
-
var base64Str = '';
|
|
275
|
-
var base64Char = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
276
|
-
var byteArrLen = byteArr.length;
|
|
277
|
-
for (var i = 0; i < byteArrLen; i += 3) {
|
|
278
|
-
var array3 = byteArr.slice(i, i + 3);
|
|
279
|
-
var array3length = array3.length;
|
|
280
|
-
var array4 = [];
|
|
281
|
-
if (array3length < 3) {
|
|
282
|
-
for (var j = array3length; j < 3; j++) {
|
|
283
|
-
array3[j] = 0;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
array4[0] = (array3[0] & 0xFC) >> 2;
|
|
287
|
-
array4[1] = ((array3[0] & 0x03) << 4) | (array3[1] >> 4);
|
|
288
|
-
array4[2] = ((array3[1] & 0x0F) << 2) | ((array3[2] & 0xC0) >> 6);
|
|
289
|
-
array4[3] = array3[2] & 0x3F;
|
|
290
|
-
for (var j = 0; j < 4; j++) {
|
|
291
|
-
if (j <= array3length) {
|
|
292
|
-
base64Str += base64Char.charAt(array4[j]);
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
base64Str += '=';
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
return base64Str;
|
|
300
|
-
};
|
|
301
|
-
MsWordPaste.prototype.conHexStringToBytes = function (hex) {
|
|
302
|
-
var byteArr = [];
|
|
303
|
-
var byteArrLen = hex.length / 2;
|
|
304
|
-
for (var i = 0; i < byteArrLen; i++) {
|
|
305
|
-
byteArr.push(parseInt(hex.substr(i * 2, 2), 16));
|
|
306
|
-
}
|
|
307
|
-
return byteArr;
|
|
308
|
-
};
|
|
309
|
-
MsWordPaste.prototype.hexConversion = function (rtfData) {
|
|
310
|
-
var regExp = RegExp;
|
|
311
|
-
var picHead = new regExp('\\{\\\\pict[\\s\\S]+?\\\\bliptag-?\\d+(\\\\blipupi-?\\d+)?(\\{\\\\\\*\\\\blipuid\\s?[\\da-fA-F]+)?[\\s\\}]*?');
|
|
312
|
-
var pic = new regExp('(?:(' + picHead.source + '))([\\da-fA-F\\s]+)\\}', 'g');
|
|
313
|
-
var fullImg = rtfData.match(pic);
|
|
314
|
-
var imgType;
|
|
315
|
-
var result = [];
|
|
316
|
-
if (!ej2_base_1.isNullOrUndefined(fullImg)) {
|
|
317
|
-
for (var i = 0; i < fullImg.length; i++) {
|
|
318
|
-
if (fullImg[i].indexOf('fIsBullet') !== -1 && fullImg[i].indexOf('wzName') === -1) {
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
var isCroppedImage = false;
|
|
322
|
-
var goalWidth = 0;
|
|
323
|
-
var goalHeight = 0;
|
|
324
|
-
var cropLength = 0;
|
|
325
|
-
var cropTop = 0;
|
|
326
|
-
var cropR = 0;
|
|
327
|
-
var cropB = 0;
|
|
328
|
-
if (picHead.test(fullImg[i])) {
|
|
329
|
-
if (fullImg[i].indexOf('\\pngblip') !== -1) {
|
|
330
|
-
imgType = 'image/png';
|
|
331
|
-
}
|
|
332
|
-
else if (fullImg[i].indexOf('\\jpegblip') !== -1) {
|
|
333
|
-
imgType = 'image/jpeg';
|
|
334
|
-
}
|
|
335
|
-
else if (fullImg[i].indexOf('\\emfblip') !== -1) {
|
|
336
|
-
imgType = null;
|
|
337
|
-
}
|
|
338
|
-
else {
|
|
339
|
-
continue;
|
|
340
|
-
}
|
|
341
|
-
isCroppedImage = ((this.extractCropValue('cropl', fullImg[i]) > 0 &&
|
|
342
|
-
this.extractCropValue('cropt', fullImg[i]) > 0) ||
|
|
343
|
-
this.extractCropValue('cropr', fullImg[i]) > 0 ||
|
|
344
|
-
this.extractCropValue('cropb', fullImg[i])) ? true : false;
|
|
345
|
-
if (isCroppedImage) {
|
|
346
|
-
goalWidth = this.extractCropValue('wgoal', fullImg[i]);
|
|
347
|
-
goalHeight = this.extractCropValue('hgoal', fullImg[i]);
|
|
348
|
-
cropLength = this.extractCropValue('cropl', fullImg[i]);
|
|
349
|
-
cropTop = this.extractCropValue('cropt', fullImg[i]);
|
|
350
|
-
cropR = this.extractCropValue('cropr', fullImg[i]);
|
|
351
|
-
cropB = this.extractCropValue('cropb', fullImg[i]);
|
|
352
|
-
}
|
|
353
|
-
result.push({
|
|
354
|
-
hex: imgType ? fullImg[i].replace(picHead, '').replace(/[^\da-fA-F]/g, '') : null,
|
|
355
|
-
type: imgType,
|
|
356
|
-
isCroppedImage: isCroppedImage,
|
|
357
|
-
goalWidth: goalWidth,
|
|
358
|
-
goalHeight: goalHeight,
|
|
359
|
-
cropLength: cropLength,
|
|
360
|
-
cropTop: cropTop,
|
|
361
|
-
cropR: cropR,
|
|
362
|
-
cropB: cropB
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
return result;
|
|
368
|
-
};
|
|
369
|
-
MsWordPaste.prototype.extractCropValue = function (crop, rtfData) {
|
|
370
|
-
var regExp = RegExp;
|
|
371
|
-
var result = new regExp('\\\\pic' + crop + '(\\-?\\d+)\\\\').exec(rtfData.replace(/\r\n\\/g, '\\').replace(/\n/g, '\\'))[1];
|
|
372
|
-
return parseInt(result, 10);
|
|
373
|
-
};
|
|
374
|
-
MsWordPaste.prototype.removeClassName = function (elm) {
|
|
375
|
-
var elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped):not(.e-rte-image-unsupported)');
|
|
376
|
-
for (var i = 0; i < elmWithClass.length; i++) {
|
|
377
|
-
elmWithClass[i].removeAttribute('class');
|
|
378
|
-
}
|
|
379
|
-
};
|
|
380
|
-
MsWordPaste.prototype.breakLineAddition = function (elm) {
|
|
381
|
-
var allElements = elm.querySelectorAll('*');
|
|
382
|
-
for (var i = 0; i < allElements.length; i++) {
|
|
383
|
-
if (allElements[i].children.length === 0 && allElements[i].innerHTML === ' ' &&
|
|
384
|
-
(allElements[i].innerHTML === ' ' && !allElements[i].closest('li')) &&
|
|
385
|
-
!allElements[i].closest('td') && (allElements[i].nodeName !== 'SPAN' ||
|
|
386
|
-
allElements[i].nodeName === 'SPAN' && (ej2_base_1.isNullOrUndefined(allElements[i].previousElementSibling) &&
|
|
387
|
-
ej2_base_1.isNullOrUndefined(allElements[i].nextElementSibling)))) {
|
|
388
|
-
var detachableElement = this.findDetachElem(allElements[i]);
|
|
389
|
-
var brElement = ej2_base_1.createElement('br');
|
|
390
|
-
var hasNbsp = detachableElement.textContent.length > 0 && detachableElement.textContent.match(/\u00a0/g)
|
|
391
|
-
&& detachableElement.textContent.match(/\u00a0/g).length > 0;
|
|
392
|
-
if (!hasNbsp && !ej2_base_1.isNullOrUndefined(detachableElement.parentElement)) {
|
|
393
|
-
detachableElement.parentElement.insertBefore(brElement, detachableElement);
|
|
394
|
-
ej2_base_1.detach(detachableElement);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
};
|
|
399
|
-
MsWordPaste.prototype.findDetachElem = function (element) {
|
|
400
|
-
var removableElement;
|
|
401
|
-
if (!ej2_base_1.isNullOrUndefined(element.parentElement) &&
|
|
402
|
-
element.parentElement.textContent.trim() === '' && element.parentElement.tagName !== 'TD' &&
|
|
403
|
-
ej2_base_1.isNullOrUndefined(element.parentElement.querySelector('img'))) {
|
|
404
|
-
removableElement = this.findDetachElem(element.parentElement);
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
removableElement = element;
|
|
408
|
-
}
|
|
409
|
-
return removableElement;
|
|
410
|
-
};
|
|
411
|
-
MsWordPaste.prototype.removeUnwantedElements = function (elm) {
|
|
412
|
-
var styleElm = elm.querySelector('style');
|
|
413
|
-
if (!ej2_base_1.isNullOrUndefined(styleElm)) {
|
|
414
|
-
ej2_base_1.detach(styleElm);
|
|
415
|
-
}
|
|
416
|
-
var innerElement = elm.innerHTML;
|
|
417
|
-
for (var i = 0; i < this.removableElements.length; i++) {
|
|
418
|
-
var regExp = RegExp;
|
|
419
|
-
var regExpStartElem = new regExp('<' + this.removableElements[i] + '\\s*[^>]*>', 'g');
|
|
420
|
-
var regExpEndElem = new regExp('</' + this.removableElements[i] + '>', 'g');
|
|
421
|
-
innerElement = innerElement.replace(regExpStartElem, '');
|
|
422
|
-
innerElement = innerElement.replace(regExpEndElem, '');
|
|
423
|
-
}
|
|
424
|
-
elm.innerHTML = innerElement;
|
|
425
|
-
elm.querySelectorAll(':empty');
|
|
426
|
-
};
|
|
427
|
-
MsWordPaste.prototype.findDetachEmptyElem = function (element) {
|
|
428
|
-
var removableElement;
|
|
429
|
-
if (!ej2_base_1.isNullOrUndefined(element.parentElement)) {
|
|
430
|
-
var hasNbsp = element.parentElement.textContent.length > 0 && element.parentElement.textContent.match(/\u00a0/g)
|
|
431
|
-
&& element.parentElement.textContent.match(/\u00a0/g).length > 0;
|
|
432
|
-
if (!hasNbsp && element.parentElement.textContent.trim() === '' &&
|
|
433
|
-
element.parentElement.getAttribute('id') !== 'MSWord-Content' &&
|
|
434
|
-
!(this.hasParentWithClass(element, 'MsoListParagraph')) &&
|
|
435
|
-
ej2_base_1.isNullOrUndefined(element.parentElement.querySelector('img'))) {
|
|
436
|
-
removableElement = this.findDetachEmptyElem(element.parentElement);
|
|
437
|
-
}
|
|
438
|
-
else {
|
|
439
|
-
removableElement = element;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
else {
|
|
443
|
-
removableElement = null;
|
|
444
|
-
}
|
|
445
|
-
return removableElement;
|
|
446
|
-
};
|
|
447
|
-
MsWordPaste.prototype.hasParentWithClass = function (element, className) {
|
|
448
|
-
var currentParentElem = element.parentElement;
|
|
449
|
-
while (!ej2_base_1.isNullOrUndefined(currentParentElem)) {
|
|
450
|
-
if (currentParentElem.classList.contains(className)) {
|
|
451
|
-
return true;
|
|
452
|
-
}
|
|
453
|
-
currentParentElem = currentParentElem.parentElement;
|
|
454
|
-
}
|
|
455
|
-
return false;
|
|
456
|
-
};
|
|
457
|
-
MsWordPaste.prototype.removeEmptyElements = function (element) {
|
|
458
|
-
var emptyElements = element.querySelectorAll(':empty');
|
|
459
|
-
for (var i = 0; i < emptyElements.length; i++) {
|
|
460
|
-
if (!ej2_base_1.isNullOrUndefined(emptyElements[i].closest('td')) &&
|
|
461
|
-
!ej2_base_1.isNullOrUndefined(emptyElements[i].closest('td').querySelector('.MsoNormal'))) {
|
|
462
|
-
emptyElements[i].innerHTML = '-';
|
|
463
|
-
}
|
|
464
|
-
var lineWithDiv = true;
|
|
465
|
-
if (emptyElements[i].tagName === 'DIV') {
|
|
466
|
-
lineWithDiv = emptyElements[i].style.borderBottom === 'none' ||
|
|
467
|
-
emptyElements[i].style.borderBottom === '' ? true : false;
|
|
468
|
-
}
|
|
469
|
-
if (emptyElements[i].tagName !== 'IMG' && emptyElements[i].tagName !== 'BR' &&
|
|
470
|
-
emptyElements[i].tagName !== 'IFRAME' && emptyElements[i].tagName !== 'TD' &&
|
|
471
|
-
emptyElements[i].tagName !== 'HR' && lineWithDiv) {
|
|
472
|
-
var detachableElement = this.findDetachEmptyElem(emptyElements[i]);
|
|
473
|
-
if (!ej2_base_1.isNullOrUndefined(detachableElement)) {
|
|
474
|
-
ej2_base_1.detach(detachableElement);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
};
|
|
479
|
-
MsWordPaste.prototype.removeEmptyMetaTags = function (element) {
|
|
480
|
-
var metaTags = element.querySelectorAll('meta:empty');
|
|
481
|
-
for (var i = metaTags.length - 1; i >= 0; i--) {
|
|
482
|
-
var metaTag = metaTags[i];
|
|
483
|
-
if (metaTag.textContent === '') {
|
|
484
|
-
ej2_base_1.detach(metaTag);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
|
-
MsWordPaste.prototype.styleCorrection = function (elm, wordPasteStyleConfig) {
|
|
489
|
-
var styleElement = elm.querySelectorAll('style');
|
|
490
|
-
var styles = [];
|
|
491
|
-
if (styleElement.length > 0) {
|
|
492
|
-
if (!ej2_base_1.isNullOrUndefined(styleElement[0].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi))) {
|
|
493
|
-
styles = styleElement[0].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);
|
|
494
|
-
}
|
|
495
|
-
else if (styleElement.length > 1) {
|
|
496
|
-
styles = styleElement[1].innerHTML.match(/[\S ]+\s+{[\s\S]+?}/gi);
|
|
497
|
-
}
|
|
498
|
-
var styleClassObject_1 = !ej2_base_1.isNullOrUndefined(styles) ? this.findStyleObject(styles) : null;
|
|
499
|
-
if (!ej2_base_1.isNullOrUndefined(styleClassObject_1)) {
|
|
500
|
-
var keys = Object.keys(styleClassObject_1);
|
|
501
|
-
var values = keys.map(function (key) {
|
|
502
|
-
return styleClassObject_1["" + key];
|
|
503
|
-
});
|
|
504
|
-
values = this.removeUnwantedStyle(values, wordPasteStyleConfig);
|
|
505
|
-
this.filterStyles(elm, wordPasteStyleConfig);
|
|
506
|
-
var resultElem = void 0;
|
|
507
|
-
var fromClass = false;
|
|
508
|
-
var regex = /^(p|div|li)\.(1|10|11)$/;
|
|
509
|
-
for (var i = 0; i < keys.length; i++) {
|
|
510
|
-
if (keys[i].split('.')[0] === '') {
|
|
511
|
-
resultElem = elm.getElementsByClassName(keys[i].split('.')[1]);
|
|
512
|
-
fromClass = true;
|
|
513
|
-
}
|
|
514
|
-
else if ((keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') >= 0) || (regex.test(keys[i]))) {
|
|
515
|
-
continue;
|
|
516
|
-
}
|
|
517
|
-
else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') < 0) {
|
|
518
|
-
resultElem = elm.getElementsByTagName(keys[i]);
|
|
519
|
-
}
|
|
520
|
-
else {
|
|
521
|
-
resultElem = elm.querySelectorAll(keys[i]);
|
|
522
|
-
}
|
|
523
|
-
for (var j = 0; j < resultElem.length; j++) {
|
|
524
|
-
if (resultElem[j].closest('li') && keys[i] === 'p') {
|
|
525
|
-
continue;
|
|
526
|
-
}
|
|
527
|
-
var styleProperty = resultElem[j].getAttribute('style');
|
|
528
|
-
if (!ej2_base_1.isNullOrUndefined(styleProperty) && styleProperty.trim() !== '') {
|
|
529
|
-
var valueSplit = values[i].split(';');
|
|
530
|
-
for (var q = 0; q < valueSplit.length; q++) {
|
|
531
|
-
if (valueSplit[q].split(':')[0] === 'border' && valueSplit[q].split(':')[1] === 'none') {
|
|
532
|
-
valueSplit.splice(q, 1);
|
|
533
|
-
q--;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
if (!fromClass) {
|
|
537
|
-
for (var k = 0; k < valueSplit.length; k++) {
|
|
538
|
-
var propertyName = valueSplit[k].split(':')[0];
|
|
539
|
-
if (styleProperty.includes(propertyName + ':')) {
|
|
540
|
-
valueSplit.splice(k, 1);
|
|
541
|
-
k--;
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
var changedValue = valueSplit.join(';') + ';' + styleProperty;
|
|
546
|
-
resultElem[j].style.cssText = changedValue;
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
values[i] = values[i]
|
|
550
|
-
.replace(/text-indent:-.*?;?/g, '')
|
|
551
|
-
.replace(/border:\s*none;?/g, '')
|
|
552
|
-
.trim();
|
|
553
|
-
resultElem[j].style.cssText = values[i];
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
fromClass = false;
|
|
557
|
-
}
|
|
558
|
-
var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
|
|
559
|
-
for (var i = 0; i < listClass.length; i++) {
|
|
560
|
-
if (keys.indexOf('li.' + listClass[i]) > -1) {
|
|
561
|
-
var olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
|
|
562
|
-
for (var j = 0; j < olULElems.length; j++) {
|
|
563
|
-
var styleProperty = olULElems[j].getAttribute('style');
|
|
564
|
-
if (!ej2_base_1.isNullOrUndefined(styleProperty) && styleProperty.trim() !== '' && olULElems[j].style.marginLeft !== '') {
|
|
565
|
-
var valueSplit = values[keys.indexOf('li.' + listClass[i])].split(';');
|
|
566
|
-
for (var k = 0; k < valueSplit.length; k++) {
|
|
567
|
-
if ('margin-left'.indexOf(valueSplit[k].split(':')[0]) >= 0) {
|
|
568
|
-
if (!ej2_base_1.isNullOrUndefined(valueSplit[k].split(':')[1]) &&
|
|
569
|
-
valueSplit[k].split(':')[1].indexOf('in') >= 0 &&
|
|
570
|
-
olULElems[j].style.marginLeft.indexOf('in') >= 0) {
|
|
571
|
-
var classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
|
|
572
|
-
var inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
|
|
573
|
-
olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
};
|
|
584
|
-
MsWordPaste.prototype.filterStyles = function (elm, wordPasteStyleConfig) {
|
|
585
|
-
var elmWithStyles = elm.querySelectorAll('*[style]');
|
|
586
|
-
for (var i = 0; i < elmWithStyles.length; i++) {
|
|
587
|
-
var elemStyleProperty = elmWithStyles[i].getAttribute('style').split(';');
|
|
588
|
-
var styleValue = '';
|
|
589
|
-
for (var j = 0; j < elemStyleProperty.length; j++) {
|
|
590
|
-
if (wordPasteStyleConfig.indexOf(elemStyleProperty[j].split(':')[0].trim()) >= 0) {
|
|
591
|
-
styleValue += elemStyleProperty[j] + ';';
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
elmWithStyles[i].style.cssText = styleValue;
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
MsWordPaste.prototype.removeUnwantedStyle = function (values, wordPasteStyleConfig) {
|
|
598
|
-
for (var i = 0; i < values.length; i++) {
|
|
599
|
-
var styleValues = values[i].split(';');
|
|
600
|
-
values[i] = '';
|
|
601
|
-
for (var j = 0; j < styleValues.length; j++) {
|
|
602
|
-
if (wordPasteStyleConfig.indexOf(styleValues[j].split(':')[0]) >= 0) {
|
|
603
|
-
values[i] += styleValues[j] + ';';
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
return values;
|
|
608
|
-
};
|
|
609
|
-
MsWordPaste.prototype.findStyleObject = function (styles) {
|
|
610
|
-
var styleClassObject = {};
|
|
611
|
-
for (var i = 0; i < styles.length; i++) {
|
|
612
|
-
var tempStyle = styles[i];
|
|
613
|
-
var classNameCollection = tempStyle.replace(/([\S ]+\s+){[\s\S]+?}/gi, '$1');
|
|
614
|
-
var stylesCollection = tempStyle.replace(/[\S ]+\s+{([\s\S]+?)}/gi, '$1');
|
|
615
|
-
classNameCollection = classNameCollection.replace(/^[\s]|[\s]$/gm, '');
|
|
616
|
-
stylesCollection = stylesCollection.replace(/^[\s]|[\s]$/gm, '');
|
|
617
|
-
classNameCollection = classNameCollection.replace(/\n|\r|\n\r/g, '');
|
|
618
|
-
stylesCollection = stylesCollection.replace(/\n|\r|\n\r/g, '');
|
|
619
|
-
for (var classNames = classNameCollection.split(', '), j = 0; j < classNames.length; j++) {
|
|
620
|
-
styleClassObject[classNames[j]] = stylesCollection;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
return styleClassObject;
|
|
624
|
-
};
|
|
625
|
-
MsWordPaste.prototype.removingComments = function (elm) {
|
|
626
|
-
var innerElement = elm.innerHTML;
|
|
627
|
-
innerElement = innerElement.replace(/<!--[\s\S]*?-->/g, '');
|
|
628
|
-
elm.innerHTML = innerElement;
|
|
629
|
-
};
|
|
630
|
-
MsWordPaste.prototype.cleanUp = function (node, listNodes) {
|
|
631
|
-
var tempCleaner = [];
|
|
632
|
-
var prevflagState;
|
|
633
|
-
var allNodes = node.querySelectorAll('*');
|
|
634
|
-
for (var index = 0; index < allNodes.length; index++) {
|
|
635
|
-
if (this.ignorableNodes.indexOf(allNodes[index].nodeName) === -1 ||
|
|
636
|
-
(allNodes[index].nodeType === 3 && allNodes[index].textContent.trim() === '')) {
|
|
637
|
-
tempCleaner.push(allNodes[index]);
|
|
638
|
-
continue;
|
|
639
|
-
}
|
|
640
|
-
else if (allNodes[index].className &&
|
|
641
|
-
allNodes[index].className.toLowerCase().indexOf('msolistparagraph') !== -1 &&
|
|
642
|
-
!ej2_base_1.isNullOrUndefined(allNodes[index].getAttribute('style')) &&
|
|
643
|
-
allNodes[index].getAttribute('style').indexOf('mso-list:') >= 0) {
|
|
644
|
-
if (allNodes[index].className.indexOf('MsoListParagraphCxSpFirst') >= 0 && listNodes.length > 0 &&
|
|
645
|
-
listNodes[listNodes.length - 1] !== null) {
|
|
646
|
-
listNodes.push(null);
|
|
647
|
-
}
|
|
648
|
-
listNodes.push(allNodes[index]);
|
|
649
|
-
}
|
|
650
|
-
if (prevflagState && (this.blockNode.indexOf(allNodes[index].nodeName.toLowerCase()) !== -1) &&
|
|
651
|
-
!(allNodes[index].className &&
|
|
652
|
-
allNodes[index].className.toLowerCase().indexOf('msolistparagraph') !== -1 && !ej2_base_1.isNullOrUndefined(allNodes[index].getAttribute('style')) &&
|
|
653
|
-
allNodes[index].getAttribute('style').indexOf('mso-list:') >= 0)) {
|
|
654
|
-
listNodes.push(null);
|
|
655
|
-
}
|
|
656
|
-
if (this.blockNode.indexOf(allNodes[index].nodeName.toLowerCase()) !== -1) {
|
|
657
|
-
if (allNodes[index].className &&
|
|
658
|
-
allNodes[index].className.toLowerCase().indexOf('msolistparagraph') !== -1 && !ej2_base_1.isNullOrUndefined(allNodes[index].getAttribute('style')) &&
|
|
659
|
-
allNodes[index].getAttribute('style').indexOf('mso-list:') >= 0) {
|
|
660
|
-
prevflagState = true;
|
|
661
|
-
}
|
|
662
|
-
else {
|
|
663
|
-
prevflagState = false;
|
|
664
|
-
}
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
if (listNodes.length && (listNodes[listNodes.length - 1] !== null)) {
|
|
668
|
-
listNodes.push(null);
|
|
669
|
-
}
|
|
670
|
-
return listNodes;
|
|
671
|
-
};
|
|
672
|
-
MsWordPaste.prototype.listConverter = function (listNodes) {
|
|
673
|
-
var level;
|
|
674
|
-
var data = [];
|
|
675
|
-
var listFormatOverride;
|
|
676
|
-
var collection = [];
|
|
677
|
-
var content = '';
|
|
678
|
-
var stNode;
|
|
679
|
-
var currentListStyle = '';
|
|
680
|
-
for (var i = 0; i < listNodes.length; i++) {
|
|
681
|
-
if (listNodes[i] === null) {
|
|
682
|
-
data.push({ content: this.makeConversion(collection), node: listNodes[i - 1] });
|
|
683
|
-
collection = [];
|
|
684
|
-
continue;
|
|
685
|
-
}
|
|
686
|
-
if (listNodes[i].getAttribute('style') && listNodes[i].getAttribute('style').indexOf('mso-outline-level') !== -1) {
|
|
687
|
-
listNodes[i].style.cssText = listNodes[i].getAttribute('style').replace('mso-outline-level', 'mso-outline');
|
|
688
|
-
}
|
|
689
|
-
content = listNodes[i].getAttribute('style');
|
|
690
|
-
if (content && content.indexOf('level') !== -1) {
|
|
691
|
-
level = parseInt(content.charAt(content.indexOf('level') + 5), null);
|
|
692
|
-
}
|
|
693
|
-
else {
|
|
694
|
-
level = 1;
|
|
695
|
-
}
|
|
696
|
-
if (content && content.indexOf('mso-list:') !== -1) {
|
|
697
|
-
var msoListValue = void 0;
|
|
698
|
-
if (content.match(/mso-list:[^;]+;?/)) {
|
|
699
|
-
var changedContent = content.replace(new RegExp('\\n', 'g'), '').split(' ').join('');
|
|
700
|
-
msoListValue = changedContent.match(/mso-list:[^;]+;?/)[0].split(':l');
|
|
701
|
-
listFormatOverride = ej2_base_1.isNullOrUndefined(msoListValue) ? null : parseInt(msoListValue[1].split('level')[0], 10);
|
|
702
|
-
}
|
|
703
|
-
else {
|
|
704
|
-
listFormatOverride = null;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
this.listContents = [];
|
|
708
|
-
this.getListContent(listNodes[i]);
|
|
709
|
-
var type = void 0;
|
|
710
|
-
var listStyleType = void 0;
|
|
711
|
-
var startAttr = void 0;
|
|
712
|
-
var styleMarginLeft = void 0;
|
|
713
|
-
if (!ej2_base_1.isNullOrUndefined(this.listContents[0])) {
|
|
714
|
-
type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
|
|
715
|
-
listStyleType = this.getlistStyleType(this.listContents[0], type);
|
|
716
|
-
if (type === 'ol' && (i === 0 || listNodes[i - 1] === null)) {
|
|
717
|
-
var startString = this.listContents[0].split('.')[0];
|
|
718
|
-
var listTypes = ['A', 'a', 'I', 'i', 'α', '1', '01', '1-'];
|
|
719
|
-
if (listTypes.indexOf(startString) === -1) {
|
|
720
|
-
if (listStyleType === 'decimal') {
|
|
721
|
-
if (!isNaN(parseInt(startString, 10))) {
|
|
722
|
-
startAttr = parseInt(startString, 10);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
else if (listStyleType === 'decimal-leading-zero') {
|
|
726
|
-
if (!isNaN(parseInt(startString, 10))) {
|
|
727
|
-
startAttr = parseInt(startString, 10);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
else if (listStyleType === 'upper-alpha') {
|
|
731
|
-
startAttr = (startString.split('.')[0].charCodeAt(0) - 64);
|
|
732
|
-
}
|
|
733
|
-
else if (listStyleType === 'lower-alpha') {
|
|
734
|
-
startAttr = (startString.split('.')[0].charCodeAt(0) - 96);
|
|
735
|
-
}
|
|
736
|
-
else if (listStyleType === 'upper-roman') {
|
|
737
|
-
startAttr = this.upperRomanNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
|
|
738
|
-
}
|
|
739
|
-
else if (listStyleType === 'lower-roman') {
|
|
740
|
-
startAttr = this.lowerRomanNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
|
|
741
|
-
}
|
|
742
|
-
else if (listStyleType === 'lower-greek') {
|
|
743
|
-
startAttr = this.lowerGreekNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
if (listNodes[i].style.marginLeft !== '') {
|
|
748
|
-
styleMarginLeft = listNodes[i].style.marginLeft;
|
|
749
|
-
}
|
|
750
|
-
var tempNode = [];
|
|
751
|
-
for (var j = 1; j < this.listContents.length; j++) {
|
|
752
|
-
tempNode.push(this.listContents[j]);
|
|
753
|
-
}
|
|
754
|
-
var currentClassName = void 0;
|
|
755
|
-
if (!ej2_base_1.isNullOrUndefined(listNodes[i].className)) {
|
|
756
|
-
currentClassName = listNodes[i].className;
|
|
757
|
-
}
|
|
758
|
-
if (!ej2_base_1.isNullOrUndefined(listNodes[i].getAttribute('style'))) {
|
|
759
|
-
listNodes[i].style.cssText = listNodes[i].getAttribute('style').replace('text-align:start;', '');
|
|
760
|
-
listNodes[i].style.textIndent = '';
|
|
761
|
-
currentListStyle = listNodes[i].getAttribute('style');
|
|
762
|
-
}
|
|
763
|
-
collection.push({
|
|
764
|
-
listType: type, content: tempNode, nestedLevel: level,
|
|
765
|
-
listFormatOverride: listFormatOverride, class: currentClassName,
|
|
766
|
-
listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
stNode = listNodes.shift();
|
|
771
|
-
while (stNode) {
|
|
772
|
-
var elemColl = [];
|
|
773
|
-
for (var temp1 = 0; temp1 < data.length; temp1++) {
|
|
774
|
-
if (data[temp1].node === stNode) {
|
|
775
|
-
for (var index = 0; index < data[temp1].content.childNodes.length; index++) {
|
|
776
|
-
elemColl.push(data[temp1].content.childNodes[index]);
|
|
777
|
-
}
|
|
778
|
-
for (var index = 0; index < elemColl.length; index++) {
|
|
779
|
-
stNode.parentElement.insertBefore(elemColl[index], stNode);
|
|
780
|
-
}
|
|
781
|
-
break;
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
stNode.remove();
|
|
785
|
-
stNode = listNodes.shift();
|
|
786
|
-
if (!stNode) {
|
|
787
|
-
stNode = listNodes.shift();
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
MsWordPaste.prototype.getlistStyleType = function (listContent, type) {
|
|
792
|
-
var currentListClass;
|
|
793
|
-
if (type === 'ol') {
|
|
794
|
-
var charCode = listContent.split('.')[0].charCodeAt(0);
|
|
795
|
-
switch (true) {
|
|
796
|
-
case this.upperRomanNumber.indexOf(listContent.split('.')[0]) > -1:
|
|
797
|
-
currentListClass = 'upper-roman';
|
|
798
|
-
break;
|
|
799
|
-
case this.lowerRomanNumber.indexOf(listContent.split('.')[0]) > -1:
|
|
800
|
-
currentListClass = 'lower-roman';
|
|
801
|
-
break;
|
|
802
|
-
case this.lowerGreekNumber.indexOf(listContent.split('.')[0]) > -1:
|
|
803
|
-
currentListClass = 'lower-greek';
|
|
804
|
-
break;
|
|
805
|
-
case (charCode > 64 && charCode < 91):
|
|
806
|
-
currentListClass = 'upper-alpha';
|
|
807
|
-
break;
|
|
808
|
-
case (charCode > 96 && charCode < 123):
|
|
809
|
-
currentListClass = 'lower-alpha';
|
|
810
|
-
break;
|
|
811
|
-
case (listContent.split('.')[0].length > 1 && listContent.split('.')[0][0] === '0' && !isNaN(Number(listContent.split('.')[0]))):
|
|
812
|
-
currentListClass = 'decimal-leading-zero';
|
|
813
|
-
break;
|
|
814
|
-
default:
|
|
815
|
-
currentListClass = 'decimal';
|
|
816
|
-
break;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
else {
|
|
820
|
-
switch (listContent.split('.')[0]) {
|
|
821
|
-
case 'o':
|
|
822
|
-
currentListClass = 'circle';
|
|
823
|
-
break;
|
|
824
|
-
case '§':
|
|
825
|
-
currentListClass = 'square';
|
|
826
|
-
break;
|
|
827
|
-
default:
|
|
828
|
-
currentListClass = 'disc';
|
|
829
|
-
break;
|
|
830
|
-
}
|
|
831
|
-
}
|
|
832
|
-
return currentListClass;
|
|
833
|
-
};
|
|
834
|
-
MsWordPaste.prototype.makeConversion = function (collection) {
|
|
835
|
-
var root = ej2_base_1.createElement('div');
|
|
836
|
-
var temp;
|
|
837
|
-
var pLevel = 1;
|
|
838
|
-
var prevList;
|
|
839
|
-
var listCount = 0;
|
|
840
|
-
var elem;
|
|
841
|
-
var lfo = collection[0].listFormatOverride;
|
|
842
|
-
for (var index = 0; index < collection.length; index++) {
|
|
843
|
-
var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
|
|
844
|
-
var isNormalList = false;
|
|
845
|
-
for (var i = 0; i < listClass.length; i++) {
|
|
846
|
-
if (listClass[i].indexOf(collection[index].class) >= 0) {
|
|
847
|
-
isNormalList = true;
|
|
848
|
-
break;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
if (!ej2_base_1.isNullOrUndefined(prevList) && index !== 0 &&
|
|
852
|
-
collection[index - 1].listType !== collection[index].listType &&
|
|
853
|
-
!isNormalList) {
|
|
854
|
-
prevList = null;
|
|
855
|
-
}
|
|
856
|
-
var pElement = ej2_base_1.createElement('p', { className: 'MsoNoSpacing' });
|
|
857
|
-
pElement.innerHTML = collection[index].content.join(' ');
|
|
858
|
-
if ((collection[index].nestedLevel === 1) &&
|
|
859
|
-
(listCount === 0 || lfo !== collection[index].listFormatOverride) &&
|
|
860
|
-
collection[index].content) {
|
|
861
|
-
root.appendChild(temp = ej2_base_1.createElement(collection[index].listType, { className: collection[index].class }));
|
|
862
|
-
prevList = ej2_base_1.createElement('li');
|
|
863
|
-
prevList.appendChild(pElement);
|
|
864
|
-
temp.appendChild(prevList);
|
|
865
|
-
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
866
|
-
if (collection[index].class !== 'msolistparagraph') {
|
|
867
|
-
temp.style.marginLeft = collection[index].styleMarginLeft;
|
|
868
|
-
}
|
|
869
|
-
else {
|
|
870
|
-
ej2_base_1.addClass([temp], 'marginLeftIgnore');
|
|
871
|
-
}
|
|
872
|
-
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
873
|
-
}
|
|
874
|
-
else if (collection[index].nestedLevel === pLevel &&
|
|
875
|
-
lfo === collection[index].listFormatOverride) {
|
|
876
|
-
if (!ej2_base_1.isNullOrUndefined(prevList) && !ej2_base_1.isNullOrUndefined(prevList.parentElement)
|
|
877
|
-
&& prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
|
|
878
|
-
prevList.parentElement.appendChild(prevList = ej2_base_1.createElement('li'));
|
|
879
|
-
prevList.appendChild(pElement);
|
|
880
|
-
}
|
|
881
|
-
else if (ej2_base_1.isNullOrUndefined(prevList)) {
|
|
882
|
-
temp = ej2_base_1.createElement(collection[index].listType);
|
|
883
|
-
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
884
|
-
prevList = ej2_base_1.createElement('li');
|
|
885
|
-
prevList.appendChild(pElement);
|
|
886
|
-
temp.appendChild(prevList);
|
|
887
|
-
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
888
|
-
root.appendChild(temp);
|
|
889
|
-
}
|
|
890
|
-
else {
|
|
891
|
-
temp = ej2_base_1.createElement(collection[index].listType);
|
|
892
|
-
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
893
|
-
prevList.parentElement.parentElement.appendChild(temp);
|
|
894
|
-
prevList = ej2_base_1.createElement('li');
|
|
895
|
-
prevList.appendChild(pElement);
|
|
896
|
-
temp.appendChild(prevList);
|
|
897
|
-
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
else if (collection[index].nestedLevel > pLevel) {
|
|
901
|
-
if (!ej2_base_1.isNullOrUndefined(prevList)) {
|
|
902
|
-
for (var j = 0; j < collection[index].nestedLevel - pLevel; j++) {
|
|
903
|
-
prevList.appendChild(temp = ej2_base_1.createElement(collection[index].listType));
|
|
904
|
-
prevList = ej2_base_1.createElement('li');
|
|
905
|
-
if (j !== collection[index].nestedLevel - pLevel - 1 &&
|
|
906
|
-
collection[index].nestedLevel - pLevel > 1) {
|
|
907
|
-
prevList.style.listStyleType = 'none';
|
|
908
|
-
}
|
|
909
|
-
temp.appendChild(prevList);
|
|
910
|
-
}
|
|
911
|
-
prevList.appendChild(pElement);
|
|
912
|
-
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
913
|
-
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
914
|
-
}
|
|
915
|
-
else {
|
|
916
|
-
if (collection[index].nestedLevel > pLevel && isNormalList) {
|
|
917
|
-
var initialNode = ej2_base_1.createElement(collection[index].listType);
|
|
918
|
-
prevList = ej2_base_1.createElement('li');
|
|
919
|
-
initialNode.appendChild(prevList);
|
|
920
|
-
initialNode.style.listStyleType = 'none';
|
|
921
|
-
for (var j = 0; j < collection[index].nestedLevel - 1; j++) {
|
|
922
|
-
prevList.appendChild(temp = ej2_base_1.createElement(collection[index].listType));
|
|
923
|
-
prevList = ej2_base_1.createElement('li');
|
|
924
|
-
temp.appendChild(prevList);
|
|
925
|
-
temp.style.listStyleType = 'none';
|
|
926
|
-
}
|
|
927
|
-
prevList.appendChild(pElement);
|
|
928
|
-
root.appendChild(initialNode);
|
|
929
|
-
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
930
|
-
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
931
|
-
}
|
|
932
|
-
else {
|
|
933
|
-
root.appendChild(temp = ej2_base_1.createElement(collection[index].listType));
|
|
934
|
-
prevList = ej2_base_1.createElement('li');
|
|
935
|
-
prevList.appendChild(pElement);
|
|
936
|
-
temp.appendChild(prevList);
|
|
937
|
-
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
938
|
-
if (collection[index].class !== 'msolistparagraph') {
|
|
939
|
-
temp.style.marginLeft = collection[index].styleMarginLeft;
|
|
940
|
-
}
|
|
941
|
-
else {
|
|
942
|
-
ej2_base_1.addClass([temp], 'marginLeftIgnore');
|
|
943
|
-
}
|
|
944
|
-
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
945
|
-
}
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
else if (collection[index].nestedLevel === 1) {
|
|
949
|
-
if (root.lastChild.tagName.toLowerCase() === collection[index].listType) {
|
|
950
|
-
temp = root.lastChild;
|
|
951
|
-
}
|
|
952
|
-
else {
|
|
953
|
-
root.appendChild(temp = ej2_base_1.createElement(collection[index].listType));
|
|
954
|
-
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
955
|
-
}
|
|
956
|
-
prevList = ej2_base_1.createElement('li');
|
|
957
|
-
prevList.appendChild(pElement);
|
|
958
|
-
temp.appendChild(prevList);
|
|
959
|
-
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
960
|
-
}
|
|
961
|
-
else {
|
|
962
|
-
elem = prevList;
|
|
963
|
-
while (elem.parentElement) {
|
|
964
|
-
elem = elem.parentElement;
|
|
965
|
-
if (elem.attributes.getNamedItem('level')) {
|
|
966
|
-
if (parseInt(elem.attributes.getNamedItem('level').textContent, 10) === collection[index].nestedLevel &&
|
|
967
|
-
lfo === collection[index].listFormatOverride) {
|
|
968
|
-
prevList = ej2_base_1.createElement('li');
|
|
969
|
-
prevList.appendChild(pElement);
|
|
970
|
-
elem.appendChild(prevList);
|
|
971
|
-
break;
|
|
972
|
-
}
|
|
973
|
-
else if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
|
|
974
|
-
lfo !== collection[index].listFormatOverride) {
|
|
975
|
-
temp = ej2_base_1.createElement(collection[index].listType);
|
|
976
|
-
prevList = ej2_base_1.createElement('li');
|
|
977
|
-
temp.appendChild(prevList);
|
|
978
|
-
if (collection[index].nestedLevel > 1) {
|
|
979
|
-
for (var k = 0; k < collection[index].nestedLevel - 1; k++) {
|
|
980
|
-
prevList.appendChild(temp = ej2_base_1.createElement(collection[index].listType));
|
|
981
|
-
prevList = ej2_base_1.createElement('li');
|
|
982
|
-
temp.appendChild(prevList);
|
|
983
|
-
temp.style.listStyleType = 'none';
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
prevList.appendChild(pElement);
|
|
987
|
-
elem.appendChild(temp);
|
|
988
|
-
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
989
|
-
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
992
|
-
else if (collection[index].nestedLevel > parseInt(elem.attributes.getNamedItem('level').textContent, 10)) {
|
|
993
|
-
elem.appendChild(temp = ej2_base_1.createElement(collection[index].listType));
|
|
994
|
-
prevList = ej2_base_1.createElement('li');
|
|
995
|
-
prevList.appendChild(pElement);
|
|
996
|
-
temp.appendChild(prevList);
|
|
997
|
-
temp.setAttribute('level', collection[index].nestedLevel.toString());
|
|
998
|
-
temp.style.listStyleType = collection[index].listStyleTypeName;
|
|
999
|
-
break;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
continue;
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
prevList.setAttribute('class', collection[index].class);
|
|
1006
|
-
prevList.style.cssText = (!ej2_base_1.isNullOrUndefined(collection[index].listStyle) ? collection[index].listStyle : '');
|
|
1007
|
-
pLevel = collection[index].nestedLevel;
|
|
1008
|
-
lfo = collection[index].listFormatOverride;
|
|
1009
|
-
listCount++;
|
|
1010
|
-
if (!ej2_base_1.isNullOrUndefined(collection[index].start && collection[index].start !== 1 && collection[index].listType === 'ol')) {
|
|
1011
|
-
temp.setAttribute('start', collection[index].start.toString());
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
|
-
return root;
|
|
1015
|
-
};
|
|
1016
|
-
MsWordPaste.prototype.getListContent = function (elem) {
|
|
1017
|
-
var pushContent = '';
|
|
1018
|
-
var firstChild = elem.firstElementChild;
|
|
1019
|
-
if (firstChild.textContent.trim() === '' && !ej2_base_1.isNullOrUndefined(firstChild.firstElementChild) &&
|
|
1020
|
-
firstChild.firstElementChild.nodeName === 'IMG') {
|
|
1021
|
-
pushContent = elem.innerHTML.trim();
|
|
1022
|
-
this.listContents.push('');
|
|
1023
|
-
this.listContents.push(pushContent);
|
|
1024
|
-
}
|
|
1025
|
-
else {
|
|
1026
|
-
if (firstChild.childNodes.length > 0) {
|
|
1027
|
-
var listIgnoreTag = firstChild.querySelectorAll('[style*="mso-list"]');
|
|
1028
|
-
for (var i = 0; i < listIgnoreTag.length; i++) {
|
|
1029
|
-
listIgnoreTag[i].setAttribute('style', listIgnoreTag[i].getAttribute('style').replace(/\n/g, ''));
|
|
1030
|
-
}
|
|
1031
|
-
var listOrderCleanup = firstChild.querySelector('span[style*="mso-list"]');
|
|
1032
|
-
if (listOrderCleanup) {
|
|
1033
|
-
var style = listOrderCleanup.getAttribute('style');
|
|
1034
|
-
if (style) {
|
|
1035
|
-
style = style.replace(/\s*:\s*/g, ':');
|
|
1036
|
-
listOrderCleanup.setAttribute('style', style);
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
var listOrder = firstChild.querySelector('span[style="mso-list:Ignore"]');
|
|
1040
|
-
var isEmptyMarkerSpan = ej2_base_1.isNullOrUndefined(listOrder);
|
|
1041
|
-
listOrder = isEmptyMarkerSpan ? firstChild : listOrder;
|
|
1042
|
-
if (!ej2_base_1.isNullOrUndefined(listOrder)) {
|
|
1043
|
-
var textContent = listOrder.textContent.trim();
|
|
1044
|
-
if (isEmptyMarkerSpan) {
|
|
1045
|
-
var bulletPattern = /^(\d{1,2}|[a-zA-Z]|[*#~•○■])(\.|\)|-)\s*/;
|
|
1046
|
-
var textContentMatch = textContent.match(bulletPattern);
|
|
1047
|
-
if (!ej2_base_1.isNullOrUndefined(textContentMatch)) {
|
|
1048
|
-
textContent = textContentMatch[0].trim();
|
|
1049
|
-
listOrder.textContent = listOrder.textContent.trim().substring(textContent.length).trim();
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
this.listContents.push(textContent);
|
|
1053
|
-
if (!isEmptyMarkerSpan) {
|
|
1054
|
-
ej2_base_1.detach(listOrder);
|
|
1055
|
-
}
|
|
1056
|
-
this.removingComments(elem);
|
|
1057
|
-
this.removeUnwantedElements(elem);
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
this.listContents.push(elem.innerHTML);
|
|
1062
|
-
};
|
|
1063
|
-
MsWordPaste.prototype.processMargin = function (element) {
|
|
1064
|
-
var liChildren = element.querySelectorAll('li');
|
|
1065
|
-
if (liChildren.length > 0) {
|
|
1066
|
-
for (var i = 0; i < liChildren.length; i++) {
|
|
1067
|
-
if (!ej2_base_1.isNullOrUndefined((liChildren[i]).style.marginLeft) && !liChildren[i].parentElement.classList.contains('marginLeftIgnore')) {
|
|
1068
|
-
(liChildren[i]).style.marginLeft = '';
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
}
|
|
1072
|
-
var tableChildren = element.querySelectorAll('table');
|
|
1073
|
-
if (tableChildren.length > 0) {
|
|
1074
|
-
for (var i = 0; i < tableChildren.length; i++) {
|
|
1075
|
-
if (!ej2_base_1.isNullOrUndefined((tableChildren[i]).style.marginLeft) &&
|
|
1076
|
-
(tableChildren[i]).style.marginLeft.indexOf('-') >= 0) {
|
|
1077
|
-
(tableChildren[i]).style.marginLeft = '';
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
var ignoredNode = element.querySelectorAll('.marginLeftIgnore li');
|
|
1082
|
-
if (ignoredNode.length > 0) {
|
|
1083
|
-
for (var i = 0; i < ignoredNode.length; i++) {
|
|
1084
|
-
if (!ej2_base_1.isNullOrUndefined((ignoredNode[i]).style.marginLeft) && (ignoredNode[i]).style.marginLeft !== '') {
|
|
1085
|
-
var marginLeft = (ignoredNode[i]).style.marginLeft;
|
|
1086
|
-
var marginLeftValue = parseFloat(marginLeft.split('in')[0]);
|
|
1087
|
-
var result = marginLeftValue - 0.5;
|
|
1088
|
-
(ignoredNode[i]).style.marginLeft = result.toString() + 'in';
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
}
|
|
1092
|
-
};
|
|
1093
|
-
MsWordPaste.prototype.removeEmptyAnchorTag = function (element) {
|
|
1094
|
-
var removableElement = element.querySelectorAll('a:not([href])');
|
|
1095
|
-
for (var j = removableElement.length - 1; j >= 0; j--) {
|
|
1096
|
-
var parentElem = removableElement[j].parentNode;
|
|
1097
|
-
while (removableElement[j].firstChild) {
|
|
1098
|
-
parentElem.insertBefore(removableElement[j].firstChild, removableElement[j]);
|
|
1099
|
-
}
|
|
1100
|
-
parentElem.removeChild(removableElement[j]);
|
|
1101
|
-
}
|
|
1102
|
-
};
|
|
1103
|
-
MsWordPaste.prototype.findSource = function (element) {
|
|
1104
|
-
var metaNodes = element.querySelectorAll('meta');
|
|
1105
|
-
for (var i = 0; i < metaNodes.length; i++) {
|
|
1106
|
-
var metaNode = metaNodes[i];
|
|
1107
|
-
var content = metaNode.getAttribute('content');
|
|
1108
|
-
var name_1 = metaNode.getAttribute('name');
|
|
1109
|
-
if (name_1 && name_1.toLowerCase().indexOf('generator') >= 0 && content && content.toLowerCase().indexOf('microsoft') >= 0) {
|
|
1110
|
-
for (var j = 0; j < constant_1.PASTE_SOURCE.length; j++) {
|
|
1111
|
-
if (content.toLowerCase().indexOf(constant_1.PASTE_SOURCE[j]) >= 0) {
|
|
1112
|
-
return constant_1.PASTE_SOURCE[j];
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
return 'html';
|
|
1118
|
-
};
|
|
1119
|
-
MsWordPaste.prototype.handleOneNoteContent = function (element) {
|
|
1120
|
-
var allListElements = element.querySelectorAll('ul, ol');
|
|
1121
|
-
if (allListElements.length > 0) {
|
|
1122
|
-
for (var i = 0; i < allListElements.length; i++) {
|
|
1123
|
-
var currentList = allListElements[i];
|
|
1124
|
-
if (currentList.querySelectorAll('li').length === 0 && currentList.childNodes.length > 0) {
|
|
1125
|
-
insert_methods_1.InsertMethods.unwrap(currentList);
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
};
|
|
1130
|
-
MsWordPaste.prototype.destroy = function () {
|
|
1131
|
-
this.removeEventListener();
|
|
1132
|
-
};
|
|
1133
|
-
return MsWordPaste;
|
|
1134
|
-
}());
|
|
1135
|
-
exports.MsWordPaste = MsWordPaste;
|
|
1136
|
-
});
|