@syncfusion/ej2-richtexteditor 29.2.4-738301 → 29.2.4-760237
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 +262 -260
- package/aceconfig.js +17 -0
- package/blazorGlobalSrc/common/config.d.ts +63 -0
- package/blazorGlobalSrc/common/config.js +123 -0
- package/blazorGlobalSrc/common/constant.d.ts +117 -0
- package/blazorGlobalSrc/common/constant.js +23 -0
- package/blazorGlobalSrc/common/editor-styles.d.ts +1 -0
- package/blazorGlobalSrc/common/editor-styles.js +5 -0
- package/blazorGlobalSrc/common/index.d.ts +7 -0
- package/blazorGlobalSrc/common/index.js +9 -0
- package/blazorGlobalSrc/common/interface.d.ts +119 -0
- package/blazorGlobalSrc/common/interface.js +4 -0
- package/blazorGlobalSrc/common/types.d.ts +25 -0
- package/blazorGlobalSrc/common/types.js +4 -0
- package/blazorGlobalSrc/common/user-agent.d.ts +41 -0
- package/blazorGlobalSrc/common/user-agent.js +71 -0
- package/blazorGlobalSrc/common/util.d.ts +70 -0
- package/blazorGlobalSrc/common/util.js +222 -0
- package/blazorGlobalSrc/components.d.ts +8 -0
- package/blazorGlobalSrc/components.js +12 -0
- package/blazorGlobalSrc/editor-manager/base/classes.d.ts +31 -0
- package/blazorGlobalSrc/editor-manager/base/classes.js +28 -0
- package/blazorGlobalSrc/editor-manager/base/constant.d.ts +97 -0
- package/blazorGlobalSrc/editor-manager/base/constant.js +41 -0
- package/blazorGlobalSrc/editor-manager/base/editor-manager.d.ts +95 -0
- package/blazorGlobalSrc/editor-manager/base/editor-manager.js +339 -0
- package/blazorGlobalSrc/editor-manager/base/enum.d.ts +17 -0
- package/blazorGlobalSrc/editor-manager/base/enum.js +4 -0
- package/blazorGlobalSrc/editor-manager/base/interface.d.ts +263 -0
- package/blazorGlobalSrc/editor-manager/base/interface.js +4 -0
- package/blazorGlobalSrc/editor-manager/base/types.d.ts +7 -0
- package/blazorGlobalSrc/editor-manager/base/types.js +4 -0
- package/blazorGlobalSrc/editor-manager/base.d.ts +8 -0
- package/blazorGlobalSrc/editor-manager/base.js +10 -0
- package/blazorGlobalSrc/editor-manager/index.d.ts +5 -0
- package/blazorGlobalSrc/editor-manager/index.js +9 -0
- package/blazorGlobalSrc/editor-manager/plugin/alignments.d.ts +26 -0
- package/blazorGlobalSrc/editor-manager/plugin/alignments.js +105 -0
- package/blazorGlobalSrc/editor-manager/plugin/audio.d.ts +34 -0
- package/blazorGlobalSrc/editor-manager/plugin/audio.js +145 -0
- package/blazorGlobalSrc/editor-manager/plugin/clearformat-exec.d.ts +24 -0
- package/blazorGlobalSrc/editor-manager/plugin/clearformat-exec.js +47 -0
- package/blazorGlobalSrc/editor-manager/plugin/clearformat.d.ts +29 -0
- package/blazorGlobalSrc/editor-manager/plugin/clearformat.js +249 -0
- package/blazorGlobalSrc/editor-manager/plugin/dom-node.d.ts +351 -0
- package/blazorGlobalSrc/editor-manager/plugin/dom-node.js +737 -0
- package/blazorGlobalSrc/editor-manager/plugin/dom-tree.d.ts +84 -0
- package/blazorGlobalSrc/editor-manager/plugin/dom-tree.js +164 -0
- package/blazorGlobalSrc/editor-manager/plugin/emoji-picker-action.d.ts +10 -0
- package/blazorGlobalSrc/editor-manager/plugin/emoji-picker-action.js +86 -0
- package/blazorGlobalSrc/editor-manager/plugin/format-painter-actions.d.ts +47 -0
- package/blazorGlobalSrc/editor-manager/plugin/format-painter-actions.js +622 -0
- package/blazorGlobalSrc/editor-manager/plugin/formats.d.ts +43 -0
- package/blazorGlobalSrc/editor-manager/plugin/formats.js +597 -0
- package/blazorGlobalSrc/editor-manager/plugin/image.d.ts +48 -0
- package/blazorGlobalSrc/editor-manager/plugin/image.js +399 -0
- package/blazorGlobalSrc/editor-manager/plugin/indents.d.ts +24 -0
- package/blazorGlobalSrc/editor-manager/plugin/indents.js +106 -0
- package/blazorGlobalSrc/editor-manager/plugin/insert-methods.d.ts +48 -0
- package/blazorGlobalSrc/editor-manager/plugin/insert-methods.js +37 -0
- package/blazorGlobalSrc/editor-manager/plugin/insert-text.d.ts +22 -0
- package/blazorGlobalSrc/editor-manager/plugin/insert-text.js +36 -0
- package/blazorGlobalSrc/editor-manager/plugin/inserthtml-exec.d.ts +22 -0
- package/blazorGlobalSrc/editor-manager/plugin/inserthtml-exec.js +49 -0
- package/blazorGlobalSrc/editor-manager/plugin/inserthtml.d.ts +51 -0
- package/blazorGlobalSrc/editor-manager/plugin/inserthtml.js +985 -0
- package/blazorGlobalSrc/editor-manager/plugin/isformatted.d.ts +89 -0
- package/blazorGlobalSrc/editor-manager/plugin/isformatted.js +199 -0
- package/blazorGlobalSrc/editor-manager/plugin/link.d.ts +41 -0
- package/blazorGlobalSrc/editor-manager/plugin/link.js +550 -0
- package/blazorGlobalSrc/editor-manager/plugin/lists.d.ts +74 -0
- package/blazorGlobalSrc/editor-manager/plugin/lists.js +1503 -0
- package/blazorGlobalSrc/editor-manager/plugin/ms-word-clean-up.d.ts +61 -0
- package/blazorGlobalSrc/editor-manager/plugin/ms-word-clean-up.js +1136 -0
- package/blazorGlobalSrc/editor-manager/plugin/nodecutter.d.ts +64 -0
- package/blazorGlobalSrc/editor-manager/plugin/nodecutter.js +167 -0
- package/blazorGlobalSrc/editor-manager/plugin/selection-commands.d.ts +41 -0
- package/blazorGlobalSrc/editor-manager/plugin/selection-commands.js +1069 -0
- package/blazorGlobalSrc/editor-manager/plugin/selection-exec.d.ts +24 -0
- package/blazorGlobalSrc/editor-manager/plugin/selection-exec.js +49 -0
- package/blazorGlobalSrc/editor-manager/plugin/table-selection.d.ts +26 -0
- package/blazorGlobalSrc/editor-manager/plugin/table-selection.js +210 -0
- package/blazorGlobalSrc/editor-manager/plugin/table.d.ts +56 -0
- package/blazorGlobalSrc/editor-manager/plugin/table.js +1100 -0
- package/blazorGlobalSrc/editor-manager/plugin/toolbar-status.d.ts +39 -0
- package/blazorGlobalSrc/editor-manager/plugin/toolbar-status.js +384 -0
- package/blazorGlobalSrc/editor-manager/plugin/undo.d.ts +85 -0
- package/blazorGlobalSrc/editor-manager/plugin/undo.js +216 -0
- package/blazorGlobalSrc/editor-manager/plugin/video.d.ts +38 -0
- package/blazorGlobalSrc/editor-manager/plugin/video.js +311 -0
- package/blazorGlobalSrc/editor-manager/plugin.d.ts +27 -0
- package/blazorGlobalSrc/editor-manager/plugin.js +31 -0
- package/blazorGlobalSrc/global.d.ts +1 -0
- package/blazorGlobalSrc/global.js +3 -0
- package/blazorGlobalSrc/index.d.ts +8 -0
- package/blazorGlobalSrc/index.js +12 -0
- package/blazorGlobalSrc/markdown-parser/base/constant.d.ts +39 -0
- package/blazorGlobalSrc/markdown-parser/base/constant.js +10 -0
- package/blazorGlobalSrc/markdown-parser/base/interface.d.ts +169 -0
- package/blazorGlobalSrc/markdown-parser/base/interface.js +4 -0
- package/blazorGlobalSrc/markdown-parser/base/markdown-parser.d.ts +69 -0
- package/blazorGlobalSrc/markdown-parser/base/markdown-parser.js +87 -0
- package/blazorGlobalSrc/markdown-parser/base/types.d.ts +7 -0
- package/blazorGlobalSrc/markdown-parser/base/types.js +4 -0
- package/blazorGlobalSrc/markdown-parser/base.d.ts +7 -0
- package/blazorGlobalSrc/markdown-parser/base.js +9 -0
- package/blazorGlobalSrc/markdown-parser/index.d.ts +5 -0
- package/blazorGlobalSrc/markdown-parser/index.js +9 -0
- package/blazorGlobalSrc/markdown-parser/plugin/clearformat.d.ts +28 -0
- package/blazorGlobalSrc/markdown-parser/plugin/clearformat.js +110 -0
- package/blazorGlobalSrc/markdown-parser/plugin/formats.d.ts +32 -0
- package/blazorGlobalSrc/markdown-parser/plugin/formats.js +225 -0
- package/blazorGlobalSrc/markdown-parser/plugin/insert-text.d.ts +24 -0
- package/blazorGlobalSrc/markdown-parser/plugin/insert-text.js +49 -0
- package/blazorGlobalSrc/markdown-parser/plugin/link.d.ts +24 -0
- package/blazorGlobalSrc/markdown-parser/plugin/link.js +50 -0
- package/blazorGlobalSrc/markdown-parser/plugin/lists.d.ts +39 -0
- package/blazorGlobalSrc/markdown-parser/plugin/lists.js +462 -0
- package/blazorGlobalSrc/markdown-parser/plugin/markdown-selection.d.ts +140 -0
- package/blazorGlobalSrc/markdown-parser/plugin/markdown-selection.js +104 -0
- package/blazorGlobalSrc/markdown-parser/plugin/md-selection-formats.d.ts +31 -0
- package/blazorGlobalSrc/markdown-parser/plugin/md-selection-formats.js +335 -0
- package/blazorGlobalSrc/markdown-parser/plugin/table.d.ts +52 -0
- package/blazorGlobalSrc/markdown-parser/plugin/table.js +216 -0
- package/blazorGlobalSrc/markdown-parser/plugin/undo.d.ts +83 -0
- package/blazorGlobalSrc/markdown-parser/plugin/undo.js +147 -0
- package/blazorGlobalSrc/markdown-parser/plugin.d.ts +11 -0
- package/blazorGlobalSrc/markdown-parser/plugin.js +15 -0
- package/blazorGlobalSrc/rich-text-editor/actions/base-quick-toolbar.d.ts +114 -0
- package/blazorGlobalSrc/rich-text-editor/actions/base-quick-toolbar.js +465 -0
- package/blazorGlobalSrc/rich-text-editor/actions/base-toolbar.d.ts +58 -0
- package/blazorGlobalSrc/rich-text-editor/actions/base-toolbar.js +216 -0
- package/blazorGlobalSrc/rich-text-editor/actions/color-picker.d.ts +52 -0
- package/blazorGlobalSrc/rich-text-editor/actions/color-picker.js +241 -0
- package/blazorGlobalSrc/rich-text-editor/actions/count.d.ts +55 -0
- package/blazorGlobalSrc/rich-text-editor/actions/count.js +117 -0
- package/blazorGlobalSrc/rich-text-editor/actions/dropdown-buttons.d.ts +72 -0
- package/blazorGlobalSrc/rich-text-editor/actions/dropdown-buttons.js +552 -0
- package/blazorGlobalSrc/rich-text-editor/actions/emoji-picker.d.ts +51 -0
- package/blazorGlobalSrc/rich-text-editor/actions/emoji-picker.js +853 -0
- package/blazorGlobalSrc/rich-text-editor/actions/enter-key.d.ts +28 -0
- package/blazorGlobalSrc/rich-text-editor/actions/enter-key.js +821 -0
- package/blazorGlobalSrc/rich-text-editor/actions/execute-command-callback.d.ts +11 -0
- package/blazorGlobalSrc/rich-text-editor/actions/execute-command-callback.js +28 -0
- package/blazorGlobalSrc/rich-text-editor/actions/file-manager.d.ts +45 -0
- package/blazorGlobalSrc/rich-text-editor/actions/file-manager.js +249 -0
- package/blazorGlobalSrc/rich-text-editor/actions/format-painter.d.ts +25 -0
- package/blazorGlobalSrc/rich-text-editor/actions/format-painter.js +156 -0
- package/blazorGlobalSrc/rich-text-editor/actions/full-screen.d.ts +40 -0
- package/blazorGlobalSrc/rich-text-editor/actions/full-screen.js +148 -0
- package/blazorGlobalSrc/rich-text-editor/actions/html-attributes.d.ts +15 -0
- package/blazorGlobalSrc/rich-text-editor/actions/html-attributes.js +50 -0
- package/blazorGlobalSrc/rich-text-editor/actions/html-editor.d.ts +120 -0
- package/blazorGlobalSrc/rich-text-editor/actions/html-editor.js +1244 -0
- package/blazorGlobalSrc/rich-text-editor/actions/html-toolbar-status.d.ts +14 -0
- package/blazorGlobalSrc/rich-text-editor/actions/html-toolbar-status.js +47 -0
- package/blazorGlobalSrc/rich-text-editor/actions/import-export.d.ts +21 -0
- package/blazorGlobalSrc/rich-text-editor/actions/import-export.js +117 -0
- package/blazorGlobalSrc/rich-text-editor/actions/keyboard-model.d.ts +30 -0
- package/blazorGlobalSrc/rich-text-editor/actions/keyboard.d.ts +110 -0
- package/blazorGlobalSrc/rich-text-editor/actions/keyboard.js +163 -0
- package/blazorGlobalSrc/rich-text-editor/actions/markdown-editor.d.ts +66 -0
- package/blazorGlobalSrc/rich-text-editor/actions/markdown-editor.js +142 -0
- package/blazorGlobalSrc/rich-text-editor/actions/markdown-toolbar-status.d.ts +23 -0
- package/blazorGlobalSrc/rich-text-editor/actions/markdown-toolbar-status.js +124 -0
- package/blazorGlobalSrc/rich-text-editor/actions/paste-clean-up.d.ts +86 -0
- package/blazorGlobalSrc/rich-text-editor/actions/paste-clean-up.js +1071 -0
- package/blazorGlobalSrc/rich-text-editor/actions/quick-toolbar.d.ts +151 -0
- package/blazorGlobalSrc/rich-text-editor/actions/quick-toolbar.js +548 -0
- package/blazorGlobalSrc/rich-text-editor/actions/resize.d.ts +37 -0
- package/blazorGlobalSrc/rich-text-editor/actions/resize.js +188 -0
- package/blazorGlobalSrc/rich-text-editor/actions/sanitize-helper.d.ts +11 -0
- package/blazorGlobalSrc/rich-text-editor/actions/sanitize-helper.js +168 -0
- package/blazorGlobalSrc/rich-text-editor/actions/toolbar-action.d.ts +18 -0
- package/blazorGlobalSrc/rich-text-editor/actions/toolbar-action.js +76 -0
- package/blazorGlobalSrc/rich-text-editor/actions/toolbar.d.ts +185 -0
- package/blazorGlobalSrc/rich-text-editor/actions/toolbar.js +512 -0
- package/blazorGlobalSrc/rich-text-editor/actions/xhtml-validation.d.ts +25 -0
- package/blazorGlobalSrc/rich-text-editor/actions/xhtml-validation.js +166 -0
- package/blazorGlobalSrc/rich-text-editor/actions.d.ts +26 -0
- package/blazorGlobalSrc/rich-text-editor/actions.js +30 -0
- package/blazorGlobalSrc/rich-text-editor/audio.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor/audio.js +8 -0
- package/blazorGlobalSrc/rich-text-editor/base/classes.d.ts +628 -0
- package/blazorGlobalSrc/rich-text-editor/base/classes.js +129 -0
- package/blazorGlobalSrc/rich-text-editor/base/constant.d.ts +808 -0
- package/blazorGlobalSrc/rich-text-editor/base/constant.js +334 -0
- package/blazorGlobalSrc/rich-text-editor/base/enum.d.ts +81 -0
- package/blazorGlobalSrc/rich-text-editor/base/enum.js +37 -0
- package/blazorGlobalSrc/rich-text-editor/base/interface.d.ts +1577 -0
- package/blazorGlobalSrc/rich-text-editor/base/interface.js +194 -0
- package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor-model.d.ts +1032 -0
- package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor.d.ts +1699 -0
- package/blazorGlobalSrc/rich-text-editor/base/rich-text-editor.js +2645 -0
- package/blazorGlobalSrc/rich-text-editor/base/util.d.ts +212 -0
- package/blazorGlobalSrc/rich-text-editor/base/util.js +610 -0
- package/blazorGlobalSrc/rich-text-editor/base.d.ts +10 -0
- package/blazorGlobalSrc/rich-text-editor/base.js +13 -0
- package/blazorGlobalSrc/rich-text-editor/formatter/formatter.d.ts +87 -0
- package/blazorGlobalSrc/rich-text-editor/formatter/formatter.js +223 -0
- package/blazorGlobalSrc/rich-text-editor/formatter/html-formatter.d.ts +34 -0
- package/blazorGlobalSrc/rich-text-editor/formatter/html-formatter.js +44 -0
- package/blazorGlobalSrc/rich-text-editor/formatter/markdown-formatter.d.ts +39 -0
- package/blazorGlobalSrc/rich-text-editor/formatter/markdown-formatter.js +48 -0
- package/blazorGlobalSrc/rich-text-editor/formatter.d.ts +6 -0
- package/blazorGlobalSrc/rich-text-editor/formatter.js +10 -0
- package/blazorGlobalSrc/rich-text-editor/html-editor.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor/html-editor.js +8 -0
- package/blazorGlobalSrc/rich-text-editor/image.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor/image.js +8 -0
- package/blazorGlobalSrc/rich-text-editor/index.d.ts +9 -0
- package/blazorGlobalSrc/rich-text-editor/index.js +12 -0
- package/blazorGlobalSrc/rich-text-editor/link.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor/link.js +8 -0
- package/blazorGlobalSrc/rich-text-editor/markdown-editor.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor/markdown-editor.js +8 -0
- package/blazorGlobalSrc/rich-text-editor/models/default-locale.d.ts +25 -0
- package/blazorGlobalSrc/rich-text-editor/models/default-locale.js +391 -0
- package/blazorGlobalSrc/rich-text-editor/models/iframe-settings-model.d.ts +68 -0
- package/blazorGlobalSrc/rich-text-editor/models/iframe-settings.d.ts +61 -0
- package/blazorGlobalSrc/rich-text-editor/models/iframe-settings.js +60 -0
- package/blazorGlobalSrc/rich-text-editor/models/inline-mode-model.d.ts +24 -0
- package/blazorGlobalSrc/rich-text-editor/models/inline-mode.d.ts +20 -0
- package/blazorGlobalSrc/rich-text-editor/models/inline-mode.js +37 -0
- package/blazorGlobalSrc/rich-text-editor/models/items.d.ts +36 -0
- package/blazorGlobalSrc/rich-text-editor/models/items.js +1011 -0
- package/blazorGlobalSrc/rich-text-editor/models/models.d.ts +7 -0
- package/blazorGlobalSrc/rich-text-editor/models/models.js +4 -0
- package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings-model.d.ts +40 -0
- package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings.d.ts +50 -0
- package/blazorGlobalSrc/rich-text-editor/models/slash-menu-settings.js +143 -0
- package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings-model.d.ts +1130 -0
- package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings.d.ts +992 -0
- package/blazorGlobalSrc/rich-text-editor/models/toolbar-settings.js +510 -0
- package/blazorGlobalSrc/rich-text-editor/models.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor/models.js +4 -0
- package/blazorGlobalSrc/rich-text-editor/quick-toolbar.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor/quick-toolbar.js +8 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/audio-module.d.ts +82 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/audio-module.js +886 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/content-renderer.d.ts +65 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/content-renderer.js +49 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/dialog-renderer.d.ts +39 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/dialog-renderer.js +111 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/iframe-content-renderer.d.ts +33 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/iframe-content-renderer.js +101 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/image-module.d.ts +199 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/image-module.js +2494 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/link-module.d.ts +63 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/link-module.js +596 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/markdown-renderer.d.ts +65 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/markdown-renderer.js +38 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/popup-renderer.d.ts +54 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/popup-renderer.js +35 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/render.d.ts +46 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/render.js +70 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/slash-menu.d.ts +20 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/slash-menu.js +224 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/table-module.d.ts +155 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/table-module.js +2206 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/toolbar-renderer.d.ts +131 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/toolbar-renderer.js +747 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/video-module.d.ts +120 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/video-module.js +1507 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/view-source.d.ts +74 -0
- package/blazorGlobalSrc/rich-text-editor/renderer/view-source.js +225 -0
- package/blazorGlobalSrc/rich-text-editor/renderer.d.ts +17 -0
- package/blazorGlobalSrc/rich-text-editor/renderer.js +21 -0
- package/blazorGlobalSrc/rich-text-editor/services/renderer-factory.d.ts +33 -0
- package/blazorGlobalSrc/rich-text-editor/services/renderer-factory.js +29 -0
- package/blazorGlobalSrc/rich-text-editor/services/service-locator.d.ts +29 -0
- package/blazorGlobalSrc/rich-text-editor/services/service-locator.js +25 -0
- package/blazorGlobalSrc/rich-text-editor/services.d.ts +5 -0
- package/blazorGlobalSrc/rich-text-editor/services.js +9 -0
- package/blazorGlobalSrc/rich-text-editor/toolbar.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor/toolbar.js +8 -0
- package/blazorGlobalSrc/rich-text-editor/video.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor/video.js +8 -0
- package/blazorGlobalSrc/rich-text-editor.d.ts +4 -0
- package/blazorGlobalSrc/rich-text-editor.js +8 -0
- package/blazorGlobalSrc/selection/index.d.ts +4 -0
- package/blazorGlobalSrc/selection/index.js +8 -0
- package/blazorGlobalSrc/selection/selection.d.ts +244 -0
- package/blazorGlobalSrc/selection/selection.js +309 -0
- 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 +6 -4
- package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
- package/dist/es6/ej2-richtexteditor.es5.js +6 -4
- package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
- package/helpers/e2e/index.d.ts +1 -0
- package/helpers/e2e/index.js +8 -0
- package/helpers/e2e/rte-helper.d.ts +79 -0
- package/helpers/e2e/rte-helper.js +81 -0
- package/package.json +1 -1
- package/src/editor-manager/plugin/dom-tree.js +6 -4
- package/src/global.d.ts +1 -0
- package/styles/bds-lite.css +7 -17
- package/styles/bds.css +11 -22
- package/styles/bootstrap-dark-lite.css +3 -13
- package/styles/bootstrap-dark.css +3 -14
- package/styles/bootstrap-lite.css +3 -13
- package/styles/bootstrap.css +3 -14
- package/styles/bootstrap4-lite.css +3 -13
- package/styles/bootstrap4.css +3 -14
- package/styles/bootstrap5-dark-lite.css +3 -13
- package/styles/bootstrap5-dark.css +3 -14
- package/styles/bootstrap5-lite.css +3 -13
- package/styles/bootstrap5.3-lite.css +3 -13
- package/styles/bootstrap5.3.css +3 -14
- package/styles/bootstrap5.css +3 -14
- package/styles/fabric-dark-lite.css +3 -13
- package/styles/fabric-dark.css +3 -14
- package/styles/fabric-lite.css +3 -13
- package/styles/fabric.css +3 -14
- package/styles/fluent-dark-lite.css +3 -13
- package/styles/fluent-dark.css +3 -14
- package/styles/fluent-lite.css +3 -13
- package/styles/fluent.css +3 -14
- package/styles/fluent2-lite.css +3 -13
- package/styles/fluent2.css +3 -14
- package/styles/highcontrast-light-lite.css +3 -13
- package/styles/highcontrast-light.css +3 -14
- package/styles/highcontrast-lite.css +3 -13
- package/styles/highcontrast.css +3 -14
- package/styles/material-dark-lite.css +3 -13
- package/styles/material-dark.css +3 -14
- package/styles/material-lite.css +3 -13
- package/styles/material.css +3 -14
- package/styles/material3-dark-lite.css +3 -13
- package/styles/material3-dark.css +3 -14
- package/styles/material3-lite.css +3 -13
- package/styles/material3.css +3 -14
- package/styles/rich-text-editor/_bds-definition.scss +2 -2
- package/styles/rich-text-editor/_bigger.scss +0 -1
- package/styles/rich-text-editor/_layout.scss +0 -9
- package/styles/rich-text-editor/_theme.scss +3 -0
- package/styles/rich-text-editor/bds.css +11 -22
- package/styles/rich-text-editor/bootstrap-dark.css +3 -14
- package/styles/rich-text-editor/bootstrap.css +3 -14
- package/styles/rich-text-editor/bootstrap4.css +3 -14
- package/styles/rich-text-editor/bootstrap5-dark.css +3 -14
- package/styles/rich-text-editor/bootstrap5.3.css +3 -14
- package/styles/rich-text-editor/bootstrap5.css +3 -14
- package/styles/rich-text-editor/fabric-dark.css +3 -14
- package/styles/rich-text-editor/fabric.css +3 -14
- package/styles/rich-text-editor/fluent-dark.css +3 -14
- package/styles/rich-text-editor/fluent.css +3 -14
- package/styles/rich-text-editor/fluent2.css +3 -14
- package/styles/rich-text-editor/highcontrast-light.css +3 -14
- package/styles/rich-text-editor/highcontrast.css +3 -14
- package/styles/rich-text-editor/material-dark.css +3 -14
- package/styles/rich-text-editor/material.css +3 -14
- package/styles/rich-text-editor/material3-dark.css +3 -14
- package/styles/rich-text-editor/material3.css +3 -14
- package/styles/rich-text-editor/tailwind-dark.css +3 -14
- package/styles/rich-text-editor/tailwind.css +3 -14
- package/styles/rich-text-editor/tailwind3.css +3 -14
- package/styles/tailwind-dark-lite.css +3 -13
- package/styles/tailwind-dark.css +3 -14
- package/styles/tailwind-lite.css +3 -13
- package/styles/tailwind.css +3 -14
- package/styles/tailwind3-lite.css +3 -13
- package/styles/tailwind3.css +3 -14
- package/tslint.json +111 -0
|
@@ -0,0 +1,1100 @@
|
|
|
1
|
+
define(["require", "exports", "@syncfusion/ej2-base", "./../base/constant", "./inserthtml", "../../common/util", "../../common/constant"], function (require, exports, ej2_base_1, CONSTANT, inserthtml_1, util_1, EVENTS) {
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var TableCommand = (function () {
|
|
5
|
+
function TableCommand(parent) {
|
|
6
|
+
this.parent = parent;
|
|
7
|
+
this.addEventListener();
|
|
8
|
+
}
|
|
9
|
+
TableCommand.prototype.addEventListener = function () {
|
|
10
|
+
this.parent.observer.on(CONSTANT.TABLE, this.createTable, this);
|
|
11
|
+
this.parent.observer.on(CONSTANT.INSERT_ROW, this.insertRow, this);
|
|
12
|
+
this.parent.observer.on(CONSTANT.INSERT_COLUMN, this.insertColumn, this);
|
|
13
|
+
this.parent.observer.on(CONSTANT.DELETEROW, this.deleteRow, this);
|
|
14
|
+
this.parent.observer.on(CONSTANT.DELETECOLUMN, this.deleteColumn, this);
|
|
15
|
+
this.parent.observer.on(CONSTANT.REMOVETABLE, this.removeTable, this);
|
|
16
|
+
this.parent.observer.on(CONSTANT.TABLEHEADER, this.tableHeader, this);
|
|
17
|
+
this.parent.observer.on(CONSTANT.TABLE_VERTICAL_ALIGN, this.tableVerticalAlign, this);
|
|
18
|
+
this.parent.observer.on(CONSTANT.TABLE_MERGE, this.cellMerge, this);
|
|
19
|
+
this.parent.observer.on(CONSTANT.TABLE_HORIZONTAL_SPLIT, this.HorizontalSplit, this);
|
|
20
|
+
this.parent.observer.on(CONSTANT.TABLE_VERTICAL_SPLIT, this.VerticalSplit, this);
|
|
21
|
+
this.parent.observer.on(CONSTANT.TABLE_DASHED, this.tableStyle, this);
|
|
22
|
+
this.parent.observer.on(CONSTANT.TABLE_BACKGROUND_COLOR, this.setBGColor, this);
|
|
23
|
+
this.parent.observer.on(CONSTANT.TABLE_ALTERNATE, this.tableStyle, this);
|
|
24
|
+
this.parent.observer.on(CONSTANT.TABLE_MOVE, this.tableMove, this);
|
|
25
|
+
this.parent.observer.on(EVENTS.INTERNAL_DESTROY, this.destroy, this);
|
|
26
|
+
};
|
|
27
|
+
TableCommand.prototype.removeEventListener = function () {
|
|
28
|
+
this.parent.observer.off(CONSTANT.TABLE, this.createTable);
|
|
29
|
+
this.parent.observer.off(CONSTANT.INSERT_ROW, this.insertRow);
|
|
30
|
+
this.parent.observer.off(CONSTANT.INSERT_COLUMN, this.insertColumn);
|
|
31
|
+
this.parent.observer.off(CONSTANT.DELETEROW, this.deleteRow);
|
|
32
|
+
this.parent.observer.off(CONSTANT.DELETECOLUMN, this.deleteColumn);
|
|
33
|
+
this.parent.observer.off(CONSTANT.REMOVETABLE, this.removeTable);
|
|
34
|
+
this.parent.observer.off(CONSTANT.TABLEHEADER, this.tableHeader);
|
|
35
|
+
this.parent.observer.off(CONSTANT.TABLE_VERTICAL_ALIGN, this.tableVerticalAlign);
|
|
36
|
+
this.parent.observer.off(CONSTANT.TABLE_MERGE, this.cellMerge);
|
|
37
|
+
this.parent.observer.off(CONSTANT.TABLE_HORIZONTAL_SPLIT, this.HorizontalSplit);
|
|
38
|
+
this.parent.observer.off(CONSTANT.TABLE_VERTICAL_SPLIT, this.VerticalSplit);
|
|
39
|
+
this.parent.observer.off(CONSTANT.TABLE_DASHED, this.tableStyle);
|
|
40
|
+
this.parent.observer.off(CONSTANT.TABLE_ALTERNATE, this.tableStyle);
|
|
41
|
+
this.parent.observer.off(CONSTANT.TABLE_BACKGROUND_COLOR, this.setBGColor);
|
|
42
|
+
this.parent.observer.off(CONSTANT.TABLE_MOVE, this.tableMove);
|
|
43
|
+
this.parent.observer.off(EVENTS.INTERNAL_DESTROY, this.destroy);
|
|
44
|
+
};
|
|
45
|
+
TableCommand.prototype.createTable = function (e) {
|
|
46
|
+
var table = ej2_base_1.createElement('table', { className: 'e-rte-table' });
|
|
47
|
+
var tblBody = ej2_base_1.createElement('tbody');
|
|
48
|
+
if (!ej2_base_1.isNullOrUndefined(e.item.width.width)) {
|
|
49
|
+
table.style.width = this.calculateStyleValue(e.item.width.width);
|
|
50
|
+
}
|
|
51
|
+
if (!ej2_base_1.isNullOrUndefined(e.item.width.minWidth)) {
|
|
52
|
+
table.style.minWidth = this.calculateStyleValue(e.item.width.minWidth);
|
|
53
|
+
}
|
|
54
|
+
if (!ej2_base_1.isNullOrUndefined(e.item.width.maxWidth)) {
|
|
55
|
+
table.style.maxWidth = this.calculateStyleValue(e.item.width.maxWidth);
|
|
56
|
+
}
|
|
57
|
+
var tdWid = parseInt(e.item.width.width, 10) > 100 ?
|
|
58
|
+
100 / e.item.columns : parseInt(e.item.width.width, 10) / e.item.columns;
|
|
59
|
+
for (var i = 0; i < e.item.rows; i++) {
|
|
60
|
+
var row = ej2_base_1.createElement('tr');
|
|
61
|
+
for (var j = 0; j < e.item.columns; j++) {
|
|
62
|
+
var cell = ej2_base_1.createElement('td');
|
|
63
|
+
cell.appendChild(ej2_base_1.createElement('br'));
|
|
64
|
+
cell.style.width = tdWid + '%';
|
|
65
|
+
row.appendChild(cell);
|
|
66
|
+
}
|
|
67
|
+
tblBody.appendChild(row);
|
|
68
|
+
}
|
|
69
|
+
table.appendChild(tblBody);
|
|
70
|
+
e.item.selection.restore();
|
|
71
|
+
inserthtml_1.InsertHtml.Insert(this.parent.currentDocument, table, this.parent.editableElement);
|
|
72
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, table.querySelector('td'), table.querySelector('td'), 0, 0);
|
|
73
|
+
if (table.nextElementSibling === null && !table.classList.contains('ignore-table')) {
|
|
74
|
+
var insertElem = void 0;
|
|
75
|
+
if (e.enterAction === 'DIV') {
|
|
76
|
+
insertElem = ej2_base_1.createElement('div');
|
|
77
|
+
insertElem.appendChild(ej2_base_1.createElement('br'));
|
|
78
|
+
}
|
|
79
|
+
else if (e.enterAction === 'BR') {
|
|
80
|
+
insertElem = ej2_base_1.createElement('br');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
insertElem = ej2_base_1.createElement('p');
|
|
84
|
+
insertElem.appendChild(ej2_base_1.createElement('br'));
|
|
85
|
+
}
|
|
86
|
+
this.insertAfter(insertElem, table);
|
|
87
|
+
}
|
|
88
|
+
if (table.classList.contains('ignore-table')) {
|
|
89
|
+
util_1.removeClassWithAttr([table], ['ignore-table']);
|
|
90
|
+
}
|
|
91
|
+
table.querySelector('td').classList.add('e-cell-select');
|
|
92
|
+
if (e.callBack) {
|
|
93
|
+
e.callBack({
|
|
94
|
+
requestType: 'Table',
|
|
95
|
+
editorMode: 'HTML',
|
|
96
|
+
event: e.event,
|
|
97
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
98
|
+
elements: [table]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return table;
|
|
102
|
+
};
|
|
103
|
+
TableCommand.prototype.calculateStyleValue = function (value) {
|
|
104
|
+
var styleValue;
|
|
105
|
+
if (typeof (value) === 'string') {
|
|
106
|
+
if (value.indexOf('px') >= 0 || value.indexOf('%') >= 0 || value.indexOf('auto') >= 0) {
|
|
107
|
+
styleValue = value;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
styleValue = value + 'px';
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
styleValue = value + 'px';
|
|
115
|
+
}
|
|
116
|
+
return styleValue;
|
|
117
|
+
};
|
|
118
|
+
TableCommand.prototype.insertAfter = function (newNode, referenceNode) {
|
|
119
|
+
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
|
120
|
+
};
|
|
121
|
+
TableCommand.prototype.getSelectedCellMinMaxIndex = function (e) {
|
|
122
|
+
var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
|
|
123
|
+
var a = 0;
|
|
124
|
+
var minI = e.length;
|
|
125
|
+
var maxI = 0;
|
|
126
|
+
var minJ = e[0].length;
|
|
127
|
+
var maxJ = 0;
|
|
128
|
+
for (var i = 0; a < selectedCells.length; a++) {
|
|
129
|
+
var selectedCellIndex = this.getCorrespondingIndex(selectedCells[a], e);
|
|
130
|
+
var minMaxIndex = this.FindIndex(selectedCellIndex[0], selectedCellIndex[1], e);
|
|
131
|
+
minI = Math.min(selectedCellIndex[0], minI),
|
|
132
|
+
maxI = Math.max(minMaxIndex[0], maxI),
|
|
133
|
+
minJ = Math.min(selectedCellIndex[1], minJ),
|
|
134
|
+
maxJ = Math.max(minMaxIndex[1], maxJ);
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
startRow: minI,
|
|
138
|
+
endRow: maxI,
|
|
139
|
+
startColumn: minJ,
|
|
140
|
+
endColumn: maxJ
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
TableCommand.prototype.insertRow = function (e) {
|
|
144
|
+
var isBelow = e.item.subCommand === 'InsertRowBefore' ? false : true;
|
|
145
|
+
var selectedCell = e.item.selection.range.startContainer;
|
|
146
|
+
if (!(selectedCell.nodeName === 'TH' || selectedCell.nodeName === 'TD')) {
|
|
147
|
+
selectedCell = ej2_base_1.closest(selectedCell.parentElement, 'td,th');
|
|
148
|
+
}
|
|
149
|
+
this.curTable = ej2_base_1.closest(this.parent.nodeSelection.range.startContainer.parentElement, 'table');
|
|
150
|
+
if (this.curTable.querySelectorAll('.e-cell-select').length === 0) {
|
|
151
|
+
var lastRow = this.curTable.rows[this.curTable.rows.length - 1];
|
|
152
|
+
var cloneRow = lastRow.cloneNode(true);
|
|
153
|
+
cloneRow.removeAttribute('rowspan');
|
|
154
|
+
this.insertAfter(cloneRow, lastRow);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
var allCells = this.getCorrespondingColumns();
|
|
158
|
+
var minMaxIndex = this.getSelectedCellMinMaxIndex(allCells);
|
|
159
|
+
var minVal = isBelow ? minMaxIndex.endRow : minMaxIndex.startRow;
|
|
160
|
+
var newRow = ej2_base_1.createElement('tr');
|
|
161
|
+
var isHeaderSelect = this.curTable.querySelectorAll('th.e-cell-select').length > 0;
|
|
162
|
+
for (var i = 0; i < allCells[minVal].length; i++) {
|
|
163
|
+
if (isBelow && minVal < allCells.length - 1 && allCells[minVal][i] === allCells[minVal + 1][i] ||
|
|
164
|
+
!isBelow && 0 < minVal && allCells[minVal][i] === allCells[minVal - 1][i]) {
|
|
165
|
+
if (0 === i || 0 < i && allCells[minVal][i] !== allCells[minVal][i - 1]) {
|
|
166
|
+
allCells[minVal][i].setAttribute('rowspan', (parseInt(allCells[minVal][i].getAttribute('rowspan'), 10) + 1).toString());
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
var tdElement = ej2_base_1.createElement('td');
|
|
171
|
+
tdElement.appendChild(ej2_base_1.createElement('br'));
|
|
172
|
+
newRow.appendChild(tdElement);
|
|
173
|
+
var styleValue = allCells[(isHeaderSelect && isBelow) ? allCells[(minVal + 1)] ? (minVal + 1) : minVal : minVal][i].getAttribute('style');
|
|
174
|
+
if (styleValue) {
|
|
175
|
+
var updatedStyle = this.cellStyleCleanup(styleValue);
|
|
176
|
+
tdElement.style.cssText = updatedStyle;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
var selectedRow = void 0;
|
|
181
|
+
if (isHeaderSelect && isBelow) {
|
|
182
|
+
selectedRow = this.curTable.querySelector('tbody').childNodes[0];
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
selectedRow = this.curTable.rows[minVal];
|
|
186
|
+
}
|
|
187
|
+
(e.item.subCommand === 'InsertRowBefore') ? selectedRow.parentElement.insertBefore(newRow, selectedRow) :
|
|
188
|
+
(isHeaderSelect ? selectedRow.parentElement.insertBefore(newRow, selectedRow) :
|
|
189
|
+
this.insertAfter(newRow, selectedRow));
|
|
190
|
+
}
|
|
191
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, e.item.selection.range.startContainer, e.item.selection.range.startContainer, 0, 0);
|
|
192
|
+
if (e.callBack) {
|
|
193
|
+
e.callBack({
|
|
194
|
+
requestType: e.item.subCommand,
|
|
195
|
+
editorMode: 'HTML',
|
|
196
|
+
event: e.event,
|
|
197
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
198
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
TableCommand.prototype.insertColumn = function (e) {
|
|
203
|
+
var selectedCell = e.item.selection.range.startContainer;
|
|
204
|
+
if (!(selectedCell.nodeName === 'TH' || selectedCell.nodeName === 'TD')) {
|
|
205
|
+
selectedCell = ej2_base_1.closest(selectedCell.parentElement, 'td,th');
|
|
206
|
+
}
|
|
207
|
+
var curRow = ej2_base_1.closest(selectedCell, 'tr');
|
|
208
|
+
var curCell;
|
|
209
|
+
var allRows = ej2_base_1.closest((curRow), 'table').rows;
|
|
210
|
+
var colIndex = Array.prototype.slice.call(curRow.querySelectorAll(':scope > td, :scope > th')).indexOf(selectedCell);
|
|
211
|
+
var previousWidth = parseInt(e.item.width, 10) / (curRow.querySelectorAll(':scope > td, :scope > th').length);
|
|
212
|
+
var currentWidth = parseInt(e.item.width, 10) / (curRow.querySelectorAll(':scope > td, :scope > th').length + 1);
|
|
213
|
+
var currentTabElm = ej2_base_1.closest(curRow, 'table');
|
|
214
|
+
var thTdElm = ej2_base_1.closest(curRow, 'table').querySelectorAll('th,td');
|
|
215
|
+
for (var i = 0; i < thTdElm.length; i++) {
|
|
216
|
+
thTdElm[i].dataset.oldWidth = (thTdElm[i].offsetWidth / currentTabElm.offsetWidth * 100) + '%';
|
|
217
|
+
}
|
|
218
|
+
if (ej2_base_1.isNullOrUndefined(currentTabElm.style.width) || currentTabElm.style.width === '') {
|
|
219
|
+
currentTabElm.style.width = currentTabElm.offsetWidth + 'px';
|
|
220
|
+
}
|
|
221
|
+
for (var i = 0; i < allRows.length; i++) {
|
|
222
|
+
curCell = allRows[i].querySelectorAll(':scope > td, :scope > th')[colIndex];
|
|
223
|
+
var colTemplate = curCell.cloneNode(true);
|
|
224
|
+
var style = colTemplate.getAttribute('style');
|
|
225
|
+
if (style) {
|
|
226
|
+
var updatedStyle = this.cellStyleCleanup(style);
|
|
227
|
+
colTemplate.style.cssText = updatedStyle;
|
|
228
|
+
}
|
|
229
|
+
colTemplate.innerHTML = '';
|
|
230
|
+
colTemplate.appendChild(ej2_base_1.createElement('br'));
|
|
231
|
+
colTemplate.removeAttribute('class');
|
|
232
|
+
colTemplate.removeAttribute('colspan');
|
|
233
|
+
colTemplate.removeAttribute('rowspan');
|
|
234
|
+
(e.item.subCommand === 'InsertColumnLeft') ? curCell.parentElement.insertBefore(colTemplate, curCell) :
|
|
235
|
+
this.insertAfter(colTemplate, curCell);
|
|
236
|
+
colTemplate.style.width = currentWidth.toFixed(4) + '%';
|
|
237
|
+
delete colTemplate.dataset.oldWidth;
|
|
238
|
+
}
|
|
239
|
+
for (var i = 0; i < thTdElm.length; i++) {
|
|
240
|
+
thTdElm[i].style.width = (Number(thTdElm[i].dataset.oldWidth.split('%')[0]) * currentWidth / previousWidth).toFixed(4) + '%';
|
|
241
|
+
delete thTdElm[i].dataset.oldWidth;
|
|
242
|
+
}
|
|
243
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, selectedCell, selectedCell, 0, 0);
|
|
244
|
+
if (e.callBack) {
|
|
245
|
+
e.callBack({
|
|
246
|
+
requestType: e.item.subCommand,
|
|
247
|
+
editorMode: 'HTML',
|
|
248
|
+
event: e.event,
|
|
249
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
250
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
TableCommand.prototype.setBGColor = function (args) {
|
|
255
|
+
var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
|
|
256
|
+
var start = range.startContainer.nodeType === 3 ?
|
|
257
|
+
range.startContainer.parentNode : range.startContainer;
|
|
258
|
+
this.curTable = start.closest('table');
|
|
259
|
+
var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
|
|
260
|
+
for (var i = 0; i < selectedCells.length; i++) {
|
|
261
|
+
selectedCells[i].style.backgroundColor = args.value.toString();
|
|
262
|
+
}
|
|
263
|
+
this.parent.undoRedoManager.saveData();
|
|
264
|
+
if (args.callBack) {
|
|
265
|
+
args.callBack({
|
|
266
|
+
requestType: args.subCommand,
|
|
267
|
+
editorMode: 'HTML',
|
|
268
|
+
event: args.event,
|
|
269
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
270
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
TableCommand.prototype.deleteColumn = function (e) {
|
|
275
|
+
var selectedCell = e.item.selection.range.startContainer;
|
|
276
|
+
if (selectedCell.nodeType === 3) {
|
|
277
|
+
selectedCell = ej2_base_1.closest(selectedCell.parentElement, 'td,th');
|
|
278
|
+
}
|
|
279
|
+
var tBodyHeadEle = ej2_base_1.closest(selectedCell, selectedCell.tagName === 'TH' ? 'thead' : 'tbody');
|
|
280
|
+
var rowIndex = tBodyHeadEle && Array.prototype.indexOf.call(tBodyHeadEle.childNodes, selectedCell.parentNode);
|
|
281
|
+
this.curTable = ej2_base_1.closest(selectedCell, 'table');
|
|
282
|
+
var curRow = ej2_base_1.closest(selectedCell, 'tr');
|
|
283
|
+
if (curRow.querySelectorAll('th,td').length === 1) {
|
|
284
|
+
e.item.selection.restore();
|
|
285
|
+
ej2_base_1.detach(ej2_base_1.closest(selectedCell.parentElement, 'table'));
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
var deleteIndex = void 0;
|
|
289
|
+
var allCells = this.getCorrespondingColumns();
|
|
290
|
+
var selectedMinMaxIndex = this.getSelectedCellMinMaxIndex(allCells);
|
|
291
|
+
var minCol = selectedMinMaxIndex.startColumn;
|
|
292
|
+
var maxCol = selectedMinMaxIndex.endColumn;
|
|
293
|
+
for (var i = 0; i < allCells.length; i++) {
|
|
294
|
+
var currentRow = allCells[i];
|
|
295
|
+
for (var j = 0; j < currentRow.length; j++) {
|
|
296
|
+
var currentCell = currentRow[j];
|
|
297
|
+
var currentCellIndex = this.getCorrespondingIndex(currentCell, allCells);
|
|
298
|
+
var colSpanVal = parseInt(currentCell.getAttribute('colspan'), 10) || 1;
|
|
299
|
+
if (currentCellIndex[1] + (colSpanVal - 1) >= minCol && currentCellIndex[1] <= maxCol) {
|
|
300
|
+
if (colSpanVal > 1) {
|
|
301
|
+
currentCell.setAttribute('colspan', (colSpanVal - 1).toString());
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
ej2_base_1.detach(currentCell);
|
|
305
|
+
deleteIndex = j;
|
|
306
|
+
if (ej2_base_1.Browser.isIE) {
|
|
307
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, this.curTable.querySelector('td'), this.curTable.querySelector('td'), 0, 0);
|
|
308
|
+
this.curTable.querySelector('td, th').classList.add('e-cell-select');
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
if (deleteIndex > -1) {
|
|
315
|
+
var rowHeadEle = tBodyHeadEle.children[rowIndex];
|
|
316
|
+
var nextFocusCell = rowHeadEle &&
|
|
317
|
+
rowHeadEle.children[(deleteIndex <= rowHeadEle.children.length - 1 ? deleteIndex : deleteIndex - 1)];
|
|
318
|
+
if (nextFocusCell) {
|
|
319
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, nextFocusCell, nextFocusCell, 0, 0);
|
|
320
|
+
nextFocusCell.classList.add('e-cell-select');
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (e.callBack) {
|
|
325
|
+
var sContainer = this.parent.nodeSelection.getRange(this.parent.currentDocument).startContainer;
|
|
326
|
+
if (sContainer.nodeName !== 'TD') {
|
|
327
|
+
var startChildLength = this.parent.nodeSelection.getRange(this.parent.currentDocument).startOffset;
|
|
328
|
+
var focusNode = sContainer.children[startChildLength];
|
|
329
|
+
if (focusNode) {
|
|
330
|
+
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, focusNode, 0);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
e.callBack({
|
|
334
|
+
requestType: e.item.subCommand,
|
|
335
|
+
editorMode: 'HTML',
|
|
336
|
+
event: e.event,
|
|
337
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
338
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
TableCommand.prototype.deleteRow = function (e) {
|
|
343
|
+
var selectedCell = e.item.selection.range.startContainer;
|
|
344
|
+
if (selectedCell.nodeType === 3) {
|
|
345
|
+
selectedCell = ej2_base_1.closest(selectedCell.parentElement, 'td,th');
|
|
346
|
+
}
|
|
347
|
+
var colIndex = Array.prototype.indexOf.call(selectedCell.parentNode.childNodes, selectedCell);
|
|
348
|
+
this.curTable = ej2_base_1.closest(selectedCell, 'table');
|
|
349
|
+
var currentRow;
|
|
350
|
+
var allCells = this.getCorrespondingColumns();
|
|
351
|
+
var minMaxIndex = this.getSelectedCellMinMaxIndex(allCells);
|
|
352
|
+
var maxI;
|
|
353
|
+
var j;
|
|
354
|
+
if (this.curTable.rows.length === 1) {
|
|
355
|
+
e.item.selection.restore();
|
|
356
|
+
ej2_base_1.detach(ej2_base_1.closest(selectedCell.parentElement, 'table'));
|
|
357
|
+
}
|
|
358
|
+
else {
|
|
359
|
+
for (maxI = minMaxIndex.endRow; maxI >= minMaxIndex.startRow; maxI--) {
|
|
360
|
+
currentRow = this.curTable.rows[maxI];
|
|
361
|
+
for (j = 0; j < allCells[maxI].length; j++) {
|
|
362
|
+
if (j === 0 || allCells[maxI][j] !== allCells[maxI][j - 1]) {
|
|
363
|
+
if (1 < parseInt(allCells[maxI][j].getAttribute('rowspan'), 10)) {
|
|
364
|
+
var rowSpanVal = parseInt(allCells[maxI][j].getAttribute('rowspan'), 10) - 1;
|
|
365
|
+
if (1 === rowSpanVal) {
|
|
366
|
+
allCells[maxI][j].removeAttribute('rowspan');
|
|
367
|
+
var cell = this.getMergedRow(this.getCorrespondingColumns())[j];
|
|
368
|
+
if (cell) {
|
|
369
|
+
var cloneNode = cell.cloneNode(true);
|
|
370
|
+
cloneNode.innerHTML = '<br>';
|
|
371
|
+
if (cell.parentElement) {
|
|
372
|
+
cell.parentElement.insertBefore(cloneNode, cell);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
allCells[maxI][j].setAttribute('rowspan', rowSpanVal.toString());
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
if (maxI < allCells.length - 1 && allCells[maxI][j] === allCells[maxI + 1][j] && (0 === maxI ||
|
|
382
|
+
allCells[maxI][j] !== allCells[maxI - 1][j])) {
|
|
383
|
+
var element = allCells[maxI][j];
|
|
384
|
+
var index = void 0;
|
|
385
|
+
for (index = j; 0 < index && allCells[maxI][index] === allCells[maxI][index - 1]; index--) {
|
|
386
|
+
if (index === 0) {
|
|
387
|
+
this.curTable.rows[maxI + 1].prepend(element);
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
allCells[maxI + 1][index - 1].insertAdjacentElement('afterend', element);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
var deleteIndex = currentRow.rowIndex;
|
|
396
|
+
this.curTable.deleteRow(deleteIndex);
|
|
397
|
+
var focusTrEle = !ej2_base_1.isNullOrUndefined(this.curTable.rows[deleteIndex]) ? this.curTable.querySelectorAll('tbody tr')[deleteIndex]
|
|
398
|
+
: this.curTable.querySelectorAll('tbody tr')[deleteIndex - 1];
|
|
399
|
+
var nextFocusCell = focusTrEle && focusTrEle.querySelectorAll('td')[colIndex];
|
|
400
|
+
if (nextFocusCell) {
|
|
401
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, nextFocusCell, nextFocusCell, 0, 0);
|
|
402
|
+
nextFocusCell.classList.add('e-cell-select');
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, this.curTable.querySelector('td'), this.curTable.querySelector('td'), 0, 0);
|
|
406
|
+
this.curTable.querySelector('td, th').classList.add('e-cell-select');
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (e.callBack) {
|
|
411
|
+
e.callBack({
|
|
412
|
+
requestType: e.item.subCommand,
|
|
413
|
+
editorMode: 'HTML',
|
|
414
|
+
event: e.event,
|
|
415
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
416
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
TableCommand.prototype.getMergedRow = function (cells) {
|
|
421
|
+
var mergedRow;
|
|
422
|
+
for (var i = 0; i < cells.length; i++) {
|
|
423
|
+
if (cells[i].length !== this.curTable.rows[0].childNodes.length) {
|
|
424
|
+
mergedRow = cells[i];
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return mergedRow;
|
|
428
|
+
};
|
|
429
|
+
TableCommand.prototype.removeTable = function (e) {
|
|
430
|
+
var selectedCell = e.item.selection.range.startContainer;
|
|
431
|
+
selectedCell = (selectedCell.nodeType === 3) ? selectedCell.parentNode : selectedCell;
|
|
432
|
+
var selectedTable = ej2_base_1.closest(selectedCell.parentElement, 'table');
|
|
433
|
+
if (selectedTable) {
|
|
434
|
+
ej2_base_1.detach(selectedTable);
|
|
435
|
+
e.item.selection.restore();
|
|
436
|
+
}
|
|
437
|
+
if (e.callBack) {
|
|
438
|
+
e.callBack({
|
|
439
|
+
requestType: e.item.subCommand,
|
|
440
|
+
editorMode: 'HTML',
|
|
441
|
+
event: e.event,
|
|
442
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
443
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
};
|
|
447
|
+
TableCommand.prototype.tableHeader = function (e) {
|
|
448
|
+
var headerExit = false;
|
|
449
|
+
var selectedCell = e.item.selection.range.startContainer;
|
|
450
|
+
selectedCell = (selectedCell.nodeType === 3) ? selectedCell.parentNode : selectedCell;
|
|
451
|
+
var table = ej2_base_1.closest(selectedCell.parentElement, 'table');
|
|
452
|
+
[].slice.call(table.childNodes).forEach(function (el) {
|
|
453
|
+
if (el.nodeName === 'THEAD') {
|
|
454
|
+
headerExit = true;
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
if (table && !headerExit) {
|
|
458
|
+
var cellCount = table.querySelector('tr').childElementCount;
|
|
459
|
+
var colSpanCount = 0;
|
|
460
|
+
for (var i = 0; i < cellCount; i++) {
|
|
461
|
+
colSpanCount = colSpanCount + (parseInt(table.querySelector('tr').children[i].getAttribute('colspan'), 10) || 1);
|
|
462
|
+
}
|
|
463
|
+
var header = table.createTHead();
|
|
464
|
+
var row = header.insertRow(0);
|
|
465
|
+
for (var j = 0; j < colSpanCount; j++) {
|
|
466
|
+
var th = ej2_base_1.createElement('th');
|
|
467
|
+
th.appendChild(ej2_base_1.createElement('br'));
|
|
468
|
+
row.appendChild(th);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
else {
|
|
472
|
+
table.deleteTHead();
|
|
473
|
+
}
|
|
474
|
+
if (e.callBack) {
|
|
475
|
+
e.callBack({
|
|
476
|
+
requestType: e.item.subCommand,
|
|
477
|
+
editorMode: 'HTML',
|
|
478
|
+
event: e.event,
|
|
479
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
480
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
TableCommand.prototype.tableVerticalAlign = function (e) {
|
|
485
|
+
var value = '';
|
|
486
|
+
switch (e.item.subCommand) {
|
|
487
|
+
case 'AlignTop':
|
|
488
|
+
value = 'top';
|
|
489
|
+
break;
|
|
490
|
+
case 'AlignMiddle':
|
|
491
|
+
value = 'middle';
|
|
492
|
+
break;
|
|
493
|
+
case 'AlignBottom':
|
|
494
|
+
value = 'bottom';
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
e.item.tableCell.style.verticalAlign = value;
|
|
498
|
+
if (value && value !== '' && e.item.tableCell.getAttribute('valign')) {
|
|
499
|
+
e.item.tableCell.removeAttribute('valign');
|
|
500
|
+
}
|
|
501
|
+
if (e.callBack) {
|
|
502
|
+
e.callBack({
|
|
503
|
+
requestType: e.item.subCommand,
|
|
504
|
+
editorMode: 'HTML',
|
|
505
|
+
event: e.event,
|
|
506
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
507
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
TableCommand.prototype.cellMerge = function (e) {
|
|
512
|
+
if (ej2_base_1.isNullOrUndefined(this.curTable)) {
|
|
513
|
+
this.curTable = ej2_base_1.closest(this.parent.nodeSelection.range.startContainer.parentElement, 'table');
|
|
514
|
+
}
|
|
515
|
+
var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
|
|
516
|
+
if (selectedCells.length < 2) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
this.mergeCellContent();
|
|
520
|
+
var minMaxIndexes = this.getSelectedMinMaxIndexes(this.getCorrespondingColumns());
|
|
521
|
+
var firstCell = selectedCells[0];
|
|
522
|
+
var rowSelectedCells = firstCell.parentElement.querySelectorAll('.e-cell-select');
|
|
523
|
+
var maxHeight = 0;
|
|
524
|
+
for (var j = 0; j < rowSelectedCells.length; j++) {
|
|
525
|
+
var cellHeight = rowSelectedCells[j].offsetHeight;
|
|
526
|
+
if (cellHeight > maxHeight) {
|
|
527
|
+
maxHeight = cellHeight;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
if (minMaxIndexes.startColumn < minMaxIndexes.endColumn) {
|
|
531
|
+
firstCell.setAttribute('colspan', (minMaxIndexes.endColumn - minMaxIndexes.startColumn + 1).toString());
|
|
532
|
+
}
|
|
533
|
+
if (minMaxIndexes.startRow < minMaxIndexes.endRow) {
|
|
534
|
+
firstCell.setAttribute('rowspan', (minMaxIndexes.endRow - minMaxIndexes.startRow + 1).toString());
|
|
535
|
+
}
|
|
536
|
+
var totalWidth = 0;
|
|
537
|
+
var unit;
|
|
538
|
+
for (var j = rowSelectedCells.length - 1; j >= 0; j--) {
|
|
539
|
+
if (!ej2_base_1.isNullOrUndefined(rowSelectedCells[j].style.width)
|
|
540
|
+
&& rowSelectedCells[j].style.width !== '') {
|
|
541
|
+
if (!unit) {
|
|
542
|
+
var match = rowSelectedCells[j].style.width.match(/^([\d.]+)([a-z%]+)$/i);
|
|
543
|
+
unit = match ? match[2] : '%';
|
|
544
|
+
}
|
|
545
|
+
totalWidth = totalWidth + parseFloat(rowSelectedCells[j].style.width);
|
|
546
|
+
}
|
|
547
|
+
else {
|
|
548
|
+
totalWidth = totalWidth + ((rowSelectedCells[j].offsetWidth / this.curTable.offsetWidth) * 100);
|
|
549
|
+
unit = '%';
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
firstCell.style.width = totalWidth + unit;
|
|
553
|
+
firstCell.style.height = maxHeight + 'px';
|
|
554
|
+
for (var i = 1; i <= selectedCells.length - 1; i++) {
|
|
555
|
+
ej2_base_1.detach(selectedCells[i]);
|
|
556
|
+
}
|
|
557
|
+
for (var i = 0; i < this.curTable.rows.length; i++) {
|
|
558
|
+
if (this.curTable.rows[i].innerHTML.trim() === '') {
|
|
559
|
+
ej2_base_1.detach(this.curTable.rows[i]);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
util_1.removeClassWithAttr(this.curTable.querySelectorAll('table td, table th'), 'e-multi-cells-select');
|
|
563
|
+
util_1.removeClassWithAttr(this.curTable.querySelectorAll('table td, table th'), 'e-cell-select-end');
|
|
564
|
+
this.updateRowSpanStyle(minMaxIndexes.startRow, minMaxIndexes.endRow, this.getCorrespondingColumns());
|
|
565
|
+
this.updateColSpanStyle(minMaxIndexes.startColumn, minMaxIndexes.endColumn, this.getCorrespondingColumns());
|
|
566
|
+
e.item.selection.setSelectionText(this.parent.currentDocument, e.item.selection.range.startContainer, e.item.selection.range.startContainer, 0, 0);
|
|
567
|
+
if (this.parent.nodeSelection && firstCell) {
|
|
568
|
+
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, firstCell, 0);
|
|
569
|
+
}
|
|
570
|
+
if (e.callBack) {
|
|
571
|
+
e.callBack({
|
|
572
|
+
requestType: e.item.subCommand,
|
|
573
|
+
editorMode: 'HTML',
|
|
574
|
+
event: e.event,
|
|
575
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
576
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
TableCommand.prototype.updateColSpanStyle = function (min, max, elements) {
|
|
581
|
+
var colValue;
|
|
582
|
+
var colIndex;
|
|
583
|
+
var colMin;
|
|
584
|
+
var index = 0;
|
|
585
|
+
var attrValue;
|
|
586
|
+
var count = 0;
|
|
587
|
+
var eleArray = elements;
|
|
588
|
+
if (min < (max = Math.min(max, eleArray[0].length - 1))) {
|
|
589
|
+
for (colIndex = min; colIndex <= max; colIndex++) {
|
|
590
|
+
index = Math.min(parseInt(eleArray[0][colIndex].getAttribute('colspan'), 10) || 1, max - min + 1);
|
|
591
|
+
if (!(min < colIndex && eleArray[0][colIndex] === eleArray[0][colIndex - 1]) && 1 < index &&
|
|
592
|
+
eleArray[0][colIndex] === eleArray[0][colIndex + 1]) {
|
|
593
|
+
for (count = index - 1, colValue = 1; colValue < eleArray.length; colValue++) {
|
|
594
|
+
if (eleArray[colValue][colIndex] !== eleArray[colValue - 1][colIndex]) {
|
|
595
|
+
for (colMin = colIndex; colMin < colIndex + index; colMin++) {
|
|
596
|
+
attrValue = parseInt(eleArray[colValue][colMin].getAttribute('colspan'), 10) || 1;
|
|
597
|
+
if (1 < attrValue &&
|
|
598
|
+
eleArray[colValue][colMin] === eleArray[colValue][colMin + 1]) {
|
|
599
|
+
colMin += count = Math.min(count, attrValue - 1);
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
count = Math.max(0, count - 1);
|
|
603
|
+
if (count === 0) {
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if (!count) {
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
if (count) {
|
|
616
|
+
this.updateCellAttribute(eleArray, count, 'colspan', 0, eleArray.length - 1, min, max);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
TableCommand.prototype.updateRowSpanStyle = function (min, max, ele) {
|
|
621
|
+
var rowValue;
|
|
622
|
+
var colIndex;
|
|
623
|
+
var rowMin;
|
|
624
|
+
var index = 0;
|
|
625
|
+
var attrValue;
|
|
626
|
+
var count = 0;
|
|
627
|
+
var eleArray = ele;
|
|
628
|
+
if (min < (max = Math.min(max, eleArray.length - 1))) {
|
|
629
|
+
for (rowValue = min; rowValue <= max; rowValue++) {
|
|
630
|
+
if (!(min < rowValue && eleArray[rowValue][0] === eleArray[rowValue - 1][0])
|
|
631
|
+
&& eleArray[rowValue][0] && 1 < (index = Math.min(parseInt(eleArray[rowValue][0].getAttribute('rowspan'), 10) ||
|
|
632
|
+
1, max - min + 1)) && eleArray[rowValue][0] === eleArray[rowValue + 1][0]) {
|
|
633
|
+
for (count = index - 1, colIndex = 1; colIndex < eleArray[0].length; colIndex++) {
|
|
634
|
+
if (eleArray[rowValue][colIndex] !== eleArray[rowValue][colIndex - 1]) {
|
|
635
|
+
for (rowMin = rowValue; rowMin < rowValue + index; rowMin++) {
|
|
636
|
+
attrValue = parseInt(eleArray[rowMin][colIndex].getAttribute('rowspan'), 10) || 1;
|
|
637
|
+
if (1 < attrValue && eleArray[rowMin][colIndex] ===
|
|
638
|
+
eleArray[rowMin + 1][colIndex]) {
|
|
639
|
+
rowMin += count = Math.min(count, attrValue - 1);
|
|
640
|
+
}
|
|
641
|
+
else if (!(count = Math.max(0, count - 1))) {
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
if (!count) {
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
if (count) {
|
|
653
|
+
this.updateCellAttribute(eleArray, count, 'rowspan', min, max, 0, eleArray[0].length - 1);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
TableCommand.prototype.updateCellAttribute = function (elements, index, attr, min, max, firstIndex, length) {
|
|
658
|
+
var rowIndex;
|
|
659
|
+
var colIndex;
|
|
660
|
+
var spanCount;
|
|
661
|
+
for (rowIndex = min; rowIndex <= max; rowIndex++) {
|
|
662
|
+
for (colIndex = firstIndex; colIndex <= length; colIndex++) {
|
|
663
|
+
spanCount = parseInt(elements[rowIndex][colIndex].getAttribute(attr), 10) || 1;
|
|
664
|
+
if (min < rowIndex && elements[rowIndex][colIndex] === elements[rowIndex - 1][colIndex] ||
|
|
665
|
+
firstIndex < colIndex && elements[rowIndex][colIndex] ===
|
|
666
|
+
elements[rowIndex][colIndex - 1] || 1 < (spanCount)) {
|
|
667
|
+
if ((1 < spanCount - index)) {
|
|
668
|
+
elements[rowIndex][colIndex].setAttribute(attr, (spanCount - index).toString());
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
elements[rowIndex][colIndex].removeAttribute(attr);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
};
|
|
677
|
+
TableCommand.prototype.mergeCellContent = function () {
|
|
678
|
+
var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
|
|
679
|
+
var innerHtml = selectedCells[0].innerHTML === '<br>' ? '' : selectedCells[0].innerHTML;
|
|
680
|
+
for (var i = 1; i < selectedCells.length; i++) {
|
|
681
|
+
if ('<br>' !== selectedCells[i].innerHTML) {
|
|
682
|
+
innerHtml = innerHtml ? innerHtml + '<br>' + selectedCells[i].innerHTML : innerHtml + selectedCells[i].innerHTML;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
selectedCells[0].innerHTML = innerHtml;
|
|
686
|
+
};
|
|
687
|
+
TableCommand.prototype.getSelectedMinMaxIndexes = function (correspondingCells) {
|
|
688
|
+
var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
|
|
689
|
+
if (0 < selectedCells.length) {
|
|
690
|
+
var minRow = correspondingCells.length;
|
|
691
|
+
var maxRow = 0;
|
|
692
|
+
var minCol = correspondingCells[0].length;
|
|
693
|
+
var maxCol = 0;
|
|
694
|
+
for (var i = 0; i < selectedCells.length; i++) {
|
|
695
|
+
var currentRowCol = this.getCorrespondingIndex(selectedCells[i], correspondingCells);
|
|
696
|
+
var targetRowCol = this.FindIndex(currentRowCol[0], currentRowCol[1], correspondingCells);
|
|
697
|
+
minRow = Math.min(currentRowCol[0], minRow);
|
|
698
|
+
maxRow = Math.max(targetRowCol[0], maxRow);
|
|
699
|
+
minCol = Math.min(currentRowCol[1], minCol);
|
|
700
|
+
maxCol = Math.max(targetRowCol[1], maxCol);
|
|
701
|
+
}
|
|
702
|
+
return {
|
|
703
|
+
startRow: minRow,
|
|
704
|
+
endRow: maxRow,
|
|
705
|
+
startColumn: minCol,
|
|
706
|
+
endColumn: maxCol
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
return null;
|
|
710
|
+
};
|
|
711
|
+
TableCommand.prototype.HorizontalSplit = function (e) {
|
|
712
|
+
var selectedCell = e.item.selection.range.startContainer;
|
|
713
|
+
this.curTable = ej2_base_1.closest(selectedCell.parentElement, 'table');
|
|
714
|
+
if (this.curTable.querySelectorAll('.e-cell-select').length > 1) {
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
this.activeCell = this.curTable.querySelector('.e-cell-select');
|
|
718
|
+
var newCell = this.activeCell.cloneNode(true);
|
|
719
|
+
newCell.removeAttribute('class');
|
|
720
|
+
newCell.innerHTML = '</br>';
|
|
721
|
+
var activeCellIndex = this.getCorrespondingIndex(this.activeCell, this.getCorrespondingColumns());
|
|
722
|
+
var correspondingCells = this.getCorrespondingColumns();
|
|
723
|
+
var activeCellRowSpan = this.activeCell.getAttribute('rowspan') ? parseInt(this.activeCell.getAttribute('rowspan'), 10) : 1;
|
|
724
|
+
if (activeCellRowSpan > 1) {
|
|
725
|
+
var avgCount = Math.ceil(activeCellRowSpan / 2);
|
|
726
|
+
1 < avgCount ? this.activeCell.setAttribute('rowspan', avgCount.toString()) :
|
|
727
|
+
this.activeCell.removeAttribute('rowspan');
|
|
728
|
+
1 < (activeCellRowSpan - avgCount) ? newCell.setAttribute('rowspan', (activeCellRowSpan - avgCount).toString()) : newCell.removeAttribute('rowspan');
|
|
729
|
+
var avgRowIndex = void 0;
|
|
730
|
+
var colIndex = void 0;
|
|
731
|
+
for (avgRowIndex = activeCellIndex[0] + Math.ceil(activeCellRowSpan / 2),
|
|
732
|
+
colIndex = 0 === activeCellIndex[1] ? activeCellIndex[1]
|
|
733
|
+
: activeCellIndex[1] - 1; 0 <= colIndex && (correspondingCells[avgRowIndex][colIndex] ===
|
|
734
|
+
correspondingCells[avgRowIndex][colIndex - 1] || 0 < avgRowIndex && correspondingCells[avgRowIndex][colIndex]
|
|
735
|
+
=== correspondingCells[avgRowIndex - 1][colIndex]);) {
|
|
736
|
+
colIndex--;
|
|
737
|
+
}
|
|
738
|
+
if (colIndex === -1) {
|
|
739
|
+
if (this.curTable.rows[avgRowIndex].firstChild) {
|
|
740
|
+
this.curTable.rows[avgRowIndex].prepend(newCell);
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
this.curTable.appendChild(newCell);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
else {
|
|
747
|
+
correspondingCells[avgRowIndex][colIndex].insertAdjacentElement('afterend', newCell);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
var newTrEle = ej2_base_1.createElement('tr');
|
|
752
|
+
newTrEle.appendChild(newCell);
|
|
753
|
+
var selectedRow = correspondingCells[activeCellIndex[0]];
|
|
754
|
+
for (var j = 0; j <= selectedRow.length - 1; j++) {
|
|
755
|
+
if (selectedRow[j] !== selectedRow[j - 1] && selectedRow[j] !== this.activeCell) {
|
|
756
|
+
selectedRow[j].setAttribute('rowspan', ((parseInt(selectedRow[j].getAttribute('rowspan'), 10) ?
|
|
757
|
+
parseInt(selectedRow[j].getAttribute('rowspan'), 10) : 1) + 1).toString());
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
this.activeCell.parentNode.insertAdjacentElement('afterend', newTrEle);
|
|
761
|
+
}
|
|
762
|
+
if (e.callBack) {
|
|
763
|
+
e.callBack({
|
|
764
|
+
requestType: e.item.subCommand,
|
|
765
|
+
editorMode: 'HTML',
|
|
766
|
+
event: e.event,
|
|
767
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
768
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
TableCommand.prototype.VerticalSplit = function (e) {
|
|
773
|
+
var selectedCell = e.item.selection.range.startContainer;
|
|
774
|
+
this.curTable = ej2_base_1.closest(selectedCell.parentElement, 'table');
|
|
775
|
+
if (this.curTable.querySelectorAll('.e-cell-select').length > 1) {
|
|
776
|
+
return;
|
|
777
|
+
}
|
|
778
|
+
this.activeCell = this.curTable.querySelector('.e-cell-select');
|
|
779
|
+
var allRows = this.curTable.rows;
|
|
780
|
+
var newCell = this.activeCell.cloneNode(true);
|
|
781
|
+
newCell.removeAttribute('class');
|
|
782
|
+
newCell.innerHTML = '</br>';
|
|
783
|
+
var activeCellIndex = this.getCorrespondingIndex(this.activeCell, this.getCorrespondingColumns());
|
|
784
|
+
var correspondingColumns = this.getCorrespondingColumns();
|
|
785
|
+
var activeCellcolSpan = parseInt(this.activeCell.getAttribute('colspan'), 10) || 1;
|
|
786
|
+
if (activeCellcolSpan > 1) {
|
|
787
|
+
var colSpan = Math.ceil(activeCellcolSpan / 2);
|
|
788
|
+
var getColSizes = this.getColSizes(this.curTable);
|
|
789
|
+
var activeCellUpdatedWidth = this.getSplitColWidth(activeCellIndex[1], activeCellIndex[1] + colSpan - 1, getColSizes);
|
|
790
|
+
var newCellWidth = this.getSplitColWidth(activeCellIndex[1] + colSpan, activeCellIndex[1] + activeCellcolSpan - 1, getColSizes);
|
|
791
|
+
var activeCellWidth = this.convertPixelToPercentage(this.activeCell.offsetWidth, this.curTable.offsetWidth);
|
|
792
|
+
newCellWidth = (activeCellWidth - activeCellUpdatedWidth) < newCellWidth ?
|
|
793
|
+
(activeCellWidth - activeCellUpdatedWidth) : newCellWidth;
|
|
794
|
+
if (1 < colSpan) {
|
|
795
|
+
this.activeCell.setAttribute('colspan', colSpan.toString());
|
|
796
|
+
}
|
|
797
|
+
else {
|
|
798
|
+
this.activeCell.removeAttribute('colspan');
|
|
799
|
+
}
|
|
800
|
+
if (1 < activeCellcolSpan - colSpan) {
|
|
801
|
+
newCell.setAttribute('colspan', (activeCellcolSpan - colSpan).toString());
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
newCell.removeAttribute('colspan');
|
|
805
|
+
}
|
|
806
|
+
this.activeCell.style.width = activeCellUpdatedWidth + '%';
|
|
807
|
+
newCell.style.width = newCellWidth + '%';
|
|
808
|
+
}
|
|
809
|
+
else {
|
|
810
|
+
var avgWidth = parseFloat(this.activeCell.style.width) / 2;
|
|
811
|
+
for (var i = 0; i <= allRows.length - 1; i++) {
|
|
812
|
+
if (0 === i || correspondingColumns[i][activeCellIndex[1]] !== correspondingColumns[i - 1][activeCellIndex[1]]) {
|
|
813
|
+
var currentCell = correspondingColumns[i][activeCellIndex[1]];
|
|
814
|
+
if (currentCell !== this.activeCell) {
|
|
815
|
+
currentCell.setAttribute('colspan', ((parseInt(currentCell.getAttribute('colspan'), 10) ?
|
|
816
|
+
parseInt(currentCell.getAttribute('colspan'), 10) : 1) + 1).toString());
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
this.activeCell.style.width = avgWidth + '%';
|
|
821
|
+
newCell.style.width = avgWidth + '%';
|
|
822
|
+
}
|
|
823
|
+
this.activeCell.parentNode.insertBefore(newCell, this.activeCell.nextSibling);
|
|
824
|
+
if (e.callBack) {
|
|
825
|
+
e.callBack({
|
|
826
|
+
requestType: e.item.subCommand,
|
|
827
|
+
editorMode: 'HTML',
|
|
828
|
+
event: e.event,
|
|
829
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
830
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
TableCommand.prototype.getSplitColWidth = function (startIndex, endInex, sizes) {
|
|
835
|
+
var width = 0;
|
|
836
|
+
for (var i = startIndex; i <= endInex; i++) {
|
|
837
|
+
width += sizes[i];
|
|
838
|
+
}
|
|
839
|
+
return this.convertPixelToPercentage(width, this.curTable.offsetWidth);
|
|
840
|
+
};
|
|
841
|
+
TableCommand.prototype.getColSizes = function (curTable) {
|
|
842
|
+
var cellColl = curTable.rows[0].cells;
|
|
843
|
+
var cellCount = 0;
|
|
844
|
+
for (var cell = 0; cell < cellColl.length; cell++) {
|
|
845
|
+
cellCount = cellCount + cellColl[cell].colSpan;
|
|
846
|
+
}
|
|
847
|
+
var sizes = new Array(cellCount);
|
|
848
|
+
var rowSpanCells = new Map();
|
|
849
|
+
for (var i = 0; i < curTable.rows.length; i++) {
|
|
850
|
+
var currentColIndex = 0;
|
|
851
|
+
for (var k = 0; k < curTable.rows[i].cells.length; k++) {
|
|
852
|
+
for (var l = 1; l < curTable.rows[i].cells[k].rowSpan; l++) {
|
|
853
|
+
var key = "" + (i + l) + currentColIndex;
|
|
854
|
+
rowSpanCells.set(key, curTable.rows[i].cells[k]);
|
|
855
|
+
}
|
|
856
|
+
var cellIndex = this.getCellIndex(rowSpanCells, i, k);
|
|
857
|
+
if (cellIndex > currentColIndex) {
|
|
858
|
+
currentColIndex = cellIndex;
|
|
859
|
+
}
|
|
860
|
+
var width = curTable.rows[i].cells[k].offsetWidth;
|
|
861
|
+
if (!sizes[currentColIndex] || width < sizes[currentColIndex]) {
|
|
862
|
+
sizes[currentColIndex] = width;
|
|
863
|
+
}
|
|
864
|
+
currentColIndex += 1 + curTable.rows[i].cells[k].colSpan - 1;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return sizes;
|
|
868
|
+
};
|
|
869
|
+
TableCommand.prototype.getCellIndex = function (rowSpanCells, rowIndex, colIndex) {
|
|
870
|
+
var cellKey = "" + rowIndex + colIndex;
|
|
871
|
+
var spannedCell = rowSpanCells.get(cellKey);
|
|
872
|
+
if (spannedCell) {
|
|
873
|
+
return this.getCellIndex(rowSpanCells, rowIndex, colIndex + spannedCell.colSpan);
|
|
874
|
+
}
|
|
875
|
+
else {
|
|
876
|
+
return colIndex;
|
|
877
|
+
}
|
|
878
|
+
};
|
|
879
|
+
TableCommand.prototype.convertPixelToPercentage = function (value, offsetValue) {
|
|
880
|
+
return (value / offsetValue) * 100;
|
|
881
|
+
};
|
|
882
|
+
TableCommand.prototype.getCorrespondingColumns = function () {
|
|
883
|
+
var elementArray = [];
|
|
884
|
+
var _this = this;
|
|
885
|
+
var colspan = 0;
|
|
886
|
+
var allRows = _this.curTable.rows;
|
|
887
|
+
for (var i = 0; i <= allRows.length - 1; i++) {
|
|
888
|
+
var ele = allRows[i];
|
|
889
|
+
var index = 0;
|
|
890
|
+
for (var j = 0; j <= ele.children.length - 1; j++) {
|
|
891
|
+
var colEle = ele.children[j];
|
|
892
|
+
for (var ele_1 = colEle, colspan_1 = parseInt(ele_1.getAttribute('colspan'), 10) || 1, rowSpan = parseInt(ele_1.getAttribute('rowspan'), 10) || 1, rowIndex = i; rowIndex < i + rowSpan; rowIndex++) {
|
|
893
|
+
for (var colIndex = index; colIndex < index + colspan_1; colIndex++) {
|
|
894
|
+
if (!elementArray[rowIndex]) {
|
|
895
|
+
elementArray[rowIndex] = [];
|
|
896
|
+
}
|
|
897
|
+
if (elementArray[rowIndex][colIndex]) {
|
|
898
|
+
index++;
|
|
899
|
+
}
|
|
900
|
+
else {
|
|
901
|
+
elementArray[rowIndex][colIndex] = colEle;
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
index += colspan;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
return elementArray;
|
|
909
|
+
};
|
|
910
|
+
TableCommand.prototype.FindIndex = function (rowIndex, columnIndex, cells) {
|
|
911
|
+
var nextIndex;
|
|
912
|
+
var nextCol;
|
|
913
|
+
for (nextIndex = rowIndex + 1, nextCol = columnIndex + 1; nextIndex < cells.length;) {
|
|
914
|
+
if (cells[nextIndex][columnIndex] !== cells[rowIndex][columnIndex]) {
|
|
915
|
+
nextIndex--;
|
|
916
|
+
break;
|
|
917
|
+
}
|
|
918
|
+
nextIndex++;
|
|
919
|
+
}
|
|
920
|
+
for (nextIndex === cells.length && nextIndex--; nextCol < cells[rowIndex].length;) {
|
|
921
|
+
if (cells[rowIndex][nextCol] !== cells[rowIndex][columnIndex]) {
|
|
922
|
+
nextCol--;
|
|
923
|
+
break;
|
|
924
|
+
}
|
|
925
|
+
nextCol++;
|
|
926
|
+
}
|
|
927
|
+
return nextCol === cells[rowIndex].length && nextCol--,
|
|
928
|
+
[
|
|
929
|
+
nextIndex,
|
|
930
|
+
nextCol
|
|
931
|
+
];
|
|
932
|
+
};
|
|
933
|
+
TableCommand.prototype.getCorrespondingIndex = function (cell, allCells) {
|
|
934
|
+
for (var i = 0; i < allCells.length; i++) {
|
|
935
|
+
for (var j = 0; j < allCells[i].length; j++) {
|
|
936
|
+
if (allCells[i][j] === cell) {
|
|
937
|
+
return [i, j];
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return [];
|
|
942
|
+
};
|
|
943
|
+
TableCommand.prototype.highlightCells = function (minRow, maxRow, minCol, maxCol, eleArray) {
|
|
944
|
+
var j;
|
|
945
|
+
var k;
|
|
946
|
+
var startCell;
|
|
947
|
+
var endCell;
|
|
948
|
+
var minRowIndex = minRow;
|
|
949
|
+
var maxRowIndex = maxRow;
|
|
950
|
+
var minColIndex = minCol;
|
|
951
|
+
var maxColIndex = maxCol;
|
|
952
|
+
var minMaxValues = new MinMax();
|
|
953
|
+
for (j = minRowIndex; j <= maxRowIndex; j++) {
|
|
954
|
+
startCell = this.getCorrespondingIndex(eleArray[j][minColIndex], eleArray);
|
|
955
|
+
endCell = this.FindIndex(startCell[0], startCell[1], eleArray);
|
|
956
|
+
if ((1 < (parseInt(eleArray[j][minColIndex].getAttribute('rowspan'), 10) || 1) ||
|
|
957
|
+
1 < (parseInt(eleArray[j][minColIndex].getAttribute('colspan'), 10) || 1)) &&
|
|
958
|
+
endCell) {
|
|
959
|
+
minRowIndex = Math.min(startCell[0], minRowIndex);
|
|
960
|
+
maxRowIndex = Math.max(endCell[0], maxRowIndex);
|
|
961
|
+
minColIndex = Math.min(startCell[1], minColIndex);
|
|
962
|
+
maxColIndex = Math.max(endCell[1], maxColIndex);
|
|
963
|
+
}
|
|
964
|
+
else if ((1 < (parseInt(eleArray[j][maxColIndex].getAttribute('rowspan'), 10) || 1) ||
|
|
965
|
+
1 < (parseInt(eleArray[j][maxColIndex].getAttribute('colspan'), 10) || 1))) {
|
|
966
|
+
startCell = this.getCorrespondingIndex(eleArray[j][maxColIndex], eleArray);
|
|
967
|
+
endCell = this.FindIndex(startCell[0], startCell[1], eleArray);
|
|
968
|
+
if (endCell) {
|
|
969
|
+
minRowIndex = Math.min(startCell[0], minRowIndex);
|
|
970
|
+
maxRowIndex = Math.max(endCell[0], maxRowIndex);
|
|
971
|
+
minColIndex = Math.min(startCell[1], minColIndex);
|
|
972
|
+
maxColIndex = Math.max(endCell[1], maxColIndex);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
for (k = minColIndex; k <= maxColIndex; k++) {
|
|
976
|
+
startCell = this.getCorrespondingIndex(eleArray[minRowIndex][k], eleArray);
|
|
977
|
+
endCell = this.FindIndex(startCell[0], startCell[1], eleArray);
|
|
978
|
+
if ((1 < (parseInt(eleArray[minRowIndex][k].getAttribute('rowspan'), 10) || 1) ||
|
|
979
|
+
1 < (parseInt(eleArray[minRowIndex][k].getAttribute('colspan'), 10) || 1)) &&
|
|
980
|
+
endCell) {
|
|
981
|
+
minRowIndex = Math.min(startCell[0], minRowIndex);
|
|
982
|
+
maxRowIndex = Math.max(endCell[0], maxRowIndex);
|
|
983
|
+
minColIndex = Math.min(startCell[1], minColIndex);
|
|
984
|
+
maxColIndex = Math.max(endCell[1], maxColIndex);
|
|
985
|
+
}
|
|
986
|
+
else if ((1 < (parseInt(eleArray[maxRowIndex][k].getAttribute('rowspan'), 10) || 1) ||
|
|
987
|
+
1 < (parseInt(eleArray[maxRowIndex][k].getAttribute('colspan'), 10) || 1))) {
|
|
988
|
+
startCell = this.getCorrespondingIndex(eleArray[maxRowIndex][k], eleArray);
|
|
989
|
+
endCell = this.FindIndex(startCell[0], startCell[1], eleArray);
|
|
990
|
+
if (endCell) {
|
|
991
|
+
minRowIndex = Math.min(startCell[0], minRowIndex);
|
|
992
|
+
maxRowIndex = Math.max(endCell[0], maxRowIndex);
|
|
993
|
+
minColIndex = Math.min(startCell[1], minColIndex);
|
|
994
|
+
maxColIndex = Math.max(endCell[1], maxColIndex);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
minMaxValues = minRowIndex === minRow && maxRowIndex === maxRow && minColIndex === minCol && maxColIndex === maxCol ? {
|
|
999
|
+
startRow: minRow,
|
|
1000
|
+
endRow: maxRow,
|
|
1001
|
+
startColumn: minCol,
|
|
1002
|
+
endColumn: maxCol
|
|
1003
|
+
} : this.highlightCells(minRowIndex, maxRowIndex, minColIndex, maxColIndex, eleArray);
|
|
1004
|
+
}
|
|
1005
|
+
return minMaxValues;
|
|
1006
|
+
};
|
|
1007
|
+
TableCommand.prototype.restoreRange = function (target) {
|
|
1008
|
+
if (this.parent.userAgentData.isSafari()) {
|
|
1009
|
+
this.parent.nodeSelection.Clear(this.parent.currentDocument);
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
if (this.parent.currentDocument.getSelection().rangeCount && (target.nodeName === 'TD' || target.nodeName === 'TH')) {
|
|
1013
|
+
this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, target, 0);
|
|
1014
|
+
}
|
|
1015
|
+
};
|
|
1016
|
+
TableCommand.prototype.tableStyle = function (e) {
|
|
1017
|
+
if (e.callBack) {
|
|
1018
|
+
e.callBack({
|
|
1019
|
+
requestType: e.item.subCommand,
|
|
1020
|
+
editorMode: 'HTML',
|
|
1021
|
+
event: e.event,
|
|
1022
|
+
range: this.parent.nodeSelection.getRange(this.parent.currentDocument),
|
|
1023
|
+
elements: this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)
|
|
1024
|
+
});
|
|
1025
|
+
}
|
|
1026
|
+
};
|
|
1027
|
+
TableCommand.prototype.tableMove = function (e) {
|
|
1028
|
+
this.activeCell = e.selectNode[0];
|
|
1029
|
+
var target = e.event.target;
|
|
1030
|
+
var activeCellTag = this.activeCell.tagName;
|
|
1031
|
+
var targetCellTag = target.tagName;
|
|
1032
|
+
this.curTable = ej2_base_1.closest(target, 'table');
|
|
1033
|
+
if ((target.tagName !== 'TD' && target.tagName !== 'TH') && activeCellTag !== targetCellTag) {
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
var activeCellTable = ej2_base_1.closest(this.activeCell, 'table');
|
|
1037
|
+
if ((ej2_base_1.isNullOrUndefined(this.curTable) || ej2_base_1.isNullOrUndefined(activeCellTable)) || activeCellTable !== this.curTable) {
|
|
1038
|
+
return;
|
|
1039
|
+
}
|
|
1040
|
+
var correspondingCells = this.getCorrespondingColumns();
|
|
1041
|
+
var activeIndexes = this.getCorrespondingIndex(this.activeCell, correspondingCells);
|
|
1042
|
+
var targetIndexes = this.getCorrespondingIndex(target, correspondingCells);
|
|
1043
|
+
var activeCellList = this.curTable.querySelectorAll('.e-cell-select, .e-multi-cells-select, .e-cell-select-end');
|
|
1044
|
+
for (var i = activeCellList.length - 1; i >= 0; i--) {
|
|
1045
|
+
if (this.activeCell !== activeCellList[i]) {
|
|
1046
|
+
util_1.removeClassWithAttr([activeCellList[i]], ['e-cell-select']);
|
|
1047
|
+
}
|
|
1048
|
+
util_1.removeClassWithAttr([activeCellList[i]], ['e-multi-cells-select']);
|
|
1049
|
+
util_1.removeClassWithAttr([activeCellList[i]], ['e-cell-select-end']);
|
|
1050
|
+
}
|
|
1051
|
+
if (activeIndexes[0] === targetIndexes[0] && activeIndexes[1] === targetIndexes[1]) {
|
|
1052
|
+
if (activeCellList.length > 1) {
|
|
1053
|
+
this.restoreRange(target);
|
|
1054
|
+
}
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
var minMaxIndexes = this.highlightCells(Math.min(activeIndexes[0], targetIndexes[0]), Math.max(activeIndexes[0], targetIndexes[0]), Math.min(activeIndexes[1], targetIndexes[1]), Math.max(activeIndexes[1], targetIndexes[1]), correspondingCells);
|
|
1058
|
+
for (var rowIndex = minMaxIndexes.startRow; rowIndex <= minMaxIndexes.endRow; rowIndex++) {
|
|
1059
|
+
for (var colIndex = minMaxIndexes.startColumn; colIndex <= minMaxIndexes.endColumn; colIndex++) {
|
|
1060
|
+
correspondingCells[rowIndex][colIndex].classList.add('e-cell-select');
|
|
1061
|
+
correspondingCells[rowIndex][colIndex].classList.add('e-multi-cells-select');
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
target.classList.add('e-cell-select-end');
|
|
1065
|
+
if (e.event.type) {
|
|
1066
|
+
e.event.preventDefault();
|
|
1067
|
+
}
|
|
1068
|
+
this.restoreRange(target);
|
|
1069
|
+
};
|
|
1070
|
+
TableCommand.prototype.destroy = function () {
|
|
1071
|
+
this.removeEventListener();
|
|
1072
|
+
};
|
|
1073
|
+
TableCommand.prototype.cellStyleCleanup = function (value) {
|
|
1074
|
+
var styles = value.split(';');
|
|
1075
|
+
var newStyles = [];
|
|
1076
|
+
var deniedFormats = ['background-color', 'vertical-align', 'text-align'];
|
|
1077
|
+
for (var i = 0; i < styles.length; i++) {
|
|
1078
|
+
var style = styles[i];
|
|
1079
|
+
var isAllowed = true;
|
|
1080
|
+
for (var j = 0; j < deniedFormats.length; j++) {
|
|
1081
|
+
var deniedStyle = deniedFormats[j];
|
|
1082
|
+
if (style.indexOf(deniedStyle) > -1) {
|
|
1083
|
+
isAllowed = false;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
if (isAllowed) {
|
|
1087
|
+
newStyles.push(style);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
return newStyles.join(';');
|
|
1091
|
+
};
|
|
1092
|
+
return TableCommand;
|
|
1093
|
+
}());
|
|
1094
|
+
exports.TableCommand = TableCommand;
|
|
1095
|
+
var MinMax = (function () {
|
|
1096
|
+
function MinMax() {
|
|
1097
|
+
}
|
|
1098
|
+
return MinMax;
|
|
1099
|
+
}());
|
|
1100
|
+
});
|