@worktile/theia 3.0.8 → 3.0.9
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/README.md +11 -11
- package/bundles/worktile-theia.umd.js +14357 -14343
- package/bundles/worktile-theia.umd.js.map +1 -1
- package/components/color-select/color-select.component.d.ts +32 -32
- package/components/color-select/color-select.component.scss +107 -107
- package/components/column-resize/column-resize-notifier.d.ts +35 -35
- package/components/column-resize/column-resize.directive.d.ts +26 -26
- package/components/column-resize/column-resize.module.d.ts +14 -14
- package/components/column-resize/event-dispatcher.d.ts +31 -31
- package/components/column-resize/overlay-handle.component.d.ts +33 -33
- package/components/column-resize/resize-ref.d.ts +25 -25
- package/components/column-resize/resizing.store.d.ts +28 -28
- package/components/column-resize/selectors.d.ts +3 -3
- package/components/contextmenu/contextmenu.component.d.ts +22 -22
- package/components/conversion-hint/conversion-hint.component.d.ts +18 -18
- package/components/conversion-hint/conversion-hint.component.scss +11 -11
- package/components/element/element.component.d.ts +7 -7
- package/components/inline-toolbar/inline-toolbar.component.d.ts +26 -26
- package/components/nav-split-line/nav-split-line.component.d.ts +13 -13
- package/components/table-select/table-select.component.d.ts +20 -20
- package/components/table-select/table-select.component.scss +35 -35
- package/components/template/template.component.d.ts +15 -15
- package/components/text/text.component.d.ts +14 -14
- package/components/toolbar/toolbar.component.d.ts +65 -65
- package/components/toolbar-dropdown/toolbar-dropdown.component.d.ts +33 -33
- package/components/toolbar-dropdown/toolbar-dropdown.component.scss +0 -1
- package/components/toolbar-group/toolbar-group.component.d.ts +33 -33
- package/components/toolbar-group/toolbar-group.component.scss +17 -17
- package/components/toolbar-item/toolbar-item.component.d.ts +18 -18
- package/constants/auto-format-rules.d.ts +2 -2
- package/constants/code.d.ts +9 -9
- package/constants/color-select.d.ts +14 -14
- package/constants/default.d.ts +9 -9
- package/constants/error.d.ts +5 -5
- package/constants/index.d.ts +5 -5
- package/constants/node-types.d.ts +99 -99
- package/constants/selector.d.ts +2 -2
- package/constants/toolbar.d.ts +17 -17
- package/core/create-plugin.d.ts +2 -2
- package/core/create-toolbar.d.ts +5 -5
- package/core/index.d.ts +4 -4
- package/core/toolbar-item/base-toolbar-item.d.ts +29 -29
- package/core/utils/combine-plugins.d.ts +2 -2
- package/core/utils/flatten-deep-plugins.d.ts +6 -6
- package/core/utils/get-plugin-options.d.ts +2 -2
- package/core/utils/get-plugin.d.ts +2 -2
- package/core/utils/get-plugins.d.ts +2 -2
- package/core/utils/index.d.ts +10 -10
- package/core/utils/merge-array.d.ts +1 -1
- package/core/utils/merge-deep-plugins.d.ts +2 -2
- package/core/utils/merge-options.d.ts +2 -2
- package/core/utils/nested-structure-by-key.d.ts +2 -2
- package/core/utils/plugins-by-key.d.ts +2 -2
- package/core/with-theia.d.ts +4 -4
- package/custom-types.d.ts +131 -131
- package/editor.component.d.ts +92 -92
- package/editor.module.d.ts +98 -98
- package/esm2015/components/color-select/color-select.component.js +112 -112
- package/esm2015/components/column-resize/column-resize-notifier.js +31 -31
- package/esm2015/components/column-resize/column-resize.directive.js +98 -98
- package/esm2015/components/column-resize/column-resize.module.js +34 -34
- package/esm2015/components/column-resize/event-dispatcher.js +55 -55
- package/esm2015/components/column-resize/overlay-handle.component.js +139 -139
- package/esm2015/components/column-resize/resize-ref.js +25 -25
- package/esm2015/components/column-resize/resizing.store.js +154 -154
- package/esm2015/components/column-resize/selectors.js +4 -4
- package/esm2015/components/contextmenu/contextmenu.component.js +64 -64
- package/esm2015/components/conversion-hint/conversion-hint.component.js +59 -59
- package/esm2015/components/element/element.component.js +23 -23
- package/esm2015/components/inline-toolbar/inline-toolbar.component.js +126 -126
- package/esm2015/components/nav-split-line/nav-split-line.component.js +36 -36
- package/esm2015/components/table-select/table-select.component.js +53 -53
- package/esm2015/components/template/template.component.js +66 -66
- package/esm2015/components/text/text.component.js +57 -57
- package/esm2015/components/toolbar/toolbar.component.js +250 -250
- package/esm2015/components/toolbar-dropdown/toolbar-dropdown.component.js +132 -132
- package/esm2015/components/toolbar-group/toolbar-group.component.js +116 -116
- package/esm2015/components/toolbar-item/toolbar-item.component.js +64 -64
- package/esm2015/constants/auto-format-rules.js +166 -166
- package/esm2015/constants/code.js +88 -88
- package/esm2015/constants/color-select.js +61 -61
- package/esm2015/constants/default.js +9 -9
- package/esm2015/constants/error.js +7 -7
- package/esm2015/constants/index.js +5 -5
- package/esm2015/constants/node-types.js +132 -132
- package/esm2015/constants/selector.js +3 -3
- package/esm2015/constants/toolbar.js +69 -69
- package/esm2015/core/create-plugin.js +4 -4
- package/esm2015/core/create-toolbar.js +56 -56
- package/esm2015/core/index.js +4 -4
- package/esm2015/core/toolbar-item/base-toolbar-item.js +91 -91
- package/esm2015/core/utils/combine-plugins.js +9 -9
- package/esm2015/core/utils/flatten-deep-plugins.js +18 -18
- package/esm2015/core/utils/get-plugin-options.js +2 -2
- package/esm2015/core/utils/get-plugin.js +1 -1
- package/esm2015/core/utils/get-plugins.js +4 -4
- package/esm2015/core/utils/index.js +10 -10
- package/esm2015/core/utils/merge-array.js +17 -17
- package/esm2015/core/utils/merge-deep-plugins.js +13 -13
- package/esm2015/core/utils/merge-options.js +19 -19
- package/esm2015/core/utils/nested-structure-by-key.js +10 -10
- package/esm2015/core/utils/plugins-by-key.js +9 -9
- package/esm2015/core/with-theia.js +22 -22
- package/esm2015/custom-types.js +1 -1
- package/esm2015/editor.component.js +439 -439
- package/esm2015/editor.module.js +201 -201
- package/esm2015/interfaces/auto-format.js +1 -1
- package/esm2015/interfaces/editor.js +22 -22
- package/esm2015/interfaces/element.js +1 -1
- package/esm2015/interfaces/image.js +2 -2
- package/esm2015/interfaces/index.js +8 -8
- package/esm2015/interfaces/plugins/index.js +4 -4
- package/esm2015/interfaces/plugins/no-infer.js +1 -1
- package/esm2015/interfaces/plugins/plugin-key.js +39 -39
- package/esm2015/interfaces/plugins/plugins.js +1 -1
- package/esm2015/interfaces/plugins/with-override.js +1 -1
- package/esm2015/interfaces/reset-block-type-plugin-options.js +2 -2
- package/esm2015/interfaces/toolbar.js +11 -11
- package/esm2015/interfaces/upload.js +2 -2
- package/esm2015/interfaces/utility/index.js +3 -3
- package/esm2015/interfaces/utility/nested-structure-by-key.js +1 -1
- package/esm2015/interfaces/utility/override-by-key.js +1 -1
- package/esm2015/interfaces/utility/types.js +1 -1
- package/esm2015/interfaces/valid-children-types.js +35 -35
- package/esm2015/interfaces/view-base.js +21 -21
- package/esm2015/pipes.js +42 -42
- package/esm2015/plugins/align/align.editor.js +47 -47
- package/esm2015/plugins/align/align.plugin.js +63 -63
- package/esm2015/plugins/autoformat/autoformat.plugin.js +109 -109
- package/esm2015/plugins/autoformat/transforms/auto-format-block.js +14 -14
- package/esm2015/plugins/autoformat/transforms/auto-format-inline.js +77 -77
- package/esm2015/plugins/blockquote/blockquote.component.js +21 -21
- package/esm2015/plugins/blockquote/blockquote.editor.js +20 -20
- package/esm2015/plugins/blockquote/blockquote.plugin.js +70 -70
- package/esm2015/plugins/code/code.component.js +244 -244
- package/esm2015/plugins/code/code.editor.js +47 -47
- package/esm2015/plugins/code/code.plugin.js +41 -41
- package/esm2015/plugins/color/color.editor.js +44 -44
- package/esm2015/plugins/color/color.plugin.js +27 -27
- package/esm2015/plugins/color/toolbar-item.component.js +79 -79
- package/esm2015/plugins/common/auto-insert-data..js +77 -77
- package/esm2015/plugins/common/block-card.plugin.js +286 -286
- package/esm2015/plugins/common/get-fragment.plugin.js +24 -24
- package/esm2015/plugins/common/history.plugin.js +30 -30
- package/esm2015/plugins/common/move-selection.plugin.js +89 -89
- package/esm2015/plugins/common/remove-empty.plugin.js +59 -59
- package/esm2015/plugins/common/remove-void.plugin.js +56 -56
- package/esm2015/plugins/common/reset-type.plugin.js +34 -34
- package/esm2015/plugins/common/transforms.plugin.js +17 -17
- package/esm2015/plugins/deserializers/deserialize-html.plugin.js +38 -38
- package/esm2015/plugins/deserializers/deserialize-md.plugin.js +121 -121
- package/esm2015/plugins/font-size/font-size.editor.js +97 -97
- package/esm2015/plugins/heading/heading.editor.js +53 -53
- package/esm2015/plugins/heading/heading.plugin.js +84 -84
- package/esm2015/plugins/hr/hr.component.js +40 -40
- package/esm2015/plugins/hr/hr.editor.js +7 -7
- package/esm2015/plugins/hr/hr.plugin.js +41 -41
- package/esm2015/plugins/image/image.component.js +369 -369
- package/esm2015/plugins/image/image.editor.js +57 -57
- package/esm2015/plugins/image/image.plugin.js +57 -57
- package/esm2015/plugins/indent/indent.editor.js +72 -72
- package/esm2015/plugins/indent/indent.plugin.js +59 -59
- package/esm2015/plugins/indent/on-keydown-indent.js +53 -53
- package/esm2015/plugins/index.js +70 -70
- package/esm2015/plugins/inline-code/inline-code.component.js +21 -21
- package/esm2015/plugins/inline-code/inline-code.editor.js +48 -48
- package/esm2015/plugins/inline-code/inline-code.plugin.js +65 -65
- package/esm2015/plugins/link/edit/link-edit.component.js +108 -108
- package/esm2015/plugins/link/hover/link-hover.component.js +39 -39
- package/esm2015/plugins/link/link.component.js +162 -162
- package/esm2015/plugins/link/link.editor.js +66 -66
- package/esm2015/plugins/link/link.plugin.js +58 -58
- package/esm2015/plugins/link/link.types.js +12 -12
- package/esm2015/plugins/list/components/bulleted-list.component.js +33 -33
- package/esm2015/plugins/list/components/list-item.component.js +94 -94
- package/esm2015/plugins/list/components/numbered-list.component.js +39 -39
- package/esm2015/plugins/list/list.editor.js +125 -125
- package/esm2015/plugins/list/list.plugin.js +280 -280
- package/esm2015/plugins/list/normalizers/get-list-normalizer.js +39 -39
- package/esm2015/plugins/list/normalizers/normalize-list-item.js +19 -19
- package/esm2015/plugins/list/normalizers/normalize-no.js +42 -42
- package/esm2015/plugins/list/on-key-down-list.js +32 -32
- package/esm2015/plugins/list/queries/get-list-item-entry.js +27 -27
- package/esm2015/plugins/list/queries/get-list-item-sublist.js +12 -12
- package/esm2015/plugins/list/queries/get-list-types.js +5 -5
- package/esm2015/plugins/list/queries/get-start-list-item.js +26 -26
- package/esm2015/plugins/list/queries/has-list-in-list-item.js +27 -27
- package/esm2015/plugins/list/queries/is-in-list.js +5 -5
- package/esm2015/plugins/list/queries/is-list-nested.js +10 -10
- package/esm2015/plugins/list/queries/is-list.js +5 -5
- package/esm2015/plugins/list/queries/is-node-type-list.js +4 -4
- package/esm2015/plugins/list/queries/is-selection-at-list-item-start.js +12 -12
- package/esm2015/plugins/list/queries/is-selection-in-same-list-item.js +16 -16
- package/esm2015/plugins/list/queries/is-single-list-item.js +9 -9
- package/esm2015/plugins/list/transforms/insert-list-data.js +71 -71
- package/esm2015/plugins/list/transforms/insert-list-item.js +72 -72
- package/esm2015/plugins/list/transforms/move-list-item-down.js +41 -41
- package/esm2015/plugins/list/transforms/move-list-item-sublist-items-to-list-item-sublist.js +42 -42
- package/esm2015/plugins/list/transforms/move-list-item-sublist-items-to-list.js +29 -29
- package/esm2015/plugins/list/transforms/move-list-item-up.js +77 -77
- package/esm2015/plugins/list/transforms/unwrap-list.js +9 -9
- package/esm2015/plugins/list/types.js +2 -2
- package/esm2015/plugins/mark/mark.editor.js +28 -28
- package/esm2015/plugins/mark/mark.plugin.js +101 -101
- package/esm2015/plugins/node-id/node-id.plugin.js +68 -68
- package/esm2015/plugins/normalizers/insert-paragraph-nodes.js +28 -28
- package/esm2015/plugins/normalizers/remove-empty-nodes.js +17 -17
- package/esm2015/plugins/normalizers/trailing-node.plugin.js +33 -33
- package/esm2015/plugins/paint-format/paint-format.editor.js +122 -122
- package/esm2015/plugins/public-api.js +15 -15
- package/esm2015/plugins/quick-insert/components/quick-insert.component.js +101 -101
- package/esm2015/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.js +83 -83
- package/esm2015/plugins/quick-insert/quick-insert.editor.js +52 -52
- package/esm2015/plugins/quick-insert/quick-insert.plugin.js +74 -74
- package/esm2015/plugins/soft-break/soft-break.plugin.js +36 -36
- package/esm2015/plugins/soft-break/soft-break.types.js +1 -1
- package/esm2015/plugins/table/components/insert-mark/insert-mark.component.js +102 -102
- package/esm2015/plugins/table/components/row/row.component.js +46 -46
- package/esm2015/plugins/table/components/table.component.js +469 -469
- package/esm2015/plugins/table/components/td/td.component.js +698 -698
- package/esm2015/plugins/table/components/toolbar/table-options.component.js +67 -67
- package/esm2015/plugins/table/components/toolbar/table-toolbar.component.js +161 -161
- package/esm2015/plugins/table/table.editor.js +182 -182
- package/esm2015/plugins/table/table.plugin.js +423 -423
- package/esm2015/plugins/table/table.service.js +102 -102
- package/esm2015/plugins/table/table.store.js +479 -479
- package/esm2015/plugins/table/table.types.js +33 -33
- package/esm2015/plugins/table/toolbar-item.component.js +61 -61
- package/esm2015/plugins/table/transforms/clear-cell.js +11 -11
- package/esm2015/plugins/table/transforms/clear-table-node.js +27 -27
- package/esm2015/plugins/table/transforms/insert-column.js +57 -57
- package/esm2015/plugins/table/transforms/insert-row.js +42 -42
- package/esm2015/plugins/table/transforms/insert-table.js +14 -14
- package/esm2015/plugins/table/transforms/remove-column.js +51 -51
- package/esm2015/plugins/table/transforms/remove-row.js +50 -50
- package/esm2015/plugins/table/transforms/remove-table.js +49 -49
- package/esm2015/plugins/table/utils/add-columns.js +28 -28
- package/esm2015/plugins/table/utils/calc-anchor-position.js +24 -24
- package/esm2015/plugins/table/utils/calc-span.js +72 -72
- package/esm2015/plugins/table/utils/create-cell.js +19 -19
- package/esm2015/plugins/table/utils/create-row.js +12 -12
- package/esm2015/plugins/table/utils/create-table.js +13 -13
- package/esm2015/plugins/table/utils/get-base-height.js +22 -22
- package/esm2015/plugins/table/utils/get-select-cell-node.js +16 -16
- package/esm2015/plugins/table/utils/index.js +8 -8
- package/esm2015/plugins/table/utils/is-range-in-table.js +16 -16
- package/esm2015/plugins/table/utils/is-selection-in-table.js +11 -11
- package/esm2015/plugins/table/utils/is-virtual-key.js +13 -13
- package/esm2015/plugins/table/utils/merge-cell.js +90 -90
- package/esm2015/plugins/table/utils/next-path.js +5 -5
- package/esm2015/plugins/table/utils/normalize-table.js +30 -30
- package/esm2015/plugins/table/utils/remove-columns.js +23 -23
- package/esm2015/plugins/table/utils/set-menu-cell-invisibility.js +15 -15
- package/esm2015/plugins/table/utils/split-cell.js +31 -31
- package/esm2015/plugins/table/utils/table-position.js +242 -242
- package/esm2015/plugins/todo-item/todo-item.component.js +55 -55
- package/esm2015/plugins/todo-item/todo-item.editor.js +31 -31
- package/esm2015/plugins/todo-item/todo-item.plugin.js +78 -78
- package/esm2015/plugins/vertical-align/toolbar-item.component.js +89 -89
- package/esm2015/plugins/vertical-align/vertical-align.editor.js +54 -54
- package/esm2015/public-api.js +23 -23
- package/esm2015/queries/anchor-block-entry.js +13 -13
- package/esm2015/queries/anchor-block.js +6 -6
- package/esm2015/queries/anchor-inline-entry.js +10 -10
- package/esm2015/queries/find-descendant.js +47 -47
- package/esm2015/queries/find-node.js +45 -45
- package/esm2015/queries/find-path.js +28 -28
- package/esm2015/queries/get-above-by-type.js +10 -10
- package/esm2015/queries/get-above.js +9 -9
- package/esm2015/queries/get-anchor-block-entry.js +8 -8
- package/esm2015/queries/get-block-above.js +7 -7
- package/esm2015/queries/get-block-card-above.js +7 -7
- package/esm2015/queries/get-block-card-cursor.js +5 -5
- package/esm2015/queries/get-container-blocks.js +11 -11
- package/esm2015/queries/get-directly-parent.js +11 -11
- package/esm2015/queries/get-insert-elements-path.js +43 -43
- package/esm2015/queries/get-last-child-path.js +9 -9
- package/esm2015/queries/get-last-node.js +17 -17
- package/esm2015/queries/get-next-sibling-nodes.js +17 -17
- package/esm2015/queries/get-node.js +10 -10
- package/esm2015/queries/get-nodes-by-type.js +12 -12
- package/esm2015/queries/get-nodes.js +7 -7
- package/esm2015/queries/get-parent.js +12 -12
- package/esm2015/queries/get-plain-text.js +16 -16
- package/esm2015/queries/get-plugin-by-toolbar.js +12 -12
- package/esm2015/queries/get-point-before.js +62 -62
- package/esm2015/queries/get-point-from-location.js +15 -15
- package/esm2015/queries/get-previous-path.js +9 -9
- package/esm2015/queries/get-rang-from-block-start.js +16 -16
- package/esm2015/queries/get-range-before.js +17 -17
- package/esm2015/queries/get-selection-marks.js +19 -19
- package/esm2015/queries/get-selection-nodes-by-type.js +29 -29
- package/esm2015/queries/get-text.js +9 -9
- package/esm2015/queries/get-toolbar-disabled.js +13 -13
- package/esm2015/queries/index.js +59 -58
- package/esm2015/queries/is-across-blocks.js +7 -7
- package/esm2015/queries/is-ancestor-empty.js +6 -6
- package/esm2015/queries/is-ancestor.js +3 -3
- package/esm2015/queries/is-block-above-empty.js +11 -11
- package/esm2015/queries/is-block-active.js +7 -7
- package/esm2015/queries/is-block-card-cursor.js +4 -4
- package/esm2015/queries/is-block-text-empty-after-selection.js +31 -31
- package/esm2015/queries/is-collapsed.js +7 -7
- package/esm2015/queries/is-contain-nested-type.js +28 -28
- package/esm2015/queries/is-container-type.js +2 -2
- package/esm2015/queries/is-descendant.js +3 -3
- package/esm2015/queries/is-empty-content.js +15 -0
- package/esm2015/queries/is-empty-paragraph-by-path.js +7 -7
- package/esm2015/queries/is-empty-paragraph.js +11 -11
- package/esm2015/queries/is-first-child.js +5 -5
- package/esm2015/queries/is-include-types.js +11 -11
- package/esm2015/queries/is-node-type-in.js +9 -9
- package/esm2015/queries/is-node-type.js +15 -15
- package/esm2015/queries/is-paragraph.js +9 -9
- package/esm2015/queries/is-point-at-root.js +2 -2
- package/esm2015/queries/is-range-across-blocks.js +18 -18
- package/esm2015/queries/is-range-at-root.js +3 -3
- package/esm2015/queries/is-start.js +6 -6
- package/esm2015/queries/some-node.js +9 -9
- package/esm2015/services/color-select.service.js +49 -49
- package/esm2015/services/context.service.js +59 -59
- package/esm2015/services/table-contextmenu.service.js +189 -189
- package/esm2015/services/toolbar.service.js +47 -47
- package/esm2015/shortcuts/index.js +5 -5
- package/esm2015/shortcuts/mark.js +24 -24
- package/esm2015/transforms/apply-deep-to-nodes.js +21 -21
- package/esm2015/transforms/clear-marks.js +23 -23
- package/esm2015/transforms/close-conversion-hint.js +8 -8
- package/esm2015/transforms/delete-element.js +11 -11
- package/esm2015/transforms/handle-continual-delete-backward.js +17 -17
- package/esm2015/transforms/handle-continual-insert-break.js +19 -19
- package/esm2015/transforms/index.js +18 -18
- package/esm2015/transforms/insert-elements.js +34 -34
- package/esm2015/transforms/insert-paragraph.js +6 -6
- package/esm2015/transforms/merge-deep-to-nodes.js +8 -8
- package/esm2015/transforms/move-children.js +21 -21
- package/esm2015/transforms/on-keydown-reset-block-type.js +22 -22
- package/esm2015/transforms/set-end-selection.js +10 -10
- package/esm2015/transforms/set-marks.js +9 -9
- package/esm2015/transforms/set-node.js +5 -5
- package/esm2015/transforms/split-node.js +31 -31
- package/esm2015/transforms/un-hang-range.js +11 -11
- package/esm2015/transforms/un-wrap.js +11 -11
- package/esm2015/transforms/unwrap-nodes-by-type.js +11 -11
- package/esm2015/utils/auto-focus.js +13 -13
- package/esm2015/utils/auto-scroll-view.js +24 -24
- package/esm2015/utils/cast-array.js +7 -7
- package/esm2015/utils/common.js +2 -2
- package/esm2015/utils/create-empty-paragraph.js +14 -14
- package/esm2015/utils/data-transform.js +48 -48
- package/esm2015/utils/dom.js +46 -46
- package/esm2015/utils/editor-uuid.js +8 -8
- package/esm2015/utils/fragment.js +65 -65
- package/esm2015/utils/get-editable-element-height.js +6 -6
- package/esm2015/utils/get-toolbar-class.js +6 -6
- package/esm2015/utils/id-creator.js +11 -11
- package/esm2015/utils/index.js +13 -13
- package/esm2015/utils/is-clean-empty-paragraph.js +36 -36
- package/esm2015/utils/is-inline.js +9 -9
- package/esm2015/utils/lodash.js +3 -3
- package/esm2015/utils/match.js +29 -29
- package/esm2015/utils/merge-element-options.js +19 -19
- package/esm2015/utils/weak-maps.js +3 -3
- package/esm2015/worktile-theia.js +4 -4
- package/fesm2015/worktile-theia.js +13156 -13142
- package/fesm2015/worktile-theia.js.map +1 -1
- package/interfaces/auto-format.d.ts +64 -64
- package/interfaces/editor.d.ts +146 -146
- package/interfaces/element.d.ts +9 -9
- package/interfaces/image.d.ts +25 -25
- package/interfaces/index.d.ts +8 -8
- package/interfaces/plugins/index.d.ts +4 -4
- package/interfaces/plugins/no-infer.d.ts +1 -1
- package/interfaces/plugins/plugin-key.d.ts +48 -48
- package/interfaces/plugins/plugins.d.ts +45 -45
- package/interfaces/plugins/with-override.d.ts +7 -7
- package/interfaces/reset-block-type-plugin-options.d.ts +23 -23
- package/interfaces/toolbar.d.ts +64 -64
- package/interfaces/upload.d.ts +11 -11
- package/interfaces/utility/index.d.ts +3 -3
- package/interfaces/utility/nested-structure-by-key.d.ts +3 -3
- package/interfaces/utility/override-by-key.d.ts +3 -3
- package/interfaces/utility/types.d.ts +1 -1
- package/interfaces/valid-children-types.d.ts +9 -9
- package/interfaces/view-base.d.ts +9 -9
- package/package.json +1 -1
- package/pipes.d.ts +16 -16
- package/plugins/align/align.editor.d.ts +7 -7
- package/plugins/align/align.plugin.d.ts +2 -2
- package/plugins/autoformat/autoformat.plugin.d.ts +6 -6
- package/plugins/autoformat/transforms/auto-format-block.d.ts +5 -5
- package/plugins/autoformat/transforms/auto-format-inline.d.ts +9 -9
- package/plugins/blockquote/blockquote.component.d.ts +11 -11
- package/plugins/blockquote/blockquote.editor.d.ts +4 -4
- package/plugins/blockquote/blockquote.plugin.d.ts +2 -2
- package/plugins/code/code.component.d.ts +65 -65
- package/plugins/code/code.editor.d.ts +8 -8
- package/plugins/code/code.plugin.d.ts +2 -2
- package/plugins/color/color.editor.d.ts +8 -8
- package/plugins/color/color.plugin.d.ts +1 -1
- package/plugins/color/toolbar-item.component.d.ts +16 -16
- package/plugins/common/auto-insert-data..d.ts +2 -2
- package/plugins/common/block-card.plugin.d.ts +2 -2
- package/plugins/common/get-fragment.plugin.d.ts +6 -6
- package/plugins/common/history.plugin.d.ts +9 -9
- package/plugins/common/move-selection.plugin.d.ts +2 -2
- package/plugins/common/remove-empty.plugin.d.ts +2 -2
- package/plugins/common/remove-void.plugin.d.ts +2 -2
- package/plugins/common/reset-type.plugin.d.ts +2 -2
- package/plugins/common/transforms.plugin.d.ts +8 -8
- package/plugins/deserializers/deserialize-html.plugin.d.ts +2 -2
- package/plugins/deserializers/deserialize-md.plugin.d.ts +2 -2
- package/plugins/font-size/font-size.editor.d.ts +10 -10
- package/plugins/heading/heading.editor.d.ts +9 -9
- package/plugins/heading/heading.plugin.d.ts +7 -7
- package/plugins/hr/hr.component.d.ts +12 -12
- package/plugins/hr/hr.editor.d.ts +4 -4
- package/plugins/hr/hr.plugin.d.ts +2 -2
- package/plugins/image/image.component.d.ts +74 -74
- package/plugins/image/image.editor.d.ts +12 -12
- package/plugins/image/image.plugin.d.ts +7 -7
- package/plugins/indent/indent.editor.d.ts +10 -10
- package/plugins/indent/indent.plugin.d.ts +8 -8
- package/plugins/indent/on-keydown-indent.d.ts +3 -3
- package/plugins/index.d.ts +1 -1
- package/plugins/inline-code/inline-code.component.d.ts +9 -9
- package/plugins/inline-code/inline-code.editor.d.ts +7 -7
- package/plugins/inline-code/inline-code.plugin.d.ts +2 -2
- package/plugins/link/edit/link-edit.component.d.ts +36 -36
- package/plugins/link/hover/link-hover.component.d.ts +15 -15
- package/plugins/link/link.component.d.ts +39 -39
- package/plugins/link/link.editor.d.ts +7 -7
- package/plugins/link/link.plugin.d.ts +2 -2
- package/plugins/link/link.types.d.ts +9 -9
- package/plugins/list/components/bulleted-list.component.d.ts +15 -15
- package/plugins/list/components/list-item.component.d.ts +20 -20
- package/plugins/list/components/numbered-list.component.d.ts +16 -16
- package/plugins/list/list.editor.d.ts +12 -12
- package/plugins/list/list.plugin.d.ts +3 -3
- package/plugins/list/normalizers/get-list-normalizer.d.ts +6 -6
- package/plugins/list/normalizers/normalize-list-item.d.ts +5 -5
- package/plugins/list/normalizers/normalize-no.d.ts +2 -2
- package/plugins/list/on-key-down-list.d.ts +2 -2
- package/plugins/list/queries/get-list-item-entry.d.ts +10 -10
- package/plugins/list/queries/get-list-item-sublist.d.ts +6 -6
- package/plugins/list/queries/get-list-types.d.ts +2 -2
- package/plugins/list/queries/get-start-list-item.d.ts +8 -8
- package/plugins/list/queries/has-list-in-list-item.d.ts +15 -15
- package/plugins/list/queries/is-in-list.d.ts +2 -2
- package/plugins/list/queries/is-list-nested.d.ts +5 -5
- package/plugins/list/queries/is-list.d.ts +2 -2
- package/plugins/list/queries/is-node-type-list.d.ts +2 -2
- package/plugins/list/queries/is-selection-at-list-item-start.d.ts +5 -5
- package/plugins/list/queries/is-selection-in-same-list-item.d.ts +5 -5
- package/plugins/list/queries/is-single-list-item.d.ts +5 -5
- package/plugins/list/transforms/insert-list-data.d.ts +12 -12
- package/plugins/list/transforms/insert-list-item.d.ts +5 -5
- package/plugins/list/transforms/move-list-item-down.d.ts +6 -6
- package/plugins/list/transforms/move-list-item-sublist-items-to-list-item-sublist.d.ts +20 -20
- package/plugins/list/transforms/move-list-item-sublist-items-to-list.d.ts +19 -19
- package/plugins/list/transforms/move-list-item-up.d.ts +10 -10
- package/plugins/list/transforms/unwrap-list.d.ts +2 -2
- package/plugins/list/types.d.ts +7 -7
- package/plugins/mark/mark.editor.d.ts +8 -8
- package/plugins/mark/mark.plugin.d.ts +3 -3
- package/plugins/node-id/node-id.plugin.d.ts +8 -8
- package/plugins/normalizers/insert-paragraph-nodes.d.ts +7 -7
- package/plugins/normalizers/remove-empty-nodes.d.ts +7 -7
- package/plugins/normalizers/trailing-node.plugin.d.ts +9 -9
- package/plugins/paint-format/paint-format.editor.d.ts +8 -8
- package/plugins/public-api.d.ts +15 -15
- package/plugins/quick-insert/components/quick-insert.component.d.ts +28 -28
- package/plugins/quick-insert/components/quick-toolbar/quick-toolbar.component.d.ts +28 -28
- package/plugins/quick-insert/quick-insert.editor.d.ts +7 -7
- package/plugins/quick-insert/quick-insert.plugin.d.ts +10 -10
- package/plugins/soft-break/soft-break.plugin.d.ts +5 -5
- package/plugins/soft-break/soft-break.types.d.ts +8 -8
- package/plugins/table/components/insert-mark/insert-mark.component.d.ts +24 -24
- package/plugins/table/components/row/row.component.d.ts +14 -14
- package/plugins/table/components/table.component.d.ts +79 -79
- package/plugins/table/components/td/td.component.d.ts +95 -95
- package/plugins/table/components/toolbar/table-options.component.d.ts +20 -20
- package/plugins/table/components/toolbar/table-toolbar.component.d.ts +38 -38
- package/plugins/table/table.editor.d.ts +25 -25
- package/plugins/table/table.plugin.d.ts +3 -3
- package/plugins/table/table.service.d.ts +30 -30
- package/plugins/table/table.store.d.ts +71 -71
- package/plugins/table/table.types.d.ts +67 -67
- package/plugins/table/toolbar-item.component.d.ts +17 -17
- package/plugins/table/transforms/clear-cell.d.ts +6 -6
- package/plugins/table/transforms/clear-table-node.d.ts +6 -6
- package/plugins/table/transforms/insert-column.d.ts +12 -12
- package/plugins/table/transforms/insert-row.d.ts +6 -6
- package/plugins/table/transforms/insert-table.d.ts +6 -6
- package/plugins/table/transforms/remove-column.d.ts +3 -3
- package/plugins/table/transforms/remove-row.d.ts +3 -3
- package/plugins/table/transforms/remove-table.d.ts +3 -3
- package/plugins/table/utils/add-columns.d.ts +2 -2
- package/plugins/table/utils/calc-anchor-position.d.ts +6 -6
- package/plugins/table/utils/calc-span.d.ts +11 -11
- package/plugins/table/utils/create-cell.d.ts +16 -16
- package/plugins/table/utils/create-row.d.ts +7 -7
- package/plugins/table/utils/create-table.d.ts +7 -7
- package/plugins/table/utils/get-base-height.d.ts +9 -9
- package/plugins/table/utils/get-select-cell-node.d.ts +7 -7
- package/plugins/table/utils/index.d.ts +7 -7
- package/plugins/table/utils/is-range-in-table.d.ts +6 -6
- package/plugins/table/utils/is-selection-in-table.d.ts +6 -6
- package/plugins/table/utils/is-virtual-key.d.ts +1 -1
- package/plugins/table/utils/merge-cell.d.ts +21 -21
- package/plugins/table/utils/next-path.d.ts +2 -2
- package/plugins/table/utils/normalize-table.d.ts +2 -2
- package/plugins/table/utils/remove-columns.d.ts +2 -2
- package/plugins/table/utils/set-menu-cell-invisibility.d.ts +3 -3
- package/plugins/table/utils/split-cell.d.ts +4 -4
- package/plugins/table/utils/table-position.d.ts +97 -97
- package/plugins/todo-item/todo-item.component.d.ts +21 -21
- package/plugins/todo-item/todo-item.editor.d.ts +5 -5
- package/plugins/todo-item/todo-item.plugin.d.ts +5 -5
- package/plugins/vertical-align/toolbar-item.component.d.ts +25 -25
- package/plugins/vertical-align/vertical-align.editor.d.ts +7 -7
- package/public-api.d.ts +20 -20
- package/queries/anchor-block-entry.d.ts +2 -2
- package/queries/anchor-block.d.ts +2 -2
- package/queries/anchor-inline-entry.d.ts +2 -2
- package/queries/find-descendant.d.ts +10 -10
- package/queries/find-node.d.ts +15 -15
- package/queries/find-path.d.ts +6 -6
- package/queries/get-above-by-type.d.ts +6 -6
- package/queries/get-above.d.ts +6 -6
- package/queries/get-anchor-block-entry.d.ts +2 -2
- package/queries/get-block-above.d.ts +7 -7
- package/queries/get-block-card-above.d.ts +7 -7
- package/queries/get-block-card-cursor.d.ts +2 -2
- package/queries/get-container-blocks.d.ts +2 -2
- package/queries/get-directly-parent.d.ts +2 -2
- package/queries/get-insert-elements-path.d.ts +7 -7
- package/queries/get-last-child-path.d.ts +6 -6
- package/queries/get-last-node.d.ts +2 -2
- package/queries/get-next-sibling-nodes.d.ts +7 -7
- package/queries/get-node.d.ts +2 -2
- package/queries/get-nodes-by-type.d.ts +6 -6
- package/queries/get-nodes.d.ts +4 -4
- package/queries/get-parent.d.ts +7 -7
- package/queries/get-plain-text.d.ts +6 -6
- package/queries/get-plugin-by-toolbar.d.ts +3 -3
- package/queries/get-point-before.d.ts +38 -38
- package/queries/get-point-from-location.d.ts +5 -5
- package/queries/get-previous-path.d.ts +2 -2
- package/queries/get-rang-from-block-start.d.ts +9 -9
- package/queries/get-range-before.d.ts +7 -7
- package/queries/get-selection-marks.d.ts +12 -12
- package/queries/get-selection-nodes-by-type.d.ts +3 -3
- package/queries/get-text.d.ts +6 -6
- package/queries/get-toolbar-disabled.d.ts +4 -4
- package/queries/index.d.ts +58 -57
- package/queries/is-across-blocks.d.ts +2 -2
- package/queries/is-ancestor-empty.d.ts +5 -5
- package/queries/is-ancestor.d.ts +2 -2
- package/queries/is-block-above-empty.d.ts +5 -5
- package/queries/is-block-active.d.ts +3 -3
- package/queries/is-block-card-cursor.d.ts +2 -2
- package/queries/is-block-text-empty-after-selection.d.ts +7 -7
- package/queries/is-collapsed.d.ts +6 -6
- package/queries/is-contain-nested-type.d.ts +2 -2
- package/queries/is-container-type.d.ts +2 -2
- package/queries/is-descendant.d.ts +2 -2
- package/queries/is-empty-content.d.ts +2 -0
- package/queries/is-empty-paragraph-by-path.d.ts +2 -2
- package/queries/is-empty-paragraph.d.ts +2 -2
- package/queries/is-first-child.d.ts +5 -5
- package/queries/is-include-types.d.ts +3 -3
- package/queries/is-node-type-in.d.ts +6 -6
- package/queries/is-node-type.d.ts +6 -6
- package/queries/is-paragraph.d.ts +2 -2
- package/queries/is-point-at-root.d.ts +2 -2
- package/queries/is-range-across-blocks.d.ts +8 -8
- package/queries/is-range-at-root.d.ts +2 -2
- package/queries/is-start.d.ts +5 -5
- package/queries/some-node.d.ts +7 -7
- package/services/color-select.service.d.ts +20 -20
- package/services/context.service.d.ts +49 -49
- package/services/table-contextmenu.service.d.ts +25 -25
- package/services/toolbar.service.d.ts +9 -9
- package/shortcuts/index.d.ts +2 -2
- package/shortcuts/mark.d.ts +2 -2
- package/transforms/apply-deep-to-nodes.d.ts +12 -12
- package/transforms/clear-marks.d.ts +2 -2
- package/transforms/close-conversion-hint.d.ts +2 -2
- package/transforms/delete-element.d.ts +2 -2
- package/transforms/handle-continual-delete-backward.d.ts +3 -3
- package/transforms/handle-continual-insert-break.d.ts +3 -3
- package/transforms/index.d.ts +18 -18
- package/transforms/insert-elements.d.ts +2 -2
- package/transforms/insert-paragraph.d.ts +2 -2
- package/transforms/merge-deep-to-nodes.d.ts +5 -5
- package/transforms/move-children.d.ts +24 -24
- package/transforms/on-keydown-reset-block-type.d.ts +3 -3
- package/transforms/set-end-selection.d.ts +2 -2
- package/transforms/set-marks.d.ts +12 -12
- package/transforms/set-node.d.ts +2 -2
- package/transforms/split-node.d.ts +3 -3
- package/transforms/un-hang-range.d.ts +10 -10
- package/transforms/un-wrap.d.ts +3 -3
- package/transforms/unwrap-nodes-by-type.d.ts +6 -6
- package/utils/auto-focus.d.ts +2 -2
- package/utils/auto-scroll-view.d.ts +6 -6
- package/utils/cast-array.d.ts +1 -1
- package/utils/common.d.ts +2 -2
- package/utils/create-empty-paragraph.d.ts +2 -2
- package/utils/data-transform.d.ts +6 -6
- package/utils/dom.d.ts +10 -10
- package/utils/editor-uuid.d.ts +3 -3
- package/utils/fragment.d.ts +10 -10
- package/utils/get-editable-element-height.d.ts +2 -2
- package/utils/get-toolbar-class.d.ts +2 -2
- package/utils/id-creator.d.ts +1 -1
- package/utils/index.d.ts +13 -13
- package/utils/is-clean-empty-paragraph.d.ts +9 -9
- package/utils/is-inline.d.ts +2 -2
- package/utils/lodash.d.ts +1 -1
- package/utils/match.d.ts +18 -18
- package/utils/merge-element-options.d.ts +2 -2
- package/utils/weak-maps.d.ts +5 -5
- package/worktile-theia.d.ts +5 -5
|
@@ -1,245 +1,245 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, ViewChild, Inject } from '@angular/core';
|
|
2
|
-
import { Transforms } from 'slate';
|
|
3
|
-
import { AngularEditor, IS_SAFARI } from 'slate-angular';
|
|
4
|
-
import { CodeMirrorComponent } from 'ng-codemirror';
|
|
5
|
-
import { CODEMIRROR_PADDING_TOP, CODE_MODES, DropdownMode, ToolbarItemMode } from '../../constants';
|
|
6
|
-
import { TheBaseElementComponent, TheMode, THE_MODE_TOKEN } from '../../interfaces';
|
|
7
|
-
import { CodeEditor } from './code.editor';
|
|
8
|
-
import * as TheTransforms from '../../transforms';
|
|
9
|
-
import { delay, take, takeUntil } from 'rxjs/operators';
|
|
10
|
-
import { fromEvent, Subject } from 'rxjs';
|
|
11
|
-
import * as i0 from "@angular/core";
|
|
12
|
-
import * as i1 from "ngx-tethys/notify";
|
|
13
|
-
import * as i2 from "../../services/context.service";
|
|
14
|
-
import * as i3 from "ngx-tethys/nav";
|
|
15
|
-
import * as i4 from "../../components/toolbar-dropdown/toolbar-dropdown.component";
|
|
16
|
-
import * as i5 from "ngx-tethys/switch";
|
|
17
|
-
import * as i6 from "../../components/nav-split-line/nav-split-line.component";
|
|
18
|
-
import * as i7 from "slate-angular";
|
|
19
|
-
import * as i8 from "ng-codemirror";
|
|
20
|
-
import * as i9 from "ngx-tethys/resizable";
|
|
21
|
-
import * as i10 from "@angular/common";
|
|
22
|
-
import * as i11 from "@angular/forms";
|
|
23
|
-
import * as i12 from "ngx-tethys/tooltip";
|
|
24
|
-
import * as i13 from "../../interfaces";
|
|
25
|
-
export class TheCodeComponent extends TheBaseElementComponent {
|
|
26
|
-
constructor(elementRef, cdr, thyNotifyService, contextService, ngZone, config) {
|
|
27
|
-
super(elementRef, cdr);
|
|
28
|
-
this.elementRef = elementRef;
|
|
29
|
-
this.cdr = cdr;
|
|
30
|
-
this.thyNotifyService = thyNotifyService;
|
|
31
|
-
this.contextService = contextService;
|
|
32
|
-
this.ngZone = ngZone;
|
|
33
|
-
this.config = config;
|
|
34
|
-
this.startRenderCodemirror = false;
|
|
35
|
-
this.dropdownMode = DropdownMode;
|
|
36
|
-
this.maxHeight = this.config.mode === TheMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
|
|
37
|
-
this.menus = CODE_MODES.map(item => {
|
|
38
|
-
return { key: item.value, name: item.showName };
|
|
39
|
-
});
|
|
40
|
-
this.destroy$ = new Subject();
|
|
41
|
-
this.ToolbarItemMode = ToolbarItemMode;
|
|
42
|
-
this.isHightLight = false;
|
|
43
|
-
this.resizeHeight = null;
|
|
44
|
-
this.options = {
|
|
45
|
-
mode: this.menus[0].key,
|
|
46
|
-
lineNumbers: false,
|
|
47
|
-
readOnly: false,
|
|
48
|
-
autofocus: false,
|
|
49
|
-
lineWiseCopyCut: true,
|
|
50
|
-
lineWrapping: this.config.mode === TheMode.default ? false : true,
|
|
51
|
-
cursorBlinkRate: 500
|
|
52
|
-
};
|
|
53
|
-
this.activeLanguage = this.menus[0];
|
|
54
|
-
this.resizeBounds = null;
|
|
55
|
-
this.onChangeLanguage = item => {
|
|
56
|
-
this.options = Object.assign(Object.assign({}, this.options), { mode: item.key });
|
|
57
|
-
this.activeLanguage = item;
|
|
58
|
-
CodeEditor.setCodeAttribute(this.editor, this.element, { language: item.key });
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
get code() {
|
|
62
|
-
return this.element.content;
|
|
63
|
-
}
|
|
64
|
-
onContextChange() {
|
|
65
|
-
super.onContextChange();
|
|
66
|
-
if (this.initialized) {
|
|
67
|
-
if (this.options.readOnly !== this.readonly) {
|
|
68
|
-
this.useReadonly();
|
|
69
|
-
}
|
|
70
|
-
if (this.options.mode !== this.element.language) {
|
|
71
|
-
this.useMode();
|
|
72
|
-
}
|
|
73
|
-
if (this.options.lineWrapping !== this.element.autoWrap) {
|
|
74
|
-
this.useAutoWrap();
|
|
75
|
-
}
|
|
76
|
-
if (this.resizeHeight !== this.element.height) {
|
|
77
|
-
this.useHeight();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
ngOnInit() {
|
|
82
|
-
super.ngOnInit();
|
|
83
|
-
this.ngZone.runOutsideAngular(() => {
|
|
84
|
-
fromEvent(this.nativeElement, 'mousedown')
|
|
85
|
-
.pipe(takeUntil(this.destroy$))
|
|
86
|
-
.subscribe(event => {
|
|
87
|
-
event.stopPropagation();
|
|
88
|
-
const isBlockOperation = this.isCollapsed &&
|
|
89
|
-
this.nativeElement.querySelector('.the-code-block-operation').contains(event.target);
|
|
90
|
-
const isCodemirror = this.nativeElement.querySelector('.ng-codemirror').contains(event.target);
|
|
91
|
-
this.isHightLight = !isCodemirror && !isBlockOperation;
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
this.elementRef.nativeElement.classList.add('the-code-container');
|
|
95
|
-
}
|
|
96
|
-
ngAfterViewInit() {
|
|
97
|
-
if (this.readonly) {
|
|
98
|
-
// delay 20ms
|
|
99
|
-
// ccodemirror is too slow
|
|
100
|
-
this.ngZone.onStable.pipe(take(1), delay(20)).subscribe(() => {
|
|
101
|
-
this.renderCodemirror();
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
// edit mode can not delay
|
|
106
|
-
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
107
|
-
this.renderCodemirror();
|
|
108
|
-
this.initializeCodemirrorFocus();
|
|
109
|
-
this.resizeBounds = {
|
|
110
|
-
nativeElement: this.contextService.getEditableElement()
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
renderCodemirror() {
|
|
116
|
-
this.startRenderCodemirror = true;
|
|
117
|
-
this.useReadonly();
|
|
118
|
-
this.useMode();
|
|
119
|
-
this.useAutoWrap();
|
|
120
|
-
this.useHeight();
|
|
121
|
-
this.cdr.detectChanges();
|
|
122
|
-
}
|
|
123
|
-
initializeCodemirrorFocus() {
|
|
124
|
-
if (this.isCollapsed) {
|
|
125
|
-
setTimeout(() => {
|
|
126
|
-
if (this.isCollapsed && this.codemirror && this.codemirror.editor && !this.codemirror.editor.hasFocus()) {
|
|
127
|
-
AngularEditor.blur(this.editor);
|
|
128
|
-
this.codemirror.editor.focus();
|
|
129
|
-
this.codemirror.editor.refresh();
|
|
130
|
-
}
|
|
131
|
-
}, 200);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
codeChange($event) {
|
|
135
|
-
this.isHightLight = false;
|
|
136
|
-
CodeEditor.setCodeAttribute(this.editor, this.element, { content: $event });
|
|
137
|
-
}
|
|
138
|
-
onDelete(event) {
|
|
139
|
-
event.preventDefault();
|
|
140
|
-
TheTransforms.deleteElement(this.editor, this.element);
|
|
141
|
-
}
|
|
142
|
-
onCopy(event) {
|
|
143
|
-
event.preventDefault();
|
|
144
|
-
event.stopPropagation();
|
|
145
|
-
// remove codemorrir selection
|
|
146
|
-
const selection = window.getSelection();
|
|
147
|
-
if (selection.rangeCount > 0) {
|
|
148
|
-
selection.removeAllRanges();
|
|
149
|
-
}
|
|
150
|
-
AngularEditor.focus(this.editor);
|
|
151
|
-
Transforms.select(this.editor, AngularEditor.findPath(this.editor, this.element));
|
|
152
|
-
if (IS_SAFARI) {
|
|
153
|
-
this.safariCopy();
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
document.execCommand('copy') ? this.thyNotifyService.success('复制成功') : this.thyNotifyService.error('复制失败');
|
|
157
|
-
AngularEditor.deselect(this.editor);
|
|
158
|
-
}
|
|
159
|
-
safariCopy() {
|
|
160
|
-
const currentElement = AngularEditor.toDOMNode(this.editor, this.element);
|
|
161
|
-
const blockCard = currentElement.closest('.slate-block-card');
|
|
162
|
-
const span = document.createElement('pre');
|
|
163
|
-
span.appendChild(blockCard.cloneNode(true));
|
|
164
|
-
span.textContent = this.element.content;
|
|
165
|
-
if (this.element.language) {
|
|
166
|
-
span.setAttribute('data-language', this.element.language);
|
|
167
|
-
}
|
|
168
|
-
if (this.element.autoWrap) {
|
|
169
|
-
span.setAttribute('data-auto-wrap', String(this.element.autoWrap));
|
|
170
|
-
}
|
|
171
|
-
if (this.element.height) {
|
|
172
|
-
span.setAttribute('data-height', String(this.element.height));
|
|
173
|
-
}
|
|
174
|
-
document.body.appendChild(span);
|
|
175
|
-
const selection = window.getSelection();
|
|
176
|
-
const range = document.createRange();
|
|
177
|
-
if (selection) {
|
|
178
|
-
selection.removeAllRanges();
|
|
179
|
-
range.selectNode(span);
|
|
180
|
-
selection.addRange(range);
|
|
181
|
-
document.execCommand('copy') ? this.thyNotifyService.success('复制成功') : this.thyNotifyService.error('复制失败');
|
|
182
|
-
selection.removeAllRanges();
|
|
183
|
-
document.body.removeChild(span);
|
|
184
|
-
AngularEditor.deselect(this.editor);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
focusChange(codeMirrorFocused) {
|
|
188
|
-
if (codeMirrorFocused) {
|
|
189
|
-
this.isHightLight = false;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
useMode() {
|
|
193
|
-
this.options = Object.assign(Object.assign({}, this.options), { mode: this.element.language });
|
|
194
|
-
const menuItem = this.menus.find(i => i.key === this.element.language);
|
|
195
|
-
if (menuItem) {
|
|
196
|
-
this.activeLanguage = menuItem;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
useAutoWrap() {
|
|
200
|
-
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: this.element.autoWrap || false });
|
|
201
|
-
}
|
|
202
|
-
useHeight() {
|
|
203
|
-
if (this.element.height && this.config.mode !== 'print') {
|
|
204
|
-
this.resizeHeight = this.element.height;
|
|
205
|
-
this.maxHeight = this.element.height;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
useReadonly() {
|
|
209
|
-
this.options = Object.assign(Object.assign({}, this.options), { readOnly: this.readonly, cursorBlinkRate: this.readonly ? -1 : 500 });
|
|
210
|
-
}
|
|
211
|
-
onResize({ height }) {
|
|
212
|
-
this.resizeHeight = height;
|
|
213
|
-
this.maxHeight = height;
|
|
214
|
-
}
|
|
215
|
-
onEndResize() {
|
|
216
|
-
Transforms.select(this.editor, AngularEditor.findPath(this.editor, this.element));
|
|
217
|
-
CodeEditor.setCodeAttribute(this.editor, this.element, { height: this.resizeHeight });
|
|
218
|
-
}
|
|
219
|
-
onChangeWrap(value) {
|
|
220
|
-
this.isHightLight = false;
|
|
221
|
-
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: value || false });
|
|
222
|
-
CodeEditor.setCodeAttribute(this.editor, this.element, { autoWrap: value ? value : null });
|
|
223
|
-
}
|
|
224
|
-
ngOnDestroy() {
|
|
225
|
-
this.destroy$.next();
|
|
226
|
-
this.destroy$.complete();
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.ThyNotifyService }, { token: i2.TheContextService }, { token: i0.NgZone }, { token: THE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
230
|
-
TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"isCollapsed && codemirror && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown\n [menus]=\"menus\"\n [toolbarItem]=\"activeLanguage\"\n [dropdownItemKey]=\"activeLanguage?.key\"\n [itemMousedownHandle]=\"onChangeLanguage\"\n >\n </the-toolbar-dropdown>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<!-- \u53EA\u8BFB\u6A21\u5F0F\u4E0BCodeMirror-sizer\u9AD8\u5EA6\u6BD4\u7F16\u8F91\u6A21\u5F0F\u4E0B\u591A2px\uFF0C\u8BBE\u7F6EthyMinHeight\u4E3A46px\u9632\u6B62\u62D6\u62FD\u5230\u6700\u5C0F\u9AD8\u5EA6\u65F6\u53EA\u8BFB\u6A21\u5F0F\u4E0B\u51FA\u73B0\u6EDA\u52A8\u6761 -->\n<div\n thyResizable\n [thyMinHeight]=\"46\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n [ngClass]=\"{ focus: isCollapsed, readonly: options.readOnly, active: isHightLight && isCollapsed }\"\n>\n <ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n >\n </ng-codemirror>\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\" *ngIf=\"isCollapsed && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i4.TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["itemMousedownHandle"] }, { type: i5.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i6.NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i7.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i11.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i9.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
231
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheCodeComponent, decorators: [{
|
|
232
|
-
type: Component,
|
|
233
|
-
args: [{
|
|
234
|
-
selector: 'div[theCode]',
|
|
235
|
-
templateUrl: './code.component.html',
|
|
236
|
-
changeDetection: ChangeDetectionStrategy.OnPush
|
|
237
|
-
}]
|
|
238
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.ThyNotifyService }, { type: i2.TheContextService }, { type: i0.NgZone }, { type: i13.TheModeConfig, decorators: [{
|
|
239
|
-
type: Inject,
|
|
240
|
-
args: [THE_MODE_TOKEN]
|
|
241
|
-
}] }]; }, propDecorators: { codemirror: [{
|
|
242
|
-
type: ViewChild,
|
|
243
|
-
args: ['codemirror', { read: CodeMirrorComponent, static: false }]
|
|
244
|
-
}] } });
|
|
1
|
+
import { Component, ChangeDetectionStrategy, ViewChild, Inject } from '@angular/core';
|
|
2
|
+
import { Transforms } from 'slate';
|
|
3
|
+
import { AngularEditor, IS_SAFARI } from 'slate-angular';
|
|
4
|
+
import { CodeMirrorComponent } from 'ng-codemirror';
|
|
5
|
+
import { CODEMIRROR_PADDING_TOP, CODE_MODES, DropdownMode, ToolbarItemMode } from '../../constants';
|
|
6
|
+
import { TheBaseElementComponent, TheMode, THE_MODE_TOKEN } from '../../interfaces';
|
|
7
|
+
import { CodeEditor } from './code.editor';
|
|
8
|
+
import * as TheTransforms from '../../transforms';
|
|
9
|
+
import { delay, take, takeUntil } from 'rxjs/operators';
|
|
10
|
+
import { fromEvent, Subject } from 'rxjs';
|
|
11
|
+
import * as i0 from "@angular/core";
|
|
12
|
+
import * as i1 from "ngx-tethys/notify";
|
|
13
|
+
import * as i2 from "../../services/context.service";
|
|
14
|
+
import * as i3 from "ngx-tethys/nav";
|
|
15
|
+
import * as i4 from "../../components/toolbar-dropdown/toolbar-dropdown.component";
|
|
16
|
+
import * as i5 from "ngx-tethys/switch";
|
|
17
|
+
import * as i6 from "../../components/nav-split-line/nav-split-line.component";
|
|
18
|
+
import * as i7 from "slate-angular";
|
|
19
|
+
import * as i8 from "ng-codemirror";
|
|
20
|
+
import * as i9 from "ngx-tethys/resizable";
|
|
21
|
+
import * as i10 from "@angular/common";
|
|
22
|
+
import * as i11 from "@angular/forms";
|
|
23
|
+
import * as i12 from "ngx-tethys/tooltip";
|
|
24
|
+
import * as i13 from "../../interfaces";
|
|
25
|
+
export class TheCodeComponent extends TheBaseElementComponent {
|
|
26
|
+
constructor(elementRef, cdr, thyNotifyService, contextService, ngZone, config) {
|
|
27
|
+
super(elementRef, cdr);
|
|
28
|
+
this.elementRef = elementRef;
|
|
29
|
+
this.cdr = cdr;
|
|
30
|
+
this.thyNotifyService = thyNotifyService;
|
|
31
|
+
this.contextService = contextService;
|
|
32
|
+
this.ngZone = ngZone;
|
|
33
|
+
this.config = config;
|
|
34
|
+
this.startRenderCodemirror = false;
|
|
35
|
+
this.dropdownMode = DropdownMode;
|
|
36
|
+
this.maxHeight = this.config.mode === TheMode.default ? 350 - CODEMIRROR_PADDING_TOP * 2 : 0;
|
|
37
|
+
this.menus = CODE_MODES.map(item => {
|
|
38
|
+
return { key: item.value, name: item.showName };
|
|
39
|
+
});
|
|
40
|
+
this.destroy$ = new Subject();
|
|
41
|
+
this.ToolbarItemMode = ToolbarItemMode;
|
|
42
|
+
this.isHightLight = false;
|
|
43
|
+
this.resizeHeight = null;
|
|
44
|
+
this.options = {
|
|
45
|
+
mode: this.menus[0].key,
|
|
46
|
+
lineNumbers: false,
|
|
47
|
+
readOnly: false,
|
|
48
|
+
autofocus: false,
|
|
49
|
+
lineWiseCopyCut: true,
|
|
50
|
+
lineWrapping: this.config.mode === TheMode.default ? false : true,
|
|
51
|
+
cursorBlinkRate: 500
|
|
52
|
+
};
|
|
53
|
+
this.activeLanguage = this.menus[0];
|
|
54
|
+
this.resizeBounds = null;
|
|
55
|
+
this.onChangeLanguage = item => {
|
|
56
|
+
this.options = Object.assign(Object.assign({}, this.options), { mode: item.key });
|
|
57
|
+
this.activeLanguage = item;
|
|
58
|
+
CodeEditor.setCodeAttribute(this.editor, this.element, { language: item.key });
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
get code() {
|
|
62
|
+
return this.element.content;
|
|
63
|
+
}
|
|
64
|
+
onContextChange() {
|
|
65
|
+
super.onContextChange();
|
|
66
|
+
if (this.initialized) {
|
|
67
|
+
if (this.options.readOnly !== this.readonly) {
|
|
68
|
+
this.useReadonly();
|
|
69
|
+
}
|
|
70
|
+
if (this.options.mode !== this.element.language) {
|
|
71
|
+
this.useMode();
|
|
72
|
+
}
|
|
73
|
+
if (this.options.lineWrapping !== this.element.autoWrap) {
|
|
74
|
+
this.useAutoWrap();
|
|
75
|
+
}
|
|
76
|
+
if (this.resizeHeight !== this.element.height) {
|
|
77
|
+
this.useHeight();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
ngOnInit() {
|
|
82
|
+
super.ngOnInit();
|
|
83
|
+
this.ngZone.runOutsideAngular(() => {
|
|
84
|
+
fromEvent(this.nativeElement, 'mousedown')
|
|
85
|
+
.pipe(takeUntil(this.destroy$))
|
|
86
|
+
.subscribe(event => {
|
|
87
|
+
event.stopPropagation();
|
|
88
|
+
const isBlockOperation = this.isCollapsed &&
|
|
89
|
+
this.nativeElement.querySelector('.the-code-block-operation').contains(event.target);
|
|
90
|
+
const isCodemirror = this.nativeElement.querySelector('.ng-codemirror').contains(event.target);
|
|
91
|
+
this.isHightLight = !isCodemirror && !isBlockOperation;
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
this.elementRef.nativeElement.classList.add('the-code-container');
|
|
95
|
+
}
|
|
96
|
+
ngAfterViewInit() {
|
|
97
|
+
if (this.readonly) {
|
|
98
|
+
// delay 20ms
|
|
99
|
+
// ccodemirror is too slow
|
|
100
|
+
this.ngZone.onStable.pipe(take(1), delay(20)).subscribe(() => {
|
|
101
|
+
this.renderCodemirror();
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
// edit mode can not delay
|
|
106
|
+
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
107
|
+
this.renderCodemirror();
|
|
108
|
+
this.initializeCodemirrorFocus();
|
|
109
|
+
this.resizeBounds = {
|
|
110
|
+
nativeElement: this.contextService.getEditableElement()
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
renderCodemirror() {
|
|
116
|
+
this.startRenderCodemirror = true;
|
|
117
|
+
this.useReadonly();
|
|
118
|
+
this.useMode();
|
|
119
|
+
this.useAutoWrap();
|
|
120
|
+
this.useHeight();
|
|
121
|
+
this.cdr.detectChanges();
|
|
122
|
+
}
|
|
123
|
+
initializeCodemirrorFocus() {
|
|
124
|
+
if (this.isCollapsed) {
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
if (this.isCollapsed && this.codemirror && this.codemirror.editor && !this.codemirror.editor.hasFocus()) {
|
|
127
|
+
AngularEditor.blur(this.editor);
|
|
128
|
+
this.codemirror.editor.focus();
|
|
129
|
+
this.codemirror.editor.refresh();
|
|
130
|
+
}
|
|
131
|
+
}, 200);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
codeChange($event) {
|
|
135
|
+
this.isHightLight = false;
|
|
136
|
+
CodeEditor.setCodeAttribute(this.editor, this.element, { content: $event });
|
|
137
|
+
}
|
|
138
|
+
onDelete(event) {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
TheTransforms.deleteElement(this.editor, this.element);
|
|
141
|
+
}
|
|
142
|
+
onCopy(event) {
|
|
143
|
+
event.preventDefault();
|
|
144
|
+
event.stopPropagation();
|
|
145
|
+
// remove codemorrir selection
|
|
146
|
+
const selection = window.getSelection();
|
|
147
|
+
if (selection.rangeCount > 0) {
|
|
148
|
+
selection.removeAllRanges();
|
|
149
|
+
}
|
|
150
|
+
AngularEditor.focus(this.editor);
|
|
151
|
+
Transforms.select(this.editor, AngularEditor.findPath(this.editor, this.element));
|
|
152
|
+
if (IS_SAFARI) {
|
|
153
|
+
this.safariCopy();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
document.execCommand('copy') ? this.thyNotifyService.success('复制成功') : this.thyNotifyService.error('复制失败');
|
|
157
|
+
AngularEditor.deselect(this.editor);
|
|
158
|
+
}
|
|
159
|
+
safariCopy() {
|
|
160
|
+
const currentElement = AngularEditor.toDOMNode(this.editor, this.element);
|
|
161
|
+
const blockCard = currentElement.closest('.slate-block-card');
|
|
162
|
+
const span = document.createElement('pre');
|
|
163
|
+
span.appendChild(blockCard.cloneNode(true));
|
|
164
|
+
span.textContent = this.element.content;
|
|
165
|
+
if (this.element.language) {
|
|
166
|
+
span.setAttribute('data-language', this.element.language);
|
|
167
|
+
}
|
|
168
|
+
if (this.element.autoWrap) {
|
|
169
|
+
span.setAttribute('data-auto-wrap', String(this.element.autoWrap));
|
|
170
|
+
}
|
|
171
|
+
if (this.element.height) {
|
|
172
|
+
span.setAttribute('data-height', String(this.element.height));
|
|
173
|
+
}
|
|
174
|
+
document.body.appendChild(span);
|
|
175
|
+
const selection = window.getSelection();
|
|
176
|
+
const range = document.createRange();
|
|
177
|
+
if (selection) {
|
|
178
|
+
selection.removeAllRanges();
|
|
179
|
+
range.selectNode(span);
|
|
180
|
+
selection.addRange(range);
|
|
181
|
+
document.execCommand('copy') ? this.thyNotifyService.success('复制成功') : this.thyNotifyService.error('复制失败');
|
|
182
|
+
selection.removeAllRanges();
|
|
183
|
+
document.body.removeChild(span);
|
|
184
|
+
AngularEditor.deselect(this.editor);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
focusChange(codeMirrorFocused) {
|
|
188
|
+
if (codeMirrorFocused) {
|
|
189
|
+
this.isHightLight = false;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
useMode() {
|
|
193
|
+
this.options = Object.assign(Object.assign({}, this.options), { mode: this.element.language });
|
|
194
|
+
const menuItem = this.menus.find(i => i.key === this.element.language);
|
|
195
|
+
if (menuItem) {
|
|
196
|
+
this.activeLanguage = menuItem;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
useAutoWrap() {
|
|
200
|
+
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: this.element.autoWrap || false });
|
|
201
|
+
}
|
|
202
|
+
useHeight() {
|
|
203
|
+
if (this.element.height && this.config.mode !== 'print') {
|
|
204
|
+
this.resizeHeight = this.element.height;
|
|
205
|
+
this.maxHeight = this.element.height;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
useReadonly() {
|
|
209
|
+
this.options = Object.assign(Object.assign({}, this.options), { readOnly: this.readonly, cursorBlinkRate: this.readonly ? -1 : 500 });
|
|
210
|
+
}
|
|
211
|
+
onResize({ height }) {
|
|
212
|
+
this.resizeHeight = height;
|
|
213
|
+
this.maxHeight = height;
|
|
214
|
+
}
|
|
215
|
+
onEndResize() {
|
|
216
|
+
Transforms.select(this.editor, AngularEditor.findPath(this.editor, this.element));
|
|
217
|
+
CodeEditor.setCodeAttribute(this.editor, this.element, { height: this.resizeHeight });
|
|
218
|
+
}
|
|
219
|
+
onChangeWrap(value) {
|
|
220
|
+
this.isHightLight = false;
|
|
221
|
+
this.options = Object.assign(Object.assign({}, this.options), { lineWrapping: value || false });
|
|
222
|
+
CodeEditor.setCodeAttribute(this.editor, this.element, { autoWrap: value ? value : null });
|
|
223
|
+
}
|
|
224
|
+
ngOnDestroy() {
|
|
225
|
+
this.destroy$.next();
|
|
226
|
+
this.destroy$.complete();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
TheCodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheCodeComponent, deps: [{ token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: i1.ThyNotifyService }, { token: i2.TheContextService }, { token: i0.NgZone }, { token: THE_MODE_TOKEN }], target: i0.ɵɵFactoryTarget.Component });
|
|
230
|
+
TheCodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: TheCodeComponent, selector: "div[theCode]", viewQueries: [{ propertyName: "codemirror", first: true, predicate: ["codemirror"], descendants: true, read: CodeMirrorComponent }], usesInheritance: true, ngImport: i0, template: "<div contenteditable=\"false\" class=\"the-code-block-operation\" *ngIf=\"isCollapsed && codemirror && !options.readOnly\">\n <thy-icon-nav>\n <the-toolbar-dropdown\n [menus]=\"menus\"\n [toolbarItem]=\"activeLanguage\"\n [dropdownItemKey]=\"activeLanguage?.key\"\n [itemMousedownHandle]=\"onChangeLanguage\"\n >\n </the-toolbar-dropdown>\n <span class=\"auto-wrap d-flex align-items-center\">\n <span>\u81EA\u52A8\u6362\u884C</span>\n <thy-switch\n class=\"auto-wrap-btn d-flex\"\n [(ngModel)]=\"options.lineWrapping\"\n (ngModelChange)=\"onChangeWrap($event)\"\n thySize=\"sm\"\n ></thy-switch>\n </span>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"copy\"\n thyTooltip=\"\u590D\u5236\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onCopy($event)\"\n ></a>\n <nav-split-line [mode]=\"ToolbarItemMode.vertical\"></nav-split-line>\n <a\n href=\"javascript:;\"\n thyIconNavLink\n thyIconNavLinkIcon=\"trash\"\n thyTooltip=\"\u5220\u9664\"\n class=\"remove-link\"\n thyTooltipPlacement=\"top\"\n (mousedown)=\"onDelete($event)\"\n ></a>\n </thy-icon-nav>\n</div>\n\n<slate-children [children]=\"children\" [context]=\"childrenContext\" [viewContext]=\"viewContext\"></slate-children>\n\n<!-- \u53EA\u8BFB\u6A21\u5F0F\u4E0BCodeMirror-sizer\u9AD8\u5EA6\u6BD4\u7F16\u8F91\u6A21\u5F0F\u4E0B\u591A2px\uFF0C\u8BBE\u7F6EthyMinHeight\u4E3A46px\u9632\u6B62\u62D6\u62FD\u5230\u6700\u5C0F\u9AD8\u5EA6\u65F6\u53EA\u8BFB\u6A21\u5F0F\u4E0B\u51FA\u73B0\u6EDA\u52A8\u6761 -->\n<div\n thyResizable\n [thyMinHeight]=\"46\"\n [thyBounds]=\"resizeBounds\"\n [style.height.px]=\"resizeHeight\"\n (thyResize)=\"onResize($event)\"\n (thyResizeEnd)=\"onEndResize()\"\n class=\"resize-code-container\"\n [ngClass]=\"{ focus: isCollapsed, readonly: options.readOnly, active: isHightLight && isCollapsed }\"\n>\n <ng-codemirror\n *ngIf=\"startRenderCodemirror\"\n #codemirror\n contenteditable=\"false\"\n class=\"ng-codemirror-wrapper\"\n [ngStyle]=\"{ maxHeight: maxHeight > 0 ? maxHeight + 'px' : 'auto' }\"\n [options]=\"options\"\n [ngModel]=\"code\"\n [delayRefreshTime]=\"300\"\n (ngModelChange)=\"codeChange($event)\"\n (focusChange)=\"focusChange($event)\"\n [autoMaxHeight]=\"maxHeight\"\n >\n </ng-codemirror>\n <thy-resize-handle thyDirection=\"bottom\" class=\"code-resize-icon\" *ngIf=\"isCollapsed && !options.readOnly\"></thy-resize-handle>\n</div>\n", components: [{ type: i3.ThyIconNavComponent, selector: "thy-icon-nav", inputs: ["thyType"] }, { type: i4.TheToolbarDropdownComponent, selector: "the-toolbar-dropdown", inputs: ["itemMousedownHandle"] }, { type: i5.ThySwitchComponent, selector: "thy-switch", inputs: ["thyType", "thySize", "thyDisabled"], outputs: ["thyChange"] }, { type: i3.ThyIconNavLinkComponent, selector: "[thyIconNavLink]", inputs: ["thyIconNavLinkIcon", "thyIconNavLinkActive"] }, { type: i6.NavSplitLineComponent, selector: "nav-split-line", inputs: ["mode"] }, { type: i7.SlateChildrenComponent, selector: "slate-children", inputs: ["children", "context", "viewContext"] }, { type: i8.CodeMirrorComponent, selector: "ng-codemirror, [ngCodeMirror]", inputs: ["autoMaxHeight", "delayRefreshTime", "options"], outputs: ["focusChange"] }, { type: i9.ThyResizeHandleComponent, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }], directives: [{ type: i10.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i11.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i11.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i12.ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { type: i9.ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeEnd", "thyResizeStart"] }, { type: i10.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i10.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
231
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TheCodeComponent, decorators: [{
|
|
232
|
+
type: Component,
|
|
233
|
+
args: [{
|
|
234
|
+
selector: 'div[theCode]',
|
|
235
|
+
templateUrl: './code.component.html',
|
|
236
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
|
237
|
+
}]
|
|
238
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: i1.ThyNotifyService }, { type: i2.TheContextService }, { type: i0.NgZone }, { type: i13.TheModeConfig, decorators: [{
|
|
239
|
+
type: Inject,
|
|
240
|
+
args: [THE_MODE_TOKEN]
|
|
241
|
+
}] }]; }, propDecorators: { codemirror: [{
|
|
242
|
+
type: ViewChild,
|
|
243
|
+
args: ['codemirror', { read: CodeMirrorComponent, static: false }]
|
|
244
|
+
}] } });
|
|
245
245
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29kZS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9zcmMvcG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5nZSgpIHtcbiAgICAgICAgc3VwZXIub25Db250ZXh0Q2hhbmdlKCk7XG4gICAgICAgIGlmICh0aGlzLmluaXRpYWxpemVkKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5vcHRpb25zLnJlYWRPbmx5ICE9PSB0aGlzLnJlYWRvbmx5KSB7XG4gICAgICAgICAgICAgICAgdGhpcy51c2VSZWFkb25seSgpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHRoaXMub3B0aW9ucy5tb2RlICE9PSB0aGlzLmVsZW1lbnQubGFuZ3VhZ2UpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnVzZU1vZGUoKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0aGlzLm9wdGlvbnMubGluZVdyYXBwaW5nICE9PSB0aGlzLmVsZW1lbnQuYXV0b1dyYXApIHtcbiAgICAgICAgICAgICAgICB0aGlzLnVzZUF1dG9XcmFwKCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAodGhpcy5yZXNpemVIZWlnaHQgIT09IHRoaXMuZWxlbWVudC5oZWlnaHQpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnVzZUhlaWdodCgpO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgY29uc3RydWN0b3IoXG4gICAgICAgIHB1YmxpYyBlbGVtZW50UmVmOiBFbGVtZW50UmVmLFxuICAgICAgICBwdWJsaWMgY2RyOiBDaGFuZ2VEZXRlY3RvclJlZixcbiAgICAgICAgcHJpdmF0ZSB0aHlOb3RpZnlTZXJ2aWNlOiBUaHlOb3RpZnlTZXJ2aWNlLFxuICAgICAgICBwcml2YXRlIGNvbnRleHRTZXJ2aWNlOiBUaGVDb250ZXh0U2VydmljZSxcbiAgICAgICAgcHJpdmF0ZSBuZ1pvbmU6IE5nWm9uZSxcbiAgICAgICAgQEluamVjdChUSEVfTU9ERV9UT0tFTilcbiAgICAgICAgcHJpdmF0ZSBjb25maWc6IFRoZU1vZGVDb25maWdcbiAgICApIHtcbiAgICAgICAgc3VwZXIoZWxlbWVudFJlZiwgY2RyKTtcbiAgICB9XG5cbiAgICBuZ09uSW5pdCgpIHtcbiAgICAgICAgc3VwZXIubmdPbkluaXQoKTtcbiAgICAgICAgdGhpcy5uZ1pvbmUucnVuT3V0c2lkZUFuZ3VsYXIoKCkgPT4ge1xuICAgICAgICAgICAgZnJvbUV2ZW50KHRoaXMubmF0aXZlRWxlbWVudCwgJ21vdXNlZG93bicpXG4gICAgICAgICAgICAgICAgLnBpcGUodGFrZVVudGlsKHRoaXMuZGVzdHJveSQpKVxuICAgICAgICAgICAgICAgIC5zdWJzY3JpYmUoZXZlbnQgPT4ge1xuICAgICAgICAgICAgICAgICAgICBldmVudC5zdG9wUHJvcGFnYXRpb24oKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgaXNCbG9ja09wZXJhdGlvbiA9XG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLmlzQ29sbGFwc2VkICYmXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLm5hdGl2ZUVsZW1lbnQucXVlcnlTZWxlY3RvcignLnRoZS1jb2RlLWJsb2NrLW9wZXJhdGlvbicpLmNvbnRhaW5zKGV2ZW50LnRhcmdldCBhcyBIVE1MRWxlbWVudCk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IGlzQ29kZW1pcnJvciA9IHRoaXMubmF0aXZlRWxlbWVudC5xdWVyeVNlbGVjdG9yKCcubmctY29kZW1pcnJvcicpLmNvbnRhaW5zKGV2ZW50LnRhcmdldCBhcyBIVE1MRWxlbWVudCk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuaXNIaWdodExpZ2h0ID0gIWlzQ29kZW1pcnJvciAmJiAhaXNCbG9ja09wZXJhdGlvbjtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgfSk7XG4gICAgICAgIHRoaXMuZWxlbWVudFJlZi5uYXRpdmVFbGVtZW50LmNsYXNzTGlzdC5hZGQoJ3RoZS1jb2RlLWNvbnRhaW5lcicpO1xuICAgIH1cblxuICAgIG5nQWZ0ZXJWaWV3SW5pdCgpIHtcbiAgICAgICAgaWYgKHRoaXMucmVhZG9ubHkpIHtcbiAgICAgICAgICAgIC8vIGRlbGF5IDIwbXNcbiAgICAgICAgICAgIC8vIGNjb2RlbWlycm9yIGlzIHRvbyBzbG93XG4gICAgICAgICAgICB0aGlzLm5nWm9uZS5vblN0YWJsZS5waXBlKHRha2UoMSksIGRlbGF5KDIwKSkuc3Vic2NyaWJlKCgpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlbmRlckNvZGVtaXJyb3IoKTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gZWRpdCBtb2RlIGNhbiBub3QgZGVsYXlcbiAgICAgICAgICAgIHRoaXMubmdab25lLm9uU3RhYmxlLnBpcGUodGFrZSgxKSkuc3Vic2NyaWJlKCgpID0+IHtcbiAgICAgICAgICAgICAgICB0aGlzLnJlbmRlckNvZGVtaXJyb3IoKTtcbiAgICAgICAgICAgICAgICB0aGlzLmluaXRpYWxpemVDb2RlbWlycm9yRm9jdXMoKTtcbiAgICAgICAgICAgICAgICB0aGlzLnJlc2l6ZUJvdW5kcyA9IHtcbiAgICAgICAgICAgICAgICAgICAgbmF0aXZlRWxlbWVudDogdGhpcy5jb250ZXh0U2VydmljZS5nZXRFZGl0YWJsZUVsZW1lbnQoKVxuICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIHJlbmRlckNvZGVtaXJyb3IoKSB7XG4gICAgICAgIHRoaXMuc3RhcnRSZW5kZXJDb2RlbWlycm9yID0gdHJ1ZTtcbiAgICAgICAgdGhpcy51c2VSZWFkb25seSgpO1xuICAgICAgICB0aGlzLnVzZU1vZGUoKTtcbiAgICAgICAgdGhpcy51c2VBdXRvV3JhcCgpO1xuIC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FtpdGVtTW91c2Vkb3duSGFuZGxlXT1cIm9uQ2hhbmdlTGFuZ3VhZ2VcIlxuICAgICAgICA+XG4gICAgICAgIDwvdGhlLXRvb2xiYXItZHJvcGRvd24+XG4gICAgICAgIDxzcGFuIGNsYXNzPVwiYXV0by13cmFwIGQtZmxleCBhbGlnbi1pdGVtcy1jZW50ZXJcIj5cbiAgICAgICAgICAgIDxzcGFuPuiHquWKqOaNouihjDwvc3Bhbj5cbiAgICAgICAgICAgIDx0aHktc3dpdGNoXG4gICAgICAgICAgICAgICAgY2xhc3M9XCJhdXRvLXdyYXAtYnRuIGQtZmxleFwiXG4gICAgICAgICAgICAgICAgWyhuZ01vZGVsKV09XCJvcHRpb25zLmxpbmVXcmFwcGluZ1wiXG4gICAgICAgICAgICAgICAgKG5nTW9kZWxDaGFuZ2UpPVwib25DaGFuZ2VXcmFwKCRldmVudClcIlxuICAgICAgICAgICAgICAgIHRoeVNpemU9XCJzbVwiXG4gICAgICAgICAgICA+PC90aHktc3dpdGNoPlxuICAgICAgICA8L3NwYW4+XG4gICAgICAgIDxhXG4gICAgICAgICAgICBocmVmPVwiamF2YXNjcmlwdDo7XCJcbiAgICAgICAgICAgIHRoeUljb25OYXZMaW5rXG4gICAgICAgICAgICB0aHlJY29uTmF2TGlua0ljb249XCJjb3B5XCJcbiAgICAgICAgICAgIHRoeVRvb2x0aXA9XCLlpI3liLZcIlxuICAgICAgICAgICAgdGh5VG9vbHRpcFBsYWNlbWVudD1cInRvcFwiXG4gICAgICAgICAgICAobW91c2Vkb3duKT1cIm9uQ29weSgkZXZlbnQpXCJcbiAgICAgICAgPjwvYT5cbiAgICAgICAgPG5hdi1zcGxpdC1saW5lIFttb2RlXT1cIlRvb2xiYXJJdGVtTW9kZS52ZXJ0aWNhbFwiPjwvbmF2LXNwbGl0LWxpbmU+XG4gICAgICAgIDxhXG4gICAgICAgICAgICBocmVmPVwiamF2YXNjcmlwdDo7XCJcbiAgICAgICAgICAgIHRoeUljb25OYXZM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