@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,985 +0,0 @@
|
|
|
1
|
-
define(["require", "exports", "./../../selection/index", "./nodecutter", "./../base/constant", "@syncfusion/ej2-base", "./insert-methods", "./../../common/util"], function (require, exports, index_1, nodecutter_1, CONSTANT, ej2_base_1, insert_methods_1, util_1) {
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
var InsertHtml = (function () {
|
|
5
|
-
function InsertHtml() {
|
|
6
|
-
}
|
|
7
|
-
InsertHtml.Insert = function (docElement, insertNode, editNode, isExternal, enterAction) {
|
|
8
|
-
var node;
|
|
9
|
-
if (typeof insertNode === 'string') {
|
|
10
|
-
var divNode = document.createElement('div');
|
|
11
|
-
divNode.innerHTML = insertNode.replace(/&(times|divide|ne)(;?)/g, '&$1$2');
|
|
12
|
-
node = isExternal ? divNode : divNode.firstChild;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
if (isExternal && !(!ej2_base_1.isNullOrUndefined(insertNode) && !ej2_base_1.isNullOrUndefined(insertNode.classList) &&
|
|
16
|
-
insertNode.classList.contains('pasteContent'))) {
|
|
17
|
-
var divNode = document.createElement('div');
|
|
18
|
-
divNode.appendChild(insertNode);
|
|
19
|
-
node = divNode;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
node = insertNode;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
var scrollHeight = !ej2_base_1.isNullOrUndefined(editNode) ? editNode.scrollHeight : 0;
|
|
26
|
-
var nodeSelection = new index_1.NodeSelection(editNode);
|
|
27
|
-
var nodeCutter = new nodecutter_1.NodeCutter();
|
|
28
|
-
var range = nodeSelection.getRange(docElement);
|
|
29
|
-
if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
|
|
30
|
-
range.startOffset === range.endOffset && editNode.textContent.length === 0 &&
|
|
31
|
-
(editNode.children[0].tagName === 'P' || editNode.children[0].tagName === 'DIV' || (editNode.children[0].tagName === 'BR'))) {
|
|
32
|
-
nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
|
|
33
|
-
range = nodeSelection.getRange(docElement);
|
|
34
|
-
}
|
|
35
|
-
if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
|
|
36
|
-
range.startOffset === range.endOffset && editNode.textContent.trim().length > 0) {
|
|
37
|
-
var focusNode = this.findFirstTextNode(range.startContainer);
|
|
38
|
-
if (!ej2_base_1.isNullOrUndefined(focusNode)) {
|
|
39
|
-
nodeSelection.setSelectionText(docElement, focusNode, focusNode, 0, 0);
|
|
40
|
-
range = nodeSelection.getRange(docElement);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (range.startContainer.nodeName === 'BR' && range.startOffset === 0 && range.startOffset === range.endOffset &&
|
|
44
|
-
range.startContainer === range.endContainer) {
|
|
45
|
-
var currentIndex = Array.prototype.slice.call(range.startContainer.parentElement.childNodes).indexOf(range.startContainer);
|
|
46
|
-
nodeSelection.setSelectionText(docElement, range.startContainer.parentElement, range.startContainer.parentElement, currentIndex, currentIndex);
|
|
47
|
-
range = nodeSelection.getRange(docElement);
|
|
48
|
-
}
|
|
49
|
-
var isCursor = range.startOffset === range.endOffset && range.startOffset === 0 &&
|
|
50
|
-
range.startContainer === range.endContainer;
|
|
51
|
-
var isCollapsed = range.collapsed;
|
|
52
|
-
var nodes = this.getNodeCollection(range, nodeSelection, node);
|
|
53
|
-
var closestParentNode = (node.nodeName.toLowerCase() === 'table') ? (!ej2_base_1.isNullOrUndefined(nodes[0]) ? this.closestEle(nodes[0].parentNode, editNode) : range.startContainer) : nodes[0];
|
|
54
|
-
if (closestParentNode && closestParentNode.nodeName === 'BR') {
|
|
55
|
-
closestParentNode = closestParentNode.parentNode;
|
|
56
|
-
}
|
|
57
|
-
if (closestParentNode && closestParentNode.nodeName === 'LI' && node.nodeName.toLowerCase() === 'table') {
|
|
58
|
-
if (nodes.length === 0) {
|
|
59
|
-
var tableCursor = nodeSelection.processedTableImageCursor(range);
|
|
60
|
-
if (tableCursor.startName === 'TABLE' || tableCursor.endName === 'TABLE') {
|
|
61
|
-
var tableNode = tableCursor.start ? tableCursor.startNode : tableCursor.endNode;
|
|
62
|
-
nodes.push(tableNode);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
var lastclosestParentNode = this.closestEle(nodes[nodes.length - 1].parentNode, editNode);
|
|
66
|
-
this.insertTableInList(range, node, closestParentNode, nodes[0], nodeCutter, lastclosestParentNode, editNode);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (isCursor && range.startContainer.textContent === '' && range.startContainer.nodeName !== 'BR' && enterAction !== 'BR' && node.nodeName !== '#text' && !ej2_base_1.isNullOrUndefined(node.children[0]) && !ej2_base_1.isNullOrUndefined(node.children[0].tagName) && node.children[0].tagName === 'IMG' && node.children.length === 1) {
|
|
70
|
-
range.startContainer.innerHTML = '';
|
|
71
|
-
}
|
|
72
|
-
if (isExternal || (!ej2_base_1.isNullOrUndefined(node) && !ej2_base_1.isNullOrUndefined(node.classList) &&
|
|
73
|
-
node.classList.contains('pasteContent'))) {
|
|
74
|
-
this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (editNode !== range.startContainer && ((!isCollapsed && !(closestParentNode.nodeType === Node.ELEMENT_NODE &&
|
|
78
|
-
CONSTANT.TABLE_BLOCK_TAGS.indexOf(closestParentNode.tagName.toLocaleLowerCase()) !== -1))
|
|
79
|
-
|| (node.nodeName.toLowerCase() === 'table' && closestParentNode &&
|
|
80
|
-
CONSTANT.TABLE_BLOCK_TAGS.indexOf(closestParentNode.tagName.toLocaleLowerCase()) === -1))) {
|
|
81
|
-
var preNode = nodeCutter.GetSpliceNode(range, closestParentNode);
|
|
82
|
-
var sibNode = preNode.previousSibling;
|
|
83
|
-
var parentNode = preNode.parentNode;
|
|
84
|
-
if (nodes.length === 1 || (node.nodeName.toLowerCase() === 'table' && preNode.childElementCount === 0)) {
|
|
85
|
-
nodeSelection.setSelectionContents(docElement, preNode);
|
|
86
|
-
range = nodeSelection.getRange(docElement);
|
|
87
|
-
}
|
|
88
|
-
else if (parentNode && parentNode.nodeName !== 'LI') {
|
|
89
|
-
var lasNode = nodeCutter.GetSpliceNode(range, nodes[nodes.length - 1].parentElement);
|
|
90
|
-
lasNode = ej2_base_1.isNullOrUndefined(lasNode) ? preNode : lasNode;
|
|
91
|
-
nodeSelection.setSelectionText(docElement, preNode, lasNode, 0, (lasNode.nodeType === 3) ?
|
|
92
|
-
lasNode.textContent.length : lasNode.childNodes.length);
|
|
93
|
-
range = nodeSelection.getRange(docElement);
|
|
94
|
-
}
|
|
95
|
-
if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
|
|
96
|
-
util_1.nestedListCleanUp(range, parentNode);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
range.extractContents();
|
|
100
|
-
}
|
|
101
|
-
if (insertNode.tagName === 'TABLE') {
|
|
102
|
-
var emptyElement = ej2_base_1.closest(range.startContainer, 'blockquote');
|
|
103
|
-
if (!ej2_base_1.isNullOrUndefined(emptyElement) && emptyElement.childNodes.length > 0) {
|
|
104
|
-
for (var i = emptyElement.childNodes.length - 1; i >= 0; i--) {
|
|
105
|
-
var currentChild = emptyElement.childNodes[i];
|
|
106
|
-
if (!ej2_base_1.isNullOrUndefined(currentChild) && currentChild.innerText.trim() === '') {
|
|
107
|
-
ej2_base_1.detach(currentChild);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
this.removeEmptyElements(editNode, false, emptyElement);
|
|
112
|
-
}
|
|
113
|
-
for (var index = 0; index < nodes.length; index++) {
|
|
114
|
-
if (nodes[index].nodeType !== 3 && nodes[index].parentNode != null) {
|
|
115
|
-
if (nodes[index].nodeName === 'IMG') {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
nodes[index].parentNode.removeChild(nodes[index]);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
if (!ej2_base_1.isNullOrUndefined(sibNode) && !ej2_base_1.isNullOrUndefined(sibNode.parentNode)) {
|
|
122
|
-
if (docElement.contains(sibNode)) {
|
|
123
|
-
insert_methods_1.InsertMethods.AppendBefore(node, sibNode, true);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
range.insertNode(node);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
var previousNode = null;
|
|
131
|
-
while (parentNode !== editNode && parentNode.firstChild &&
|
|
132
|
-
(parentNode.textContent.trim() === '') && parentNode.nodeName !== 'LI') {
|
|
133
|
-
var parentNode1 = parentNode.parentNode;
|
|
134
|
-
previousNode = parentNode;
|
|
135
|
-
parentNode = parentNode1;
|
|
136
|
-
}
|
|
137
|
-
if (previousNode !== null) {
|
|
138
|
-
parentNode = previousNode;
|
|
139
|
-
}
|
|
140
|
-
if (parentNode.firstChild && (parentNode !== editNode ||
|
|
141
|
-
(node.nodeName === 'TABLE' && isCursor && parentNode === range.startContainer &&
|
|
142
|
-
parentNode === range.endContainer))) {
|
|
143
|
-
if (parentNode.textContent.trim() === '' && parentNode !== editNode && parentNode.nodeName === 'LI') {
|
|
144
|
-
parentNode.appendChild(node);
|
|
145
|
-
}
|
|
146
|
-
else if (parentNode.textContent.trim() === '' && parentNode !== editNode) {
|
|
147
|
-
insert_methods_1.InsertMethods.AppendBefore(node, parentNode, false);
|
|
148
|
-
ej2_base_1.detach(parentNode);
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
insert_methods_1.InsertMethods.AppendBefore(node, parentNode.firstChild, false);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
else if (ej2_base_1.isNullOrUndefined(preNode.previousSibling) && insertNode.tagName === 'TABLE') {
|
|
155
|
-
parentNode.prepend(node);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
parentNode.appendChild(node);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (node.nodeName === 'IMG') {
|
|
162
|
-
this.imageFocus(node, nodeSelection, docElement);
|
|
163
|
-
}
|
|
164
|
-
else if (node.nodeType !== 3) {
|
|
165
|
-
nodeSelection.setSelectionText(docElement, node, node, 0, node.childNodes.length);
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
nodeSelection.setSelectionText(docElement, node, node, 0, node.textContent.length);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
var liElement = !ej2_base_1.isNullOrUndefined(closestParentNode) ? ej2_base_1.closest(closestParentNode, 'li') : null;
|
|
173
|
-
if ((!ej2_base_1.isNullOrUndefined(closestParentNode) && (closestParentNode.nodeName === 'TD' || closestParentNode.nodeName === 'TH')) && !ej2_base_1.isNullOrUndefined(liElement) && !isCursor) {
|
|
174
|
-
range.extractContents();
|
|
175
|
-
liElement.appendChild(node);
|
|
176
|
-
this.removeEmptyNextLI(liElement);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
range.deleteContents();
|
|
180
|
-
if (isCursor && range.startContainer.textContent === '' && range.startContainer.nodeName !== 'BR') {
|
|
181
|
-
range.startContainer.innerHTML = '';
|
|
182
|
-
}
|
|
183
|
-
if (ej2_base_1.Browser.isIE) {
|
|
184
|
-
var frag = docElement.createDocumentFragment();
|
|
185
|
-
frag.appendChild(node);
|
|
186
|
-
range.insertNode(frag);
|
|
187
|
-
}
|
|
188
|
-
else if (range.startContainer.nodeType === 1 && range.startContainer.nodeName.toLowerCase() === 'hr'
|
|
189
|
-
&& range.endContainer.nodeName.toLowerCase() === 'hr') {
|
|
190
|
-
var paraElem = range.startContainer.nextElementSibling;
|
|
191
|
-
if (paraElem) {
|
|
192
|
-
if (paraElem.querySelector('br')) {
|
|
193
|
-
ej2_base_1.detach(paraElem.querySelector('br'));
|
|
194
|
-
}
|
|
195
|
-
paraElem.appendChild(node);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
else {
|
|
199
|
-
if (range.startContainer.nodeName === 'BR') {
|
|
200
|
-
range.startContainer.parentElement.insertBefore(node, range.startContainer);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
range.insertNode(node);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
if (node.nodeType !== 3 && node.childNodes.length > 0) {
|
|
208
|
-
nodeSelection.setSelectionText(docElement, node, node, 1, 1);
|
|
209
|
-
}
|
|
210
|
-
else if (node.nodeName === 'IMG') {
|
|
211
|
-
this.imageFocus(node, nodeSelection, docElement);
|
|
212
|
-
}
|
|
213
|
-
else if (node.nodeType !== 3) {
|
|
214
|
-
nodeSelection.setSelectionContents(docElement, node);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
nodeSelection.setSelectionText(docElement, node, node, node.textContent.length, node.textContent.length);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
if (!ej2_base_1.isNullOrUndefined(editNode) && scrollHeight < editNode.scrollHeight && node.nodeType === 1 && (node.nodeName === 'IMG' || !ej2_base_1.isNullOrUndefined(node.querySelector('img')))) {
|
|
221
|
-
util_1.scrollToCursor(docElement, editNode);
|
|
222
|
-
}
|
|
223
|
-
};
|
|
224
|
-
InsertHtml.removeEmptyNextLI = function (liElement) {
|
|
225
|
-
var rootList = ej2_base_1.closest(liElement, 'ul,ol');
|
|
226
|
-
while (rootList && rootList.parentElement && rootList.parentElement.nodeName === 'LI') {
|
|
227
|
-
rootList = ej2_base_1.closest(rootList.parentElement, 'ul,ol');
|
|
228
|
-
}
|
|
229
|
-
if (!rootList) {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
var listItems = rootList.querySelectorAll('li');
|
|
233
|
-
var isEmptyListItem = function (item) {
|
|
234
|
-
return item.textContent.trim() === '' &&
|
|
235
|
-
!item.querySelector('audio,video,img,table,br');
|
|
236
|
-
};
|
|
237
|
-
listItems.forEach(function (item) {
|
|
238
|
-
if (isEmptyListItem(item)) {
|
|
239
|
-
ej2_base_1.detach(item);
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
};
|
|
243
|
-
InsertHtml.findFirstTextNode = function (node) {
|
|
244
|
-
if (node.nodeType === Node.TEXT_NODE) {
|
|
245
|
-
return node;
|
|
246
|
-
}
|
|
247
|
-
for (var i = 0; i < node.childNodes.length; i++) {
|
|
248
|
-
var textNode = this.findFirstTextNode(node.childNodes[i]);
|
|
249
|
-
if (!ej2_base_1.isNullOrUndefined(textNode)) {
|
|
250
|
-
return textNode;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
return null;
|
|
254
|
-
};
|
|
255
|
-
InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
|
|
256
|
-
var blockElement = this.getImmediateBlockNode(nodes[nodes.length - 1], editNode);
|
|
257
|
-
if (blockElement && blockElement.textContent.length === 0) {
|
|
258
|
-
var brElement = blockElement.querySelector('br:last-of-type');
|
|
259
|
-
if (brElement) {
|
|
260
|
-
brElement.classList.add('rte-temp-br');
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
var isCursor = range.startOffset === range.endOffset &&
|
|
264
|
-
range.startContainer === range.endContainer;
|
|
265
|
-
if (isCursor && range.startContainer === editNode && editNode.textContent === '' && range.startOffset === 0 && range.endOffset === 0) {
|
|
266
|
-
var currentBlockNode = this.getImmediateBlockNode(nodes[nodes.length - 1], editNode);
|
|
267
|
-
nodeSelection.setSelectionText(docElement, currentBlockNode, currentBlockNode, 0, 0);
|
|
268
|
-
range = nodeSelection.getRange(docElement);
|
|
269
|
-
}
|
|
270
|
-
var lasNode;
|
|
271
|
-
var sibNode;
|
|
272
|
-
var isSingleNode;
|
|
273
|
-
var preNode;
|
|
274
|
-
if (editNode !== range.startContainer && ((!isCollapsed && !(closestParentNode.nodeType === Node.ELEMENT_NODE &&
|
|
275
|
-
CONSTANT.TABLE_BLOCK_TAGS.indexOf(closestParentNode.tagName.toLocaleLowerCase()) !== -1))
|
|
276
|
-
|| (node.nodeName.toLowerCase() === 'table' && closestParentNode &&
|
|
277
|
-
CONSTANT.TABLE_BLOCK_TAGS.indexOf(closestParentNode.tagName.toLocaleLowerCase()) === -1))) {
|
|
278
|
-
preNode = nodeCutter.GetSpliceNode(range, closestParentNode);
|
|
279
|
-
if (!ej2_base_1.isNullOrUndefined(preNode)) {
|
|
280
|
-
sibNode = ej2_base_1.isNullOrUndefined(preNode.previousSibling) ? preNode.parentNode.previousSibling : preNode.previousSibling;
|
|
281
|
-
if (nodes.length === 1) {
|
|
282
|
-
nodeSelection.setSelectionContents(docElement, preNode);
|
|
283
|
-
range = nodeSelection.getRange(docElement);
|
|
284
|
-
isSingleNode = true;
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
lasNode = nodeCutter.GetSpliceNode(range, nodes[nodes.length - 1].parentElement);
|
|
288
|
-
lasNode = ej2_base_1.isNullOrUndefined(lasNode) ? preNode : lasNode;
|
|
289
|
-
nodeSelection.setSelectionText(docElement, preNode, lasNode, 0, (lasNode.nodeType === 3) ?
|
|
290
|
-
lasNode.textContent.length : lasNode.childNodes.length);
|
|
291
|
-
range = nodeSelection.getRange(docElement);
|
|
292
|
-
isSingleNode = false;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
var containsBlockNode = false;
|
|
297
|
-
this.removingComments(node);
|
|
298
|
-
var allChildNodes = node.childNodes;
|
|
299
|
-
for (var i = 0; i < allChildNodes.length; i++) {
|
|
300
|
-
if (CONSTANT.BLOCK_TAGS.indexOf(allChildNodes[i].nodeName.toLocaleLowerCase()) >= 0) {
|
|
301
|
-
containsBlockNode = true;
|
|
302
|
-
break;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
var lastSelectionNode;
|
|
306
|
-
var fragment = document.createDocumentFragment();
|
|
307
|
-
if (!containsBlockNode) {
|
|
308
|
-
if (!isCursor) {
|
|
309
|
-
while (node.firstChild) {
|
|
310
|
-
lastSelectionNode = node.firstChild;
|
|
311
|
-
fragment.appendChild(node.firstChild);
|
|
312
|
-
}
|
|
313
|
-
if (isSingleNode) {
|
|
314
|
-
range.deleteContents();
|
|
315
|
-
this.removeEmptyElements(editNode, true);
|
|
316
|
-
range.insertNode(fragment);
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
var startContainerParent = editNode === range.startContainer ?
|
|
320
|
-
range.startContainer : range.startContainer.parentNode;
|
|
321
|
-
var startIndex = Array.prototype.indexOf.call(startContainerParent.childNodes, (ej2_base_1.Browser.userAgent.indexOf('Firefox') !== -1 && editNode === range.startContainer) ? range.startContainer.firstChild : range.startContainer);
|
|
322
|
-
range.deleteContents();
|
|
323
|
-
if (startIndex !== -1) {
|
|
324
|
-
range.setStart(startContainerParent, startIndex);
|
|
325
|
-
range.setEnd(startContainerParent, startIndex);
|
|
326
|
-
}
|
|
327
|
-
if (!ej2_base_1.isNullOrUndefined(lasNode) && lasNode !== editNode) {
|
|
328
|
-
ej2_base_1.detach(lasNode);
|
|
329
|
-
this.removeEmptyElements(editNode, true);
|
|
330
|
-
}
|
|
331
|
-
!ej2_base_1.isNullOrUndefined(sibNode) ? (sibNode.parentNode === editNode ? sibNode.appendChild(fragment) : sibNode.parentNode.appendChild(fragment)) : range.insertNode(fragment);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
else {
|
|
335
|
-
var tempSpan = ej2_base_1.createElement('span', { className: 'tempSpan' });
|
|
336
|
-
var nearestAnchor = ej2_base_1.closest(range.startContainer.parentElement, 'a');
|
|
337
|
-
if (range.startContainer.nodeType === 3 && nearestAnchor && ej2_base_1.closest(nearestAnchor, 'span')) {
|
|
338
|
-
var immediateBlockNode = this.getImmediateBlockNode(range.startContainer, editNode);
|
|
339
|
-
if (immediateBlockNode.querySelectorAll('br').length > 0) {
|
|
340
|
-
ej2_base_1.detach(immediateBlockNode.querySelector('br'));
|
|
341
|
-
}
|
|
342
|
-
var rangeElement = ej2_base_1.closest(nearestAnchor, 'span');
|
|
343
|
-
rangeElement.appendChild(tempSpan);
|
|
344
|
-
}
|
|
345
|
-
else if (nodes[0] && nodes[0].nodeName === '#text' && nodes[0].nodeValue.includes('\u200B') && !ej2_base_1.isNullOrUndefined(nodes[0].parentElement) && !ej2_base_1.isNullOrUndefined(nodes[0].parentElement.previousElementSibling) && nodes[0].parentElement.previousElementSibling.classList.contains('e-mention-chip')) {
|
|
346
|
-
range.startContainer.parentElement.insertAdjacentElement('afterend', tempSpan);
|
|
347
|
-
}
|
|
348
|
-
else {
|
|
349
|
-
range.insertNode(tempSpan);
|
|
350
|
-
}
|
|
351
|
-
while (node.firstChild) {
|
|
352
|
-
lastSelectionNode = node.firstChild;
|
|
353
|
-
fragment.appendChild(node.firstChild);
|
|
354
|
-
}
|
|
355
|
-
var matchedElement = this.getClosestMatchingElement(tempSpan.parentNode, fragment);
|
|
356
|
-
if (fragment.childNodes.length === 1 && fragment.firstChild && matchedElement) {
|
|
357
|
-
var wrapperDiv = document.createElement('div');
|
|
358
|
-
var text = fragment.firstChild.textContent || '';
|
|
359
|
-
wrapperDiv.innerHTML = fragment.firstChild.innerHTML || '';
|
|
360
|
-
var replacementNode = lastSelectionNode = wrapperDiv.firstChild;
|
|
361
|
-
if (replacementNode) {
|
|
362
|
-
matchedElement.replaceChild(replacementNode, tempSpan);
|
|
363
|
-
if (matchedElement.parentNode && replacementNode.nodeType === Node.TEXT_NODE && ((replacementNode.previousSibling &&
|
|
364
|
-
replacementNode.previousSibling.nodeType === Node.TEXT_NODE) ||
|
|
365
|
-
(replacementNode.nextSibling && replacementNode.nextSibling.nodeType === Node.TEXT_NODE))) {
|
|
366
|
-
matchedElement.parentNode.normalize();
|
|
367
|
-
var startOffset = range.startOffset + text.length;
|
|
368
|
-
nodeSelection.setCursorPoint(docElement, matchedElement.firstChild, startOffset);
|
|
369
|
-
lastSelectionNode = null;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
wrapperDiv.remove();
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
tempSpan.parentNode.replaceChild(fragment, tempSpan);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
else {
|
|
380
|
-
var parentElem = range.startContainer;
|
|
381
|
-
while (!ej2_base_1.isNullOrUndefined(parentElem) && parentElem.nodeName !== 'PRE' && parentElem !== editNode) {
|
|
382
|
-
parentElem = parentElem.parentElement;
|
|
383
|
-
}
|
|
384
|
-
if (!ej2_base_1.isNullOrUndefined(node) && !ej2_base_1.isNullOrUndefined(parentElem) && parentElem.nodeName === 'PRE') {
|
|
385
|
-
range.insertNode(node);
|
|
386
|
-
lastSelectionNode = node.lastChild;
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
this.insertTempNode(range, node, nodes, nodeCutter, editNode);
|
|
390
|
-
var isFirstTextNode = true;
|
|
391
|
-
var isPreviousInlineElem = void 0;
|
|
392
|
-
var paraElm = void 0;
|
|
393
|
-
var previousParent = void 0;
|
|
394
|
-
if (!this.contentsDeleted) {
|
|
395
|
-
if (!isCollapsed && range.startContainer.parentElement.textContent.length === 0 && range.startContainer.nodeName === 'BR' && range.startContainer.parentElement.nodeName === 'P') {
|
|
396
|
-
editNode.removeChild(range.startContainer.parentElement);
|
|
397
|
-
}
|
|
398
|
-
range.deleteContents();
|
|
399
|
-
}
|
|
400
|
-
while (node.firstChild) {
|
|
401
|
-
if (node.firstChild.nodeName === '#text' && node.firstChild.textContent.trim() === '') {
|
|
402
|
-
ej2_base_1.detach(node.firstChild);
|
|
403
|
-
continue;
|
|
404
|
-
}
|
|
405
|
-
if (node.firstChild.nodeName === '#text' && isFirstTextNode ||
|
|
406
|
-
(this.inlineNode.indexOf(node.firstChild.nodeName.toLocaleLowerCase()) >= 0 && isFirstTextNode)) {
|
|
407
|
-
lastSelectionNode = node.firstChild;
|
|
408
|
-
if (ej2_base_1.isNullOrUndefined(node.previousElementSibling)) {
|
|
409
|
-
var firstParaElm = enterAction === 'DIV' ? ej2_base_1.createElement('div') : ej2_base_1.createElement('p');
|
|
410
|
-
node.parentElement.insertBefore(firstParaElm, node);
|
|
411
|
-
}
|
|
412
|
-
if (node.previousElementSibling.nodeName === 'BR') {
|
|
413
|
-
node.parentElement.insertBefore(node.firstChild, node);
|
|
414
|
-
}
|
|
415
|
-
else {
|
|
416
|
-
node.previousElementSibling.appendChild(node.firstChild);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
lastSelectionNode = node.firstChild;
|
|
421
|
-
if (node.firstChild.nodeName === '#text' ||
|
|
422
|
-
(this.inlineNode.indexOf(node.firstChild.nodeName.toLocaleLowerCase()) >= 0)) {
|
|
423
|
-
if (!isPreviousInlineElem) {
|
|
424
|
-
paraElm = enterAction === 'DIV' ? ej2_base_1.createElement('div') : ej2_base_1.createElement('p');
|
|
425
|
-
paraElm.appendChild(node.firstChild);
|
|
426
|
-
fragment.appendChild(paraElm);
|
|
427
|
-
}
|
|
428
|
-
else {
|
|
429
|
-
previousParent.appendChild(node.firstChild);
|
|
430
|
-
fragment.appendChild(previousParent);
|
|
431
|
-
}
|
|
432
|
-
previousParent = paraElm;
|
|
433
|
-
isPreviousInlineElem = true;
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
fragment.appendChild(node.firstChild);
|
|
437
|
-
isPreviousInlineElem = false;
|
|
438
|
-
}
|
|
439
|
-
isFirstTextNode = false;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
node.parentNode.replaceChild(fragment, node);
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
if (lastSelectionNode instanceof Element && lastSelectionNode.nodeName === 'GOOGLE-SHEETS-HTML-ORIGIN') {
|
|
446
|
-
var tableEle = lastSelectionNode.querySelector('table');
|
|
447
|
-
var colGroup = tableEle.querySelector('colgroup');
|
|
448
|
-
if (colGroup) {
|
|
449
|
-
for (var i = 0; i < tableEle.rows.length; i++) {
|
|
450
|
-
for (var k = 0; k < tableEle.rows[i].cells.length; k++) {
|
|
451
|
-
if (colGroup.querySelectorAll('col')[k].hasAttribute('width')) {
|
|
452
|
-
var width = colGroup.querySelectorAll('col')[k].getAttribute('width');
|
|
453
|
-
tableEle.rows[i].cells[k].style.width = width + 'px';
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
if (lastSelectionNode && lastSelectionNode.nodeName === 'TABLE') {
|
|
460
|
-
var pTag = ej2_base_1.createElement('p');
|
|
461
|
-
pTag.appendChild(ej2_base_1.createElement('br'));
|
|
462
|
-
lastSelectionNode.parentElement.insertBefore(pTag, lastSelectionNode.nextSibling);
|
|
463
|
-
lastSelectionNode = pTag;
|
|
464
|
-
}
|
|
465
|
-
if (lastSelectionNode && lastSelectionNode.nodeName === '#text') {
|
|
466
|
-
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
467
|
-
}
|
|
468
|
-
else if (lastSelectionNode && lastSelectionNode.nodeName === 'HR') {
|
|
469
|
-
var nextSiblingNode = lastSelectionNode.nextSibling ? lastSelectionNode.nextSibling : null;
|
|
470
|
-
var siblingTag = enterAction === 'DIV' ? ej2_base_1.createElement('div') : ej2_base_1.createElement('p');
|
|
471
|
-
siblingTag.appendChild(ej2_base_1.createElement('br'));
|
|
472
|
-
if (!ej2_base_1.isNullOrUndefined(nextSiblingNode) && nextSiblingNode.nodeName === 'HR') {
|
|
473
|
-
lastSelectionNode.parentNode.insertBefore(siblingTag, nextSiblingNode);
|
|
474
|
-
lastSelectionNode = siblingTag;
|
|
475
|
-
}
|
|
476
|
-
else if (!ej2_base_1.isNullOrUndefined(nextSiblingNode)) {
|
|
477
|
-
lastSelectionNode = nextSiblingNode;
|
|
478
|
-
}
|
|
479
|
-
else {
|
|
480
|
-
lastSelectionNode.parentNode.appendChild(siblingTag);
|
|
481
|
-
lastSelectionNode.parentNode.insertBefore(lastSelectionNode, siblingTag);
|
|
482
|
-
lastSelectionNode = siblingTag;
|
|
483
|
-
}
|
|
484
|
-
nodeSelection.setSelectionText(docElement, lastSelectionNode, lastSelectionNode, 0, 0);
|
|
485
|
-
}
|
|
486
|
-
else if (lastSelectionNode) {
|
|
487
|
-
this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
488
|
-
}
|
|
489
|
-
this.alignCheck(editNode);
|
|
490
|
-
this.listCleanUp(nodeSelection, docElement);
|
|
491
|
-
this.removeEmptyBrFromParagraph(editNode);
|
|
492
|
-
};
|
|
493
|
-
InsertHtml.removeEmptyBrFromParagraph = function (editNode) {
|
|
494
|
-
var tempBr = editNode.querySelector('br.rte-temp-br');
|
|
495
|
-
if (tempBr) {
|
|
496
|
-
tempBr.remove();
|
|
497
|
-
}
|
|
498
|
-
};
|
|
499
|
-
InsertHtml.compareParentElements = function (el1, el2) {
|
|
500
|
-
if (!el1 || !el2) {
|
|
501
|
-
return false;
|
|
502
|
-
}
|
|
503
|
-
if (el1.tagName !== el2.tagName) {
|
|
504
|
-
return false;
|
|
505
|
-
}
|
|
506
|
-
return this.getFilteredAttributes(el1) === this.getFilteredAttributes(el2);
|
|
507
|
-
};
|
|
508
|
-
InsertHtml.getFilteredAttributes = function (element) {
|
|
509
|
-
return Array.from(element.attributes)
|
|
510
|
-
.map(function (attr) {
|
|
511
|
-
if (attr.name === 'class') {
|
|
512
|
-
var filteredClass = attr.value.split(' ')
|
|
513
|
-
.filter(function (cls) { return cls !== 'pasteContent_RTE'; })
|
|
514
|
-
.join(' ');
|
|
515
|
-
return filteredClass ? "class='" + filteredClass + "'" : '';
|
|
516
|
-
}
|
|
517
|
-
return attr.name + "='" + attr.value + "'";
|
|
518
|
-
})
|
|
519
|
-
.filter(function (attr) { return attr.length > 0; })
|
|
520
|
-
.sort()
|
|
521
|
-
.join(' ');
|
|
522
|
-
};
|
|
523
|
-
InsertHtml.getClosestMatchingElement = function (startNode, fragment) {
|
|
524
|
-
var currentNode = startNode;
|
|
525
|
-
while (currentNode) {
|
|
526
|
-
var matchingPastedNode = this.findMatchingChild(fragment, currentNode);
|
|
527
|
-
if (matchingPastedNode) {
|
|
528
|
-
return currentNode;
|
|
529
|
-
}
|
|
530
|
-
currentNode = currentNode.parentElement;
|
|
531
|
-
}
|
|
532
|
-
return null;
|
|
533
|
-
};
|
|
534
|
-
InsertHtml.findMatchingChild = function (fragment, targetNode) {
|
|
535
|
-
for (var _i = 0, _a = Array.from(fragment.children); _i < _a.length; _i++) {
|
|
536
|
-
var node = _a[_i];
|
|
537
|
-
if (this.compareParentElements(node, targetNode)) {
|
|
538
|
-
return node;
|
|
539
|
-
}
|
|
540
|
-
var deeperMatch = this.findMatchingChild(node, targetNode);
|
|
541
|
-
if (deeperMatch) {
|
|
542
|
-
return deeperMatch;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
return null;
|
|
546
|
-
};
|
|
547
|
-
InsertHtml.listCleanUp = function (nodeSelection, docElement) {
|
|
548
|
-
var range = nodeSelection.getRange(docElement);
|
|
549
|
-
var startContainer = range.startContainer;
|
|
550
|
-
var startOffset = range.startOffset;
|
|
551
|
-
var startParentElement = range.startContainer.parentElement;
|
|
552
|
-
var endParentElement = range.endContainer.parentElement;
|
|
553
|
-
if (!ej2_base_1.isNullOrUndefined(startParentElement) && !ej2_base_1.isNullOrUndefined(endParentElement)) {
|
|
554
|
-
var startClosestList = startParentElement.closest('ol, ul');
|
|
555
|
-
var endClosestList = endParentElement.closest('ol, ul');
|
|
556
|
-
if (!ej2_base_1.isNullOrUndefined(startClosestList) && !ej2_base_1.isNullOrUndefined(endClosestList)) {
|
|
557
|
-
var hasListCleanUp = this.cleanUpListItems(startClosestList);
|
|
558
|
-
var hasListContainerCleanUp = this.cleanUpListContainer(startClosestList);
|
|
559
|
-
if (hasListCleanUp || hasListContainerCleanUp) {
|
|
560
|
-
range.setStart(startContainer, startOffset);
|
|
561
|
-
range.setEnd(startContainer, startOffset);
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
};
|
|
566
|
-
InsertHtml.cleanUpListItems = function (parentContainer) {
|
|
567
|
-
var _this = this;
|
|
568
|
-
var hasListCleanUp = false;
|
|
569
|
-
var listItems;
|
|
570
|
-
if (!ej2_base_1.isNullOrUndefined(parentContainer.closest('ol, ul'))) {
|
|
571
|
-
listItems = parentContainer.closest('ol, ul').querySelectorAll('li');
|
|
572
|
-
}
|
|
573
|
-
if (ej2_base_1.isNullOrUndefined(listItems) || listItems.length === 0) {
|
|
574
|
-
return false;
|
|
575
|
-
}
|
|
576
|
-
var nearestListItem = null;
|
|
577
|
-
listItems.forEach(function (listItem) {
|
|
578
|
-
var parentElement = listItem.parentElement;
|
|
579
|
-
if (!ej2_base_1.isNullOrUndefined(parentElement) && parentElement.nodeName !== 'OL' && parentElement.nodeName !== 'UL') {
|
|
580
|
-
if (ej2_base_1.isNullOrUndefined(nearestListItem)) {
|
|
581
|
-
nearestListItem = parentElement.closest('li');
|
|
582
|
-
}
|
|
583
|
-
if (!ej2_base_1.isNullOrUndefined(nearestListItem)) {
|
|
584
|
-
var nextSibling = listItem.nextSibling;
|
|
585
|
-
if (!ej2_base_1.isNullOrUndefined(nextSibling) && nextSibling.nodeName !== 'LI') {
|
|
586
|
-
var startIndex = Array.prototype.indexOf.call(parentElement.childNodes, nextSibling);
|
|
587
|
-
var clonedParent = parentElement.cloneNode(false);
|
|
588
|
-
var totalChildren = parentElement.childNodes.length;
|
|
589
|
-
for (var i = startIndex; i < totalChildren; i++) {
|
|
590
|
-
clonedParent.appendChild(parentElement.childNodes[startIndex]);
|
|
591
|
-
}
|
|
592
|
-
if (clonedParent.childNodes.length > 0) {
|
|
593
|
-
var newListItem = document.createElement('li');
|
|
594
|
-
newListItem.appendChild(clonedParent);
|
|
595
|
-
nearestListItem.insertAdjacentElement('afterend', newListItem);
|
|
596
|
-
}
|
|
597
|
-
else {
|
|
598
|
-
clonedParent.remove();
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
var closestList = parentElement.closest('ol, ul');
|
|
602
|
-
nearestListItem.insertAdjacentElement('afterend', listItem);
|
|
603
|
-
nearestListItem = nearestListItem.nextSibling;
|
|
604
|
-
if (!ej2_base_1.isNullOrUndefined(closestList)) {
|
|
605
|
-
_this.removeEmptyElements(closestList);
|
|
606
|
-
}
|
|
607
|
-
hasListCleanUp = true;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
var cleanUpFlattenListContainer = this.cleanUpFlattenListContainer(parentContainer);
|
|
612
|
-
hasListCleanUp = cleanUpFlattenListContainer ? cleanUpFlattenListContainer : hasListCleanUp;
|
|
613
|
-
return hasListCleanUp;
|
|
614
|
-
};
|
|
615
|
-
InsertHtml.cleanUpFlattenListContainer = function (parentContainer) {
|
|
616
|
-
var hasListCleanUp = false;
|
|
617
|
-
var listItems;
|
|
618
|
-
if (!ej2_base_1.isNullOrUndefined(parentContainer.closest('ol, ul'))) {
|
|
619
|
-
listItems = parentContainer.closest('ol, ul').querySelectorAll('li');
|
|
620
|
-
}
|
|
621
|
-
if (ej2_base_1.isNullOrUndefined(listItems) || listItems.length === 0) {
|
|
622
|
-
return false;
|
|
623
|
-
}
|
|
624
|
-
listItems.forEach(function (listItem) {
|
|
625
|
-
if (!ej2_base_1.isNullOrUndefined(listItem.firstChild) && (listItem.firstChild.nodeName === 'OL' || listItem.firstChild.nodeName === 'UL')) {
|
|
626
|
-
listItem.style.listStyleType = 'none';
|
|
627
|
-
}
|
|
628
|
-
var nestedLi = Array.from(listItem.children).find(function (child) {
|
|
629
|
-
return child.tagName === 'LI' && (child.parentElement && child.parentElement.tagName !== 'OL' && child.parentElement.tagName !== 'UL');
|
|
630
|
-
});
|
|
631
|
-
if (!ej2_base_1.isNullOrUndefined(nestedLi) && !ej2_base_1.isNullOrUndefined(listItem.parentNode)) {
|
|
632
|
-
listItem.parentNode.replaceChild(nestedLi, listItem);
|
|
633
|
-
if (ej2_base_1.isNullOrUndefined(nestedLi.textContent) || nestedLi.textContent.trim() === '') {
|
|
634
|
-
nestedLi.remove();
|
|
635
|
-
}
|
|
636
|
-
hasListCleanUp = true;
|
|
637
|
-
}
|
|
638
|
-
});
|
|
639
|
-
return hasListCleanUp;
|
|
640
|
-
};
|
|
641
|
-
InsertHtml.cleanUpListContainer = function (parentList) {
|
|
642
|
-
var hasListContainerCleanUp = false;
|
|
643
|
-
var nonLiElementCollection = [];
|
|
644
|
-
var replacements = [];
|
|
645
|
-
if (!ej2_base_1.isNullOrUndefined(parentList)) {
|
|
646
|
-
parentList.childNodes.forEach(function (childNode) {
|
|
647
|
-
if (childNode.nodeName.toLocaleUpperCase() !== 'LI') {
|
|
648
|
-
nonLiElementCollection.push(childNode);
|
|
649
|
-
}
|
|
650
|
-
if ((childNode.nodeName.toLocaleUpperCase() === 'LI' || parentList.lastChild === childNode) && nonLiElementCollection.length > 0) {
|
|
651
|
-
replacements.push({ elements: nonLiElementCollection.slice() });
|
|
652
|
-
nonLiElementCollection = [];
|
|
653
|
-
}
|
|
654
|
-
});
|
|
655
|
-
replacements.forEach(function (_a) {
|
|
656
|
-
var elements = _a.elements;
|
|
657
|
-
var newListItem = document.createElement('li');
|
|
658
|
-
elements[0].parentNode.replaceChild(newListItem, elements[0]);
|
|
659
|
-
elements.forEach(function (child) { return newListItem.appendChild(child); });
|
|
660
|
-
if (newListItem.textContent && newListItem.textContent.trim() === '' && !newListItem.querySelector('img')) {
|
|
661
|
-
parentList.removeChild(newListItem);
|
|
662
|
-
}
|
|
663
|
-
hasListContainerCleanUp = true;
|
|
664
|
-
});
|
|
665
|
-
}
|
|
666
|
-
return hasListContainerCleanUp;
|
|
667
|
-
};
|
|
668
|
-
InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
669
|
-
lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (ej2_base_1.isNullOrUndefined(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
|
|
670
|
-
: lastSelectionNode.previousSibling) : lastSelectionNode;
|
|
671
|
-
while (!ej2_base_1.isNullOrUndefined(lastSelectionNode) && lastSelectionNode.nodeName !== '#text' && lastSelectionNode.nodeName !== 'IMG' &&
|
|
672
|
-
lastSelectionNode.nodeName !== 'BR' && lastSelectionNode.nodeName !== 'HR') {
|
|
673
|
-
if (!ej2_base_1.isNullOrUndefined(lastSelectionNode.lastChild) && (lastSelectionNode.lastChild.nodeName === 'P' &&
|
|
674
|
-
lastSelectionNode.lastChild.innerHTML === '')) {
|
|
675
|
-
var lineBreak = ej2_base_1.createElement('br');
|
|
676
|
-
lastSelectionNode.lastChild.appendChild(lineBreak);
|
|
677
|
-
}
|
|
678
|
-
lastSelectionNode = lastSelectionNode.lastChild;
|
|
679
|
-
}
|
|
680
|
-
lastSelectionNode = ej2_base_1.isNullOrUndefined(lastSelectionNode) ? node : lastSelectionNode;
|
|
681
|
-
if (lastSelectionNode.nodeName === 'IMG') {
|
|
682
|
-
this.imageFocus(lastSelectionNode, nodeSelection, docElement);
|
|
683
|
-
}
|
|
684
|
-
else {
|
|
685
|
-
nodeSelection.setSelectionText(docElement, lastSelectionNode, lastSelectionNode, lastSelectionNode.textContent.length, lastSelectionNode.textContent.length);
|
|
686
|
-
}
|
|
687
|
-
this.removeEmptyElements(editNode);
|
|
688
|
-
};
|
|
689
|
-
InsertHtml.getNodeCollection = function (range, nodeSelection, node) {
|
|
690
|
-
var nodes = [];
|
|
691
|
-
if (range.startOffset === range.endOffset && range.startContainer === range.endContainer &&
|
|
692
|
-
range.startContainer.nodeName !== 'BR' && range.startContainer.childNodes.length > 0 &&
|
|
693
|
-
(range.startContainer.nodeName === 'TD' || (range.startContainer.nodeType !== 3 &&
|
|
694
|
-
node.classList && node.classList.contains('pasteContent')))) {
|
|
695
|
-
nodes.push(range.startContainer.childNodes[range.endOffset]);
|
|
696
|
-
}
|
|
697
|
-
else {
|
|
698
|
-
nodes = nodeSelection.getInsertNodeCollection(range);
|
|
699
|
-
}
|
|
700
|
-
return nodes;
|
|
701
|
-
};
|
|
702
|
-
InsertHtml.insertTempNode = function (range, node, nodes, nodeCutter, editNode) {
|
|
703
|
-
if (range.startContainer === editNode && !ej2_base_1.isNullOrUndefined(range.startContainer.childNodes[range.endOffset - 1]) &&
|
|
704
|
-
range.startContainer.childNodes[range.endOffset - 1].nodeName === 'TABLE') {
|
|
705
|
-
if (ej2_base_1.isNullOrUndefined(range.startContainer.childNodes[range.endOffset - 1].nextSibling)) {
|
|
706
|
-
range.startContainer.appendChild(node);
|
|
707
|
-
}
|
|
708
|
-
else {
|
|
709
|
-
range.startContainer.insertBefore(node, range.startContainer.childNodes[range.endOffset - 1].nextSibling);
|
|
710
|
-
}
|
|
711
|
-
}
|
|
712
|
-
else if (range.startContainer === editNode && !ej2_base_1.isNullOrUndefined(range.startContainer.childNodes[range.endOffset]) &&
|
|
713
|
-
range.startContainer.childNodes[range.endOffset].nodeName === 'TABLE') {
|
|
714
|
-
range.startContainer.appendChild(node);
|
|
715
|
-
}
|
|
716
|
-
else if (range.startContainer === range.endContainer && range.startContainer.nodeType !== 3
|
|
717
|
-
&& node.firstChild.nodeName === 'HR') {
|
|
718
|
-
if (range.startContainer.classList.contains('e-content') || range.startContainer.nodeName === 'BODY') {
|
|
719
|
-
range.startContainer.appendChild(node);
|
|
720
|
-
}
|
|
721
|
-
else {
|
|
722
|
-
range.startContainer.parentNode.insertBefore(node, range.startContainer);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
else {
|
|
726
|
-
var blockNode = this.getImmediateBlockNode(nodes[nodes.length - 1], editNode);
|
|
727
|
-
if ((ej2_base_1.isNullOrUndefined(blockNode) || ej2_base_1.isNullOrUndefined(blockNode.parentElement)) && range.endContainer.nodeType !== 3) {
|
|
728
|
-
blockNode = range.endContainer;
|
|
729
|
-
range.setEnd(blockNode, range.endContainer.textContent.length);
|
|
730
|
-
}
|
|
731
|
-
if (blockNode && blockNode.nodeName === 'BODY' || blockNode.nodeName === 'DIV' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
|
|
732
|
-
blockNode = range.startContainer;
|
|
733
|
-
}
|
|
734
|
-
if (blockNode && blockNode.nodeName !== '#text' && blockNode.closest('LI') && editNode.contains(blockNode.closest('LI')) && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
|
|
735
|
-
((node).firstElementChild.tagName === 'OL' || node.firstElementChild.tagName === 'UL')) {
|
|
736
|
-
var liNode = void 0;
|
|
737
|
-
while (node.firstElementChild.lastElementChild && node.firstElementChild.lastElementChild.tagName === 'LI') {
|
|
738
|
-
liNode = node.firstElementChild.lastElementChild;
|
|
739
|
-
liNode.style.removeProperty('margin-left');
|
|
740
|
-
liNode.style.removeProperty('margin-top');
|
|
741
|
-
liNode.style.removeProperty('margin-bottom');
|
|
742
|
-
node.firstElementChild.insertAdjacentElement('afterend', liNode);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
if (blockNode && blockNode.nodeName === 'TD' || blockNode.nodeName === 'TH' || blockNode.nodeName === 'TR') {
|
|
746
|
-
var parentElem = range.startContainer;
|
|
747
|
-
while (!ej2_base_1.isNullOrUndefined(parentElem) && parentElem.parentElement !== blockNode) {
|
|
748
|
-
parentElem = parentElem.parentElement;
|
|
749
|
-
}
|
|
750
|
-
range.deleteContents();
|
|
751
|
-
var splitedElm = nodeCutter.GetSpliceNode(range, parentElem);
|
|
752
|
-
if (splitedElm) {
|
|
753
|
-
splitedElm.parentNode.replaceChild(node, splitedElm);
|
|
754
|
-
}
|
|
755
|
-
else {
|
|
756
|
-
range.insertNode(node);
|
|
757
|
-
}
|
|
758
|
-
this.contentsDeleted = true;
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
else {
|
|
762
|
-
var nodeSelection = new index_1.NodeSelection(editNode);
|
|
763
|
-
var currentNode = this.getNodeCollection(range, nodeSelection, node)[this.getNodeCollection(range, nodeSelection, node).length - 1];
|
|
764
|
-
var splitedElm = void 0;
|
|
765
|
-
if (currentNode && ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR' ||
|
|
766
|
-
(currentNode.nodeName === '#text' && !ej2_base_1.isNullOrUndefined(currentNode.parentElement) && currentNode.parentElement.nodeName === 'LI')) &&
|
|
767
|
-
(!ej2_base_1.isNullOrUndefined(currentNode.parentElement) && currentNode.parentElement.textContent.trim().length === 0))) {
|
|
768
|
-
splitedElm = currentNode;
|
|
769
|
-
if (currentNode.parentElement.nodeName === 'LI' && !ej2_base_1.isNullOrUndefined(currentNode.nextSibling) &&
|
|
770
|
-
currentNode.nextSibling.nodeName === 'BR') {
|
|
771
|
-
ej2_base_1.detach(currentNode.nextSibling);
|
|
772
|
-
}
|
|
773
|
-
if (currentNode.parentElement.nodeName === 'LI' && currentNode.parentElement.textContent === '') {
|
|
774
|
-
this.removeListfromPaste(range);
|
|
775
|
-
if (currentNode.parentElement.childNodes.length === 1 && currentNode.nodeName === 'BR') {
|
|
776
|
-
ej2_base_1.detach(currentNode);
|
|
777
|
-
}
|
|
778
|
-
range.insertNode(node);
|
|
779
|
-
this.contentsDeleted = true;
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
else if (currentNode && ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !ej2_base_1.isNullOrUndefined(currentNode.parentElement) &&
|
|
784
|
-
(currentNode.parentElement.nodeName === 'LI' || currentNode.parentElement.closest('LI') || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
|
|
785
|
-
currentNode.parentElement.textContent.trim().length > 0)) {
|
|
786
|
-
splitedElm = currentNode;
|
|
787
|
-
if (currentNode.parentElement.nodeName === 'LI' && !ej2_base_1.isNullOrUndefined(currentNode.nextSibling) &&
|
|
788
|
-
currentNode.nextSibling.nodeName === 'BR') {
|
|
789
|
-
ej2_base_1.detach(currentNode.nextSibling);
|
|
790
|
-
}
|
|
791
|
-
if (!range.collapsed) {
|
|
792
|
-
var startContainer = range.startContainer;
|
|
793
|
-
var startOffset = range.startOffset;
|
|
794
|
-
this.removeListfromPaste(range);
|
|
795
|
-
range.setStart(startContainer, startOffset);
|
|
796
|
-
range.setEnd(startContainer, startOffset);
|
|
797
|
-
}
|
|
798
|
-
range.insertNode(node);
|
|
799
|
-
this.contentsDeleted = true;
|
|
800
|
-
return;
|
|
801
|
-
}
|
|
802
|
-
else {
|
|
803
|
-
splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
|
|
804
|
-
}
|
|
805
|
-
splitedElm.parentNode.replaceChild(node, splitedElm);
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
};
|
|
809
|
-
InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
|
|
810
|
-
lastSelectionNode.classList.add('lastNode');
|
|
811
|
-
editNode.innerHTML = util_1.updateTextNode(editNode.innerHTML);
|
|
812
|
-
lastSelectionNode = editNode.querySelector('.lastNode');
|
|
813
|
-
if (!ej2_base_1.isNullOrUndefined(lastSelectionNode)) {
|
|
814
|
-
this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
|
|
815
|
-
lastSelectionNode.classList.remove('lastNode');
|
|
816
|
-
if (lastSelectionNode.classList.length === 0) {
|
|
817
|
-
lastSelectionNode.removeAttribute('class');
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
};
|
|
821
|
-
InsertHtml.imageFocus = function (node, nodeSelection, docElement) {
|
|
822
|
-
var focusNode = document.createTextNode(' ');
|
|
823
|
-
if (node.parentNode && node.parentNode.nodeName === 'A') {
|
|
824
|
-
var anchorTag = node.parentNode;
|
|
825
|
-
var parentNode = anchorTag.parentNode;
|
|
826
|
-
parentNode.insertBefore(focusNode, anchorTag.nextSibling);
|
|
827
|
-
parentNode.insertBefore(node, focusNode);
|
|
828
|
-
}
|
|
829
|
-
else {
|
|
830
|
-
node.parentNode.insertBefore(focusNode, node.nextSibling);
|
|
831
|
-
}
|
|
832
|
-
nodeSelection.setSelectionText(docElement, node.nextSibling, node.nextSibling, 0, 0);
|
|
833
|
-
};
|
|
834
|
-
InsertHtml.getImmediateBlockNode = function (node, editNode) {
|
|
835
|
-
while (node && CONSTANT.BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0) {
|
|
836
|
-
node = node.parentNode;
|
|
837
|
-
}
|
|
838
|
-
return node;
|
|
839
|
-
};
|
|
840
|
-
InsertHtml.removingComments = function (elm) {
|
|
841
|
-
var innerElement = elm.innerHTML;
|
|
842
|
-
innerElement = innerElement.replace(/<!--[\s\S]*?-->/g, '');
|
|
843
|
-
elm.innerHTML = innerElement;
|
|
844
|
-
};
|
|
845
|
-
InsertHtml.findDetachEmptyElem = function (element, ignoreBlockNodes) {
|
|
846
|
-
if (ignoreBlockNodes === void 0) { ignoreBlockNodes = false; }
|
|
847
|
-
var removableElement;
|
|
848
|
-
if (!ej2_base_1.isNullOrUndefined(element.parentElement)) {
|
|
849
|
-
var hasNbsp = element.parentElement.textContent.length > 0 && element.parentElement.textContent.match(/\u00a0/g)
|
|
850
|
-
&& element.parentElement.textContent.match(/\u00a0/g).length > 0;
|
|
851
|
-
if (!hasNbsp && element.parentElement.textContent.trim() === '' && element.parentElement.contentEditable !== 'true' &&
|
|
852
|
-
ej2_base_1.isNullOrUndefined(element.parentElement.querySelector('img')) && element.parentElement.nodeName !== 'TD' && element.parentElement.nodeName !== 'TH') {
|
|
853
|
-
removableElement = ignoreBlockNodes && CONSTANT.BLOCK_TAGS.indexOf(element.parentElement.tagName.toLowerCase()) !== -1 ?
|
|
854
|
-
element : this.findDetachEmptyElem(element.parentElement, ignoreBlockNodes);
|
|
855
|
-
}
|
|
856
|
-
else {
|
|
857
|
-
removableElement = ignoreBlockNodes && CONSTANT.BLOCK_TAGS.indexOf(element.tagName.toLowerCase()) !== -1 ? null :
|
|
858
|
-
element;
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
else {
|
|
862
|
-
removableElement = null;
|
|
863
|
-
}
|
|
864
|
-
return removableElement;
|
|
865
|
-
};
|
|
866
|
-
InsertHtml.removeEmptyElements = function (element, ignoreBlockNodes, emptyElemet) {
|
|
867
|
-
if (ignoreBlockNodes === void 0) { ignoreBlockNodes = false; }
|
|
868
|
-
if (emptyElemet === void 0) { emptyElemet = null; }
|
|
869
|
-
var emptyElements = element.querySelectorAll(':empty');
|
|
870
|
-
var filteredEmptyElements = Array.from(emptyElements).filter(function (element) {
|
|
871
|
-
var tagName = element.tagName.toLowerCase();
|
|
872
|
-
var meaningfulEmptyTags = ['td', 'th', 'textarea', 'input', 'img', 'video', 'audio', 'br', 'hr', 'iframe'];
|
|
873
|
-
return !element.closest('svg') && !element.closest('canvas') && !(meaningfulEmptyTags.indexOf(tagName) > -1);
|
|
874
|
-
});
|
|
875
|
-
for (var i = 0; i < filteredEmptyElements.length; i++) {
|
|
876
|
-
var lineWithDiv = true;
|
|
877
|
-
var currentEmptyElem = filteredEmptyElements[i];
|
|
878
|
-
if (currentEmptyElem.tagName === 'DIV') {
|
|
879
|
-
lineWithDiv = currentEmptyElem.style.borderBottom === 'none' ||
|
|
880
|
-
currentEmptyElem.style.borderBottom === '' ? true : false;
|
|
881
|
-
}
|
|
882
|
-
if (currentEmptyElem.nodeName === 'COL') {
|
|
883
|
-
var colGroup = currentEmptyElem.parentElement;
|
|
884
|
-
ej2_base_1.detach(colGroup);
|
|
885
|
-
continue;
|
|
886
|
-
}
|
|
887
|
-
var isEmptyElement = !ej2_base_1.isNullOrUndefined(emptyElemet) && currentEmptyElem === emptyElemet;
|
|
888
|
-
if (CONSTANT.SELF_CLOSING_TAGS.indexOf(currentEmptyElem.tagName.toLowerCase()) < 0 && lineWithDiv && !isEmptyElement) {
|
|
889
|
-
var detachableElement = this.findDetachEmptyElem(currentEmptyElem, ignoreBlockNodes);
|
|
890
|
-
if (!ej2_base_1.isNullOrUndefined(detachableElement) && !(detachableElement.nodeType === Node.ELEMENT_NODE && detachableElement.nodeName.toUpperCase() === 'TEXTAREA')) {
|
|
891
|
-
ej2_base_1.detach(detachableElement);
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
};
|
|
896
|
-
InsertHtml.closestEle = function (element, editNode) {
|
|
897
|
-
var el = element;
|
|
898
|
-
if (ej2_base_1.closest(el, 'li')) {
|
|
899
|
-
return ej2_base_1.closest(el, 'li');
|
|
900
|
-
}
|
|
901
|
-
while (el && el.nodeType === 1) {
|
|
902
|
-
if (el.parentNode === editNode ||
|
|
903
|
-
(!ej2_base_1.isNullOrUndefined(el.parentNode.tagName) &&
|
|
904
|
-
(CONSTANT.IGNORE_BLOCK_TAGS.indexOf(el.parentNode.tagName.toLocaleLowerCase()) !== -1
|
|
905
|
-
|| CONSTANT.ALLOWED_TABLE_BLOCK_TAGS.indexOf(el.parentNode.tagName.toLocaleLowerCase()) !== -1))) {
|
|
906
|
-
return el;
|
|
907
|
-
}
|
|
908
|
-
el = el.parentNode;
|
|
909
|
-
}
|
|
910
|
-
return null;
|
|
911
|
-
};
|
|
912
|
-
InsertHtml.insertTableInList = function (range, insertNode, parentNode, currentNode, nodeCutter, lastclosestParentNode, editNode) {
|
|
913
|
-
var totalLi = !ej2_base_1.isNullOrUndefined(ej2_base_1.closest(parentNode, 'ul,ol')) ? ej2_base_1.closest(parentNode, 'ul,ol').querySelectorAll('li').length : 0;
|
|
914
|
-
var preNode = nodeCutter.SplitNode(range, parentNode, true);
|
|
915
|
-
var sibNode = preNode.previousElementSibling;
|
|
916
|
-
var nextSibNode = !ej2_base_1.isNullOrUndefined(lastclosestParentNode) ? ej2_base_1.closest(lastclosestParentNode, 'li') : null;
|
|
917
|
-
var nextElementSiblingValue = !ej2_base_1.isNullOrUndefined(nextSibNode) ? nextSibNode.innerHTML : null;
|
|
918
|
-
if (!ej2_base_1.isNullOrUndefined(sibNode) && !ej2_base_1.isNullOrUndefined(ej2_base_1.closest(sibNode, 'ol,ul')) && ej2_base_1.closest(sibNode, 'ol,ul').querySelectorAll('li').length > totalLi) {
|
|
919
|
-
sibNode.appendChild(insertNode);
|
|
920
|
-
range.deleteContents();
|
|
921
|
-
if (preNode.childNodes.length > 0) {
|
|
922
|
-
this.moveChildNodes(preNode, sibNode);
|
|
923
|
-
}
|
|
924
|
-
if ((parentNode !== lastclosestParentNode) && !ej2_base_1.isNullOrUndefined(nextElementSiblingValue)
|
|
925
|
-
&& nextElementSiblingValue !== nextSibNode.innerHTML) {
|
|
926
|
-
this.moveChildNodes(nextSibNode, sibNode);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
else {
|
|
930
|
-
range.deleteContents();
|
|
931
|
-
preNode.insertBefore(insertNode, preNode.firstChild);
|
|
932
|
-
if (parentNode !== lastclosestParentNode) {
|
|
933
|
-
this.moveChildNodes(lastclosestParentNode, parentNode);
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
this.removeEmptyNextLI(ej2_base_1.closest(insertNode, 'li'));
|
|
937
|
-
insertNode.classList.add('ignore-table');
|
|
938
|
-
};
|
|
939
|
-
InsertHtml.moveChildNodes = function (source, target) {
|
|
940
|
-
while (!ej2_base_1.isNullOrUndefined(source) && !ej2_base_1.isNullOrUndefined(source.firstChild)) {
|
|
941
|
-
target.appendChild(source.firstChild);
|
|
942
|
-
}
|
|
943
|
-
};
|
|
944
|
-
InsertHtml.alignCheck = function (editNode) {
|
|
945
|
-
var spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
|
|
946
|
-
for (var i = 0; i < spanAligns.length; i++) {
|
|
947
|
-
var spanAlign = spanAligns[i];
|
|
948
|
-
if (spanAlign) {
|
|
949
|
-
var blockAlign = this.getImmediateBlockNode(spanAlign, null);
|
|
950
|
-
if (blockAlign) {
|
|
951
|
-
var totalSpanText = '';
|
|
952
|
-
for (var j = 0; j < spanAligns.length; j++) {
|
|
953
|
-
var span = spanAligns[j];
|
|
954
|
-
if (blockAlign.contains(span)) {
|
|
955
|
-
totalSpanText += span.textContent;
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
if (blockAlign.textContent.trim() === totalSpanText.trim()) {
|
|
959
|
-
blockAlign.style.textAlign = spanAlign.style.textAlign;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
};
|
|
965
|
-
InsertHtml.removeListfromPaste = function (range) {
|
|
966
|
-
range.deleteContents();
|
|
967
|
-
var value = range.startContainer;
|
|
968
|
-
if (!ej2_base_1.isNullOrUndefined(value) && value.nodeName === 'LI' && !ej2_base_1.isNullOrUndefined(value.parentElement) && (value.parentElement.nodeName === 'OL' || value.parentElement.nodeName === 'UL') && value.textContent.trim() === '') {
|
|
969
|
-
value.parentElement.querySelectorAll('li').forEach(function (item) {
|
|
970
|
-
if (item.textContent.trim() === '' && item !== value) {
|
|
971
|
-
item.remove();
|
|
972
|
-
}
|
|
973
|
-
});
|
|
974
|
-
}
|
|
975
|
-
};
|
|
976
|
-
InsertHtml.inlineNode = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
|
|
977
|
-
'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
|
|
978
|
-
'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
|
|
979
|
-
'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'sub', 'sup', 'svg',
|
|
980
|
-
'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
|
|
981
|
-
InsertHtml.contentsDeleted = false;
|
|
982
|
-
return InsertHtml;
|
|
983
|
-
}());
|
|
984
|
-
exports.InsertHtml = InsertHtml;
|
|
985
|
-
});
|