@atlaskit/editor-plugin-table 1.1.0 → 1.1.2
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/CHANGELOG.md +12 -0
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/plugins/table/commands/clear.js +4 -16
- package/dist/cjs/plugins/table/commands/collapse.js +0 -6
- package/dist/cjs/plugins/table/commands/go-to-next-cell.js +7 -18
- package/dist/cjs/plugins/table/commands/hover.js +7 -37
- package/dist/cjs/plugins/table/commands/index.js +0 -8
- package/dist/cjs/plugins/table/commands/insert.js +17 -56
- package/dist/cjs/plugins/table/commands/misc.js +36 -132
- package/dist/cjs/plugins/table/commands/referentiality.js +0 -4
- package/dist/cjs/plugins/table/commands/selection.js +21 -87
- package/dist/cjs/plugins/table/commands/sort.js +2 -23
- package/dist/cjs/plugins/table/commands/split-cell.js +3 -11
- package/dist/cjs/plugins/table/commands/toggle.js +8 -34
- package/dist/cjs/plugins/table/commands-with-analytics.js +50 -139
- package/dist/cjs/plugins/table/create-plugin-config.js +0 -6
- package/dist/cjs/plugins/table/event-handlers.js +58 -160
- package/dist/cjs/plugins/table/handlers.js +10 -39
- package/dist/cjs/plugins/table/index.js +47 -91
- package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -41
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +82 -188
- package/dist/cjs/plugins/table/nodeviews/table.js +12 -70
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +15 -39
- package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +3 -15
- package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +0 -18
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -27
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -20
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -3
- package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +0 -3
- package/dist/cjs/plugins/table/pm-plugins/keymap.js +2 -15
- package/dist/cjs/plugins/table/pm-plugins/main.js +20 -72
- package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +25 -42
- package/dist/cjs/plugins/table/pm-plugins/plugin-key.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -8
- package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +4 -23
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/commands.js +0 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/index.js +0 -5
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -13
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +56 -138
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-key.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -30
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +0 -6
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/util.js +0 -5
- package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +13 -44
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +12 -42
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -52
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/index.js +0 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -10
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-key.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin.js +5 -19
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +0 -10
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -15
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -28
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/content-width.js +3 -23
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -46
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/index.js +0 -9
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +15 -36
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-column.js +1 -4
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -71
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -82
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -36
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/unit-to-number.js +0 -2
- package/dist/cjs/plugins/table/pm-plugins/table-selection-keymap.js +0 -5
- package/dist/cjs/plugins/table/reducer.js +0 -24
- package/dist/cjs/plugins/table/toolbar.js +14 -94
- package/dist/cjs/plugins/table/transforms/column-width.js +12 -45
- package/dist/cjs/plugins/table/transforms/delete-columns.js +11 -76
- package/dist/cjs/plugins/table/transforms/delete-rows.js +4 -42
- package/dist/cjs/plugins/table/transforms/fix-tables.js +24 -61
- package/dist/cjs/plugins/table/transforms/index.js +0 -7
- package/dist/cjs/plugins/table/transforms/merge.js +14 -90
- package/dist/cjs/plugins/table/transforms/metadata.js +0 -5
- package/dist/cjs/plugins/table/transforms/replace-table.js +2 -13
- package/dist/cjs/plugins/table/transforms/split.js +18 -32
- package/dist/cjs/plugins/table/types.js +0 -11
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +10 -51
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/styles.js +0 -12
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -145
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +12 -35
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/styles.js +0 -11
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -12
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -16
- package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +19 -89
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -31
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -22
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +25 -80
- package/dist/cjs/plugins/table/ui/LayoutButton/index.js +16 -64
- package/dist/cjs/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -47
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -48
- package/dist/cjs/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -43
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +33 -74
- package/dist/cjs/plugins/table/ui/common-styles.js +6 -19
- package/dist/cjs/plugins/table/ui/consts.js +3 -8
- package/dist/cjs/plugins/table/ui/messages.js +0 -3
- package/dist/cjs/plugins/table/ui/ui-styles.js +0 -32
- package/dist/cjs/plugins/table/utils/analytics.js +4 -19
- package/dist/cjs/plugins/table/utils/collapse.js +4 -21
- package/dist/cjs/plugins/table/utils/column-controls.js +25 -61
- package/dist/cjs/plugins/table/utils/decoration.js +46 -114
- package/dist/cjs/plugins/table/utils/dom.js +4 -51
- package/dist/cjs/plugins/table/utils/get-allow-add-column-custom-step.js +0 -2
- package/dist/cjs/plugins/table/utils/index.js +0 -10
- package/dist/cjs/plugins/table/utils/nodes.js +5 -48
- package/dist/cjs/plugins/table/utils/paste.js +22 -47
- package/dist/cjs/plugins/table/utils/row-controls.js +6 -67
- package/dist/cjs/plugins/table/utils/selection.js +3 -36
- package/dist/cjs/plugins/table/utils/table.js +0 -11
- package/dist/cjs/plugins/table/utils/update-plugin-state-decorations.js +0 -4
- package/dist/cjs/plugins/table-plugin.js +0 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/commands/clear.js +3 -8
- package/dist/es2019/plugins/table/commands/collapse.js +0 -3
- package/dist/es2019/plugins/table/commands/go-to-next-cell.js +4 -7
- package/dist/es2019/plugins/table/commands/hover.js +7 -17
- package/dist/es2019/plugins/table/commands/insert.js +16 -36
- package/dist/es2019/plugins/table/commands/misc.js +37 -67
- package/dist/es2019/plugins/table/commands/selection.js +7 -62
- package/dist/es2019/plugins/table/commands/sort.js +0 -12
- package/dist/es2019/plugins/table/commands/split-cell.js +0 -4
- package/dist/es2019/plugins/table/commands/toggle.js +13 -15
- package/dist/es2019/plugins/table/commands-with-analytics.js +4 -14
- package/dist/es2019/plugins/table/event-handlers.js +14 -62
- package/dist/es2019/plugins/table/handlers.js +16 -26
- package/dist/es2019/plugins/table/index.js +12 -25
- package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -40
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +27 -100
- package/dist/es2019/plugins/table/nodeviews/table.js +3 -33
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +7 -16
- package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
- package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +0 -5
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +4 -13
- package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +0 -3
- package/dist/es2019/plugins/table/pm-plugins/keymap.js +2 -3
- package/dist/es2019/plugins/table/pm-plugins/main.js +19 -43
- package/dist/es2019/plugins/table/pm-plugins/plugin-factory.js +2 -6
- package/dist/es2019/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
- package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +0 -12
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +55 -130
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -9
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
- package/dist/es2019/plugins/table/pm-plugins/table-local-id.js +20 -39
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +7 -15
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +9 -27
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin.js +2 -5
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/reducer.js +8 -8
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -4
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -11
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/content-width.js +4 -21
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +3 -22
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +10 -18
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +29 -59
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +54 -51
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +9 -14
- package/dist/es2019/plugins/table/reducer.js +26 -30
- package/dist/es2019/plugins/table/toolbar.js +5 -48
- package/dist/es2019/plugins/table/transforms/column-width.js +16 -28
- package/dist/es2019/plugins/table/transforms/delete-columns.js +17 -58
- package/dist/es2019/plugins/table/transforms/delete-rows.js +8 -25
- package/dist/es2019/plugins/table/transforms/fix-tables.js +25 -42
- package/dist/es2019/plugins/table/transforms/merge.js +22 -70
- package/dist/es2019/plugins/table/transforms/metadata.js +3 -2
- package/dist/es2019/plugins/table/transforms/replace-table.js +0 -2
- package/dist/es2019/plugins/table/transforms/split.js +16 -19
- package/dist/es2019/plugins/table/types.js +2 -4
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +2 -16
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +8 -54
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +4 -13
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +0 -2
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +2 -11
- package/dist/es2019/plugins/table/ui/FloatingDeleteButton/index.js +13 -49
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +0 -8
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +16 -24
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +3 -31
- package/dist/es2019/plugins/table/ui/LayoutButton/index.js +2 -29
- package/dist/es2019/plugins/table/ui/TableFloatingControls/CornerControls/index.js +0 -12
- package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +6 -12
- package/dist/es2019/plugins/table/ui/TableFloatingControls/RowControls/index.js +0 -9
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -19
- package/dist/es2019/plugins/table/ui/common-styles.js +6 -5
- package/dist/es2019/plugins/table/ui/consts.js +4 -3
- package/dist/es2019/plugins/table/ui/ui-styles.js +0 -10
- package/dist/es2019/plugins/table/utils/analytics.js +0 -8
- package/dist/es2019/plugins/table/utils/collapse.js +3 -14
- package/dist/es2019/plugins/table/utils/column-controls.js +22 -37
- package/dist/es2019/plugins/table/utils/decoration.js +13 -51
- package/dist/es2019/plugins/table/utils/dom.js +3 -19
- package/dist/es2019/plugins/table/utils/nodes.js +2 -15
- package/dist/es2019/plugins/table/utils/paste.js +17 -22
- package/dist/es2019/plugins/table/utils/row-controls.js +12 -45
- package/dist/es2019/plugins/table/utils/selection.js +0 -21
- package/dist/es2019/plugins/table/utils/table.js +0 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/commands/clear.js +3 -8
- package/dist/esm/plugins/table/commands/collapse.js +0 -3
- package/dist/esm/plugins/table/commands/go-to-next-cell.js +6 -9
- package/dist/esm/plugins/table/commands/hover.js +8 -18
- package/dist/esm/plugins/table/commands/insert.js +16 -36
- package/dist/esm/plugins/table/commands/misc.js +39 -78
- package/dist/esm/plugins/table/commands/selection.js +21 -78
- package/dist/esm/plugins/table/commands/sort.js +2 -14
- package/dist/esm/plugins/table/commands/split-cell.js +3 -8
- package/dist/esm/plugins/table/commands/toggle.js +11 -20
- package/dist/esm/plugins/table/commands-with-analytics.js +50 -85
- package/dist/esm/plugins/table/create-plugin-config.js +0 -3
- package/dist/esm/plugins/table/event-handlers.js +58 -123
- package/dist/esm/plugins/table/handlers.js +11 -29
- package/dist/esm/plugins/table/index.js +47 -60
- package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +8 -44
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +82 -181
- package/dist/esm/plugins/table/nodeviews/table.js +12 -52
- package/dist/esm/plugins/table/nodeviews/tableCell.js +15 -33
- package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +3 -10
- package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +0 -5
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -19
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +8 -13
- package/dist/esm/plugins/table/pm-plugins/decorations/utils/compose-decorations.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/keymap.js +2 -3
- package/dist/esm/plugins/table/pm-plugins/main.js +20 -47
- package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +25 -37
- package/dist/esm/plugins/table/pm-plugins/safari-delayed-dom-selection-syncing-workaround.js +8 -3
- package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +3 -15
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/dom.js +4 -9
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +58 -147
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin-state.js +15 -27
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/util.js +0 -3
- package/dist/esm/plugins/table/pm-plugins/table-local-id.js +14 -37
- package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +12 -24
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +16 -36
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +0 -6
- package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin.js +5 -8
- package/dist/esm/plugins/table/pm-plugins/table-resizing/reducer.js +0 -7
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +0 -4
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/column-state.js +8 -12
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/content-width.js +5 -22
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +4 -23
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +15 -23
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +15 -60
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +34 -55
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +12 -24
- package/dist/esm/plugins/table/reducer.js +0 -20
- package/dist/esm/plugins/table/toolbar.js +13 -63
- package/dist/esm/plugins/table/transforms/column-width.js +12 -32
- package/dist/esm/plugins/table/transforms/delete-columns.js +11 -62
- package/dist/esm/plugins/table/transforms/delete-rows.js +4 -30
- package/dist/esm/plugins/table/transforms/fix-tables.js +24 -49
- package/dist/esm/plugins/table/transforms/merge.js +16 -75
- package/dist/esm/plugins/table/transforms/metadata.js +3 -2
- package/dist/esm/plugins/table/transforms/replace-table.js +2 -6
- package/dist/esm/plugins/table/transforms/split.js +18 -29
- package/dist/esm/plugins/table/types.js +0 -6
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +10 -31
- package/dist/esm/plugins/table/ui/FloatingContextualButton/styles.js +0 -2
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +46 -126
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +13 -24
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/styles.js +0 -2
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/DeleteButton.js +5 -7
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +3 -13
- package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +19 -68
- package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +6 -14
- package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +5 -18
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +25 -57
- package/dist/esm/plugins/table/ui/LayoutButton/index.js +16 -47
- package/dist/esm/plugins/table/ui/TableFloatingControls/CornerControls/index.js +14 -35
- package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +20 -38
- package/dist/esm/plugins/table/ui/TableFloatingControls/RowControls/index.js +10 -29
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +33 -62
- package/dist/esm/plugins/table/ui/common-styles.js +6 -7
- package/dist/esm/plugins/table/ui/consts.js +4 -3
- package/dist/esm/plugins/table/ui/ui-styles.js +0 -12
- package/dist/esm/plugins/table/utils/analytics.js +4 -13
- package/dist/esm/plugins/table/utils/collapse.js +4 -15
- package/dist/esm/plugins/table/utils/column-controls.js +25 -41
- package/dist/esm/plugins/table/utils/decoration.js +46 -88
- package/dist/esm/plugins/table/utils/dom.js +4 -20
- package/dist/esm/plugins/table/utils/nodes.js +5 -18
- package/dist/esm/plugins/table/utils/paste.js +24 -29
- package/dist/esm/plugins/table/utils/row-controls.js +6 -46
- package/dist/esm/plugins/table/utils/selection.js +3 -26
- package/dist/esm/plugins/table/utils/table.js +0 -2
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
- package/src/__tests__/visual-regression/cell-options-menu.ts +1 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 1.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`4ee60bafc6d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4ee60bafc6d) - ED-16603: Remove tooltips from VR tests and make them opt in. To opt-in, add `allowedSideEffects` when loading the page.
|
|
14
|
+
|
|
3
15
|
## 1.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -11,5 +10,4 @@ Object.defineProperty(exports, "tablesPlugin", {
|
|
|
11
10
|
return _tablePlugin.default;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
|
-
|
|
15
13
|
var _tablePlugin = _interopRequireDefault(require("./plugins/table-plugin"));
|
|
@@ -4,19 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.clearSelection = exports.clearMultipleCells = void 0;
|
|
7
|
-
|
|
8
7
|
var _prosemirrorState = require("prosemirror-state");
|
|
9
|
-
|
|
10
8
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
11
|
-
|
|
12
9
|
// #region Imports
|
|
10
|
+
|
|
13
11
|
// #endregion
|
|
12
|
+
|
|
14
13
|
// #region Commands
|
|
15
14
|
var clearMultipleCells = function clearMultipleCells(targetCellPosition) {
|
|
16
15
|
return function (state, dispatch) {
|
|
17
16
|
var cursorPos;
|
|
18
17
|
var tr = state.tr;
|
|
19
|
-
|
|
20
18
|
if ((0, _utils.isSelectionType)(tr.selection, 'cell')) {
|
|
21
19
|
var selection = tr.selection;
|
|
22
20
|
selection.forEachCell(function (_node, pos) {
|
|
@@ -29,36 +27,26 @@ var clearMultipleCells = function clearMultipleCells(targetCellPosition) {
|
|
|
29
27
|
tr = (0, _utils.emptyCell)(cell, state.schema)(tr);
|
|
30
28
|
cursorPos = cell.pos;
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
if (tr.docChanged && cursorPos) {
|
|
34
31
|
var $pos = tr.doc.resolve(tr.mapping.map(cursorPos));
|
|
35
|
-
|
|
36
32
|
var textSelection = _prosemirrorState.Selection.findFrom($pos, 1, true);
|
|
37
|
-
|
|
38
33
|
if (textSelection) {
|
|
39
34
|
tr.setSelection(textSelection);
|
|
40
35
|
}
|
|
41
|
-
|
|
42
36
|
if (dispatch) {
|
|
43
37
|
dispatch(tr);
|
|
44
38
|
}
|
|
45
|
-
|
|
46
39
|
return true;
|
|
47
40
|
}
|
|
48
|
-
|
|
49
41
|
return false;
|
|
50
42
|
};
|
|
51
43
|
};
|
|
52
|
-
|
|
53
44
|
exports.clearMultipleCells = clearMultipleCells;
|
|
54
|
-
|
|
55
45
|
var clearSelection = function clearSelection(state, dispatch) {
|
|
56
46
|
if (dispatch) {
|
|
57
47
|
dispatch(state.tr.setSelection(_prosemirrorState.Selection.near(state.selection.$from)).setMeta('addToHistory', false));
|
|
58
48
|
}
|
|
59
|
-
|
|
60
49
|
return true;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
};
|
|
51
|
+
// #endregion
|
|
64
52
|
exports.clearSelection = clearSelection;
|
|
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.wrapTableInExpand = void 0;
|
|
7
|
-
|
|
8
7
|
var _collapse = require("../utils/collapse");
|
|
9
|
-
|
|
10
8
|
var wrapTableInExpand = function wrapTableInExpand(state, dispatch) {
|
|
11
9
|
var collapseTr = (0, _collapse.collapseSelectedTable)(state.tr);
|
|
12
|
-
|
|
13
10
|
if (!collapseTr) {
|
|
14
11
|
return false;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
13
|
if (dispatch) {
|
|
18
14
|
dispatch(collapseTr);
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
return true;
|
|
22
17
|
};
|
|
23
|
-
|
|
24
18
|
exports.wrapTableInExpand = wrapTableInExpand;
|
|
@@ -4,48 +4,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.goToNextCell = void 0;
|
|
7
|
-
|
|
8
7
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
9
|
-
|
|
10
8
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
11
|
-
|
|
12
9
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
13
|
-
|
|
14
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
15
|
-
|
|
16
11
|
var _commandsWithAnalytics = require("../commands-with-analytics");
|
|
17
|
-
|
|
18
12
|
// #region Constants
|
|
13
|
+
|
|
19
14
|
var TAB_FORWARD_DIRECTION = 1;
|
|
20
15
|
var TAB_BACKWARD_DIRECTION = -1;
|
|
21
|
-
|
|
22
16
|
var goToNextCell = function goToNextCell(editorAnalyticsAPI) {
|
|
23
17
|
return function (direction) {
|
|
24
18
|
return function (state, dispatch) {
|
|
25
19
|
var table = (0, _utils.findTable)(state.selection);
|
|
26
|
-
|
|
27
20
|
if (!table) {
|
|
28
21
|
return false;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
var map = _tableMap.TableMap.get(table.node);
|
|
32
|
-
|
|
33
24
|
var _state$schema$nodes = state.schema.nodes,
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
tableCell = _state$schema$nodes.tableCell,
|
|
26
|
+
tableHeader = _state$schema$nodes.tableHeader;
|
|
36
27
|
var cell = (0, _prosemirrorUtils.findParentNodeOfType)([tableCell, tableHeader])(state.selection);
|
|
37
28
|
var firstCellPos = map.positionAt(0, 0, table.node) + table.start;
|
|
38
|
-
var lastCellPos = map.positionAt(map.height - 1, map.width - 1, table.node) + table.start;
|
|
29
|
+
var lastCellPos = map.positionAt(map.height - 1, map.width - 1, table.node) + table.start;
|
|
39
30
|
|
|
31
|
+
// when tabbing backwards at first cell (top left), insert row at the start of table
|
|
40
32
|
if (firstCellPos === cell.pos && direction === TAB_BACKWARD_DIRECTION) {
|
|
41
33
|
(0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, {
|
|
42
34
|
index: 0,
|
|
43
35
|
moveCursorToInsertedRow: true
|
|
44
36
|
})(state, dispatch);
|
|
45
37
|
return true;
|
|
46
|
-
}
|
|
47
|
-
|
|
38
|
+
}
|
|
48
39
|
|
|
40
|
+
// when tabbing forwards at last cell (bottom right), insert row at the end of table
|
|
49
41
|
if (lastCellPos === cell.pos && direction === TAB_FORWARD_DIRECTION) {
|
|
50
42
|
(0, _commandsWithAnalytics.insertRowWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD, {
|
|
51
43
|
index: map.height,
|
|
@@ -53,14 +45,11 @@ var goToNextCell = function goToNextCell(editorAnalyticsAPI) {
|
|
|
53
45
|
})(state, dispatch);
|
|
54
46
|
return true;
|
|
55
47
|
}
|
|
56
|
-
|
|
57
48
|
if (dispatch) {
|
|
58
49
|
return (0, _utils.goToNextCell)(direction)(state, dispatch);
|
|
59
50
|
}
|
|
60
|
-
|
|
61
51
|
return true;
|
|
62
52
|
};
|
|
63
53
|
};
|
|
64
54
|
};
|
|
65
|
-
|
|
66
55
|
exports.goToNextCell = goToNextCell;
|
|
@@ -4,40 +4,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.showResizeHandleLine = exports.hoverTable = exports.hoverRows = exports.hoverMergedCells = exports.hoverColumns = exports.hideResizeHandleLine = exports.clearHoverSelection = void 0;
|
|
7
|
-
|
|
8
7
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
9
|
-
|
|
10
8
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
11
|
-
|
|
12
9
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
13
|
-
|
|
14
10
|
var _types = require("../types");
|
|
15
|
-
|
|
16
11
|
var _utils2 = require("../utils");
|
|
17
|
-
|
|
18
12
|
// #region Imports
|
|
13
|
+
|
|
19
14
|
// #endregion
|
|
15
|
+
|
|
20
16
|
// #region Utils
|
|
21
17
|
var makeArray = function makeArray(n) {
|
|
22
18
|
return Array.from(Array(n).keys());
|
|
23
|
-
};
|
|
24
|
-
// #
|
|
25
|
-
|
|
19
|
+
};
|
|
20
|
+
// #endregion
|
|
26
21
|
|
|
22
|
+
// #region Commands
|
|
27
23
|
var hoverMergedCells = function hoverMergedCells() {
|
|
28
24
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
29
25
|
var mergedCellsPositions = (0, _utils2.getMergedCellsPositions)(state.tr);
|
|
30
|
-
|
|
31
26
|
if (!mergedCellsPositions.length) {
|
|
32
27
|
return false;
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
var table = (0, _utils.findTable)(state.tr.selection);
|
|
36
|
-
|
|
37
30
|
if (!table) {
|
|
38
31
|
return false;
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
var mergedCells = mergedCellsPositions.map(function (pos) {
|
|
42
34
|
return {
|
|
43
35
|
pos: pos + table.start,
|
|
@@ -56,17 +48,13 @@ var hoverMergedCells = function hoverMergedCells() {
|
|
|
56
48
|
return tr.setMeta('addToHistory', false);
|
|
57
49
|
});
|
|
58
50
|
};
|
|
59
|
-
|
|
60
51
|
exports.hoverMergedCells = hoverMergedCells;
|
|
61
|
-
|
|
62
52
|
var hoverColumns = function hoverColumns(hoveredColumns, isInDanger) {
|
|
63
53
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
64
54
|
var cells = (0, _utils.getCellsInColumn)(hoveredColumns)(state.tr.selection);
|
|
65
|
-
|
|
66
55
|
if (!cells) {
|
|
67
56
|
return false;
|
|
68
57
|
}
|
|
69
|
-
|
|
70
58
|
var decorations = (0, _utils2.createControlsHoverDecoration)(cells, 'column', state.tr, isInDanger);
|
|
71
59
|
return {
|
|
72
60
|
type: 'HOVER_COLUMNS',
|
|
@@ -80,17 +68,13 @@ var hoverColumns = function hoverColumns(hoveredColumns, isInDanger) {
|
|
|
80
68
|
return tr.setMeta('addToHistory', false);
|
|
81
69
|
});
|
|
82
70
|
};
|
|
83
|
-
|
|
84
71
|
exports.hoverColumns = hoverColumns;
|
|
85
|
-
|
|
86
72
|
var hoverRows = function hoverRows(hoveredRows, isInDanger) {
|
|
87
73
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
88
74
|
var cells = (0, _utils.getCellsInRow)(hoveredRows)(state.selection);
|
|
89
|
-
|
|
90
75
|
if (!cells) {
|
|
91
76
|
return false;
|
|
92
77
|
}
|
|
93
|
-
|
|
94
78
|
var decorations = (0, _utils2.createControlsHoverDecoration)(cells, 'row', state.tr, isInDanger);
|
|
95
79
|
return {
|
|
96
80
|
type: 'HOVER_ROWS',
|
|
@@ -104,27 +88,20 @@ var hoverRows = function hoverRows(hoveredRows, isInDanger) {
|
|
|
104
88
|
return tr.setMeta('addToHistory', false);
|
|
105
89
|
});
|
|
106
90
|
};
|
|
107
|
-
|
|
108
91
|
exports.hoverRows = hoverRows;
|
|
109
|
-
|
|
110
92
|
var hoverTable = function hoverTable(isInDanger, isSelected) {
|
|
111
93
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
112
94
|
var table = (0, _utils.findTable)(state.selection);
|
|
113
|
-
|
|
114
95
|
if (!table) {
|
|
115
96
|
return false;
|
|
116
97
|
}
|
|
117
|
-
|
|
118
98
|
var map = _tableMap.TableMap.get(table.node);
|
|
119
|
-
|
|
120
99
|
var hoveredColumns = makeArray(map.width);
|
|
121
100
|
var hoveredRows = makeArray(map.height);
|
|
122
101
|
var cells = (0, _utils.getCellsInRow)(hoveredRows)(state.selection);
|
|
123
|
-
|
|
124
102
|
if (!cells) {
|
|
125
103
|
return false;
|
|
126
104
|
}
|
|
127
|
-
|
|
128
105
|
var decorations = (0, _utils2.createControlsHoverDecoration)(cells, 'table', state.tr, isInDanger, isSelected);
|
|
129
106
|
return {
|
|
130
107
|
type: 'HOVER_TABLE',
|
|
@@ -139,9 +116,7 @@ var hoverTable = function hoverTable(isInDanger, isSelected) {
|
|
|
139
116
|
return tr.setMeta('addToHistory', false);
|
|
140
117
|
});
|
|
141
118
|
};
|
|
142
|
-
|
|
143
119
|
exports.hoverTable = hoverTable;
|
|
144
|
-
|
|
145
120
|
var clearHoverSelection = function clearHoverSelection() {
|
|
146
121
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
147
122
|
return {
|
|
@@ -153,9 +128,7 @@ var clearHoverSelection = function clearHoverSelection() {
|
|
|
153
128
|
};
|
|
154
129
|
});
|
|
155
130
|
};
|
|
156
|
-
|
|
157
131
|
exports.clearHoverSelection = clearHoverSelection;
|
|
158
|
-
|
|
159
132
|
var showResizeHandleLine = function showResizeHandleLine(cellColumnPositioning) {
|
|
160
133
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
161
134
|
return {
|
|
@@ -166,9 +139,7 @@ var showResizeHandleLine = function showResizeHandleLine(cellColumnPositioning)
|
|
|
166
139
|
};
|
|
167
140
|
});
|
|
168
141
|
};
|
|
169
|
-
|
|
170
142
|
exports.showResizeHandleLine = showResizeHandleLine;
|
|
171
|
-
|
|
172
143
|
var hideResizeHandleLine = function hideResizeHandleLine() {
|
|
173
144
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
174
145
|
return {
|
|
@@ -178,7 +149,6 @@ var hideResizeHandleLine = function hideResizeHandleLine() {
|
|
|
178
149
|
}
|
|
179
150
|
};
|
|
180
151
|
});
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
|
|
152
|
+
};
|
|
153
|
+
// #endregion
|
|
184
154
|
exports.hideResizeHandleLine = hideResizeHandleLine;
|
|
@@ -225,19 +225,11 @@ Object.defineProperty(exports, "triggerUnlessTableHeader", {
|
|
|
225
225
|
return _misc.triggerUnlessTableHeader;
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
|
-
|
|
229
228
|
var _hover = require("./hover");
|
|
230
|
-
|
|
231
229
|
var _insert = require("./insert");
|
|
232
|
-
|
|
233
230
|
var _toggle = require("./toggle");
|
|
234
|
-
|
|
235
231
|
var _clear = require("./clear");
|
|
236
|
-
|
|
237
232
|
var _misc = require("./misc");
|
|
238
|
-
|
|
239
233
|
var _sort = require("./sort");
|
|
240
|
-
|
|
241
234
|
var _goToNextCell = require("./go-to-next-cell");
|
|
242
|
-
|
|
243
235
|
var _referentiality = require("./referentiality");
|
|
@@ -6,181 +6,142 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.addColumnAfter = void 0;
|
|
7
7
|
exports.addColumnAt = addColumnAt;
|
|
8
8
|
exports.insertRow = exports.insertColumn = exports.createTable = exports.addColumnBefore = void 0;
|
|
9
|
-
|
|
10
9
|
var _prosemirrorState = require("prosemirror-state");
|
|
11
|
-
|
|
12
10
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
13
|
-
|
|
14
11
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
|
-
|
|
16
12
|
var _prosemirrorUtils = require("prosemirror-utils");
|
|
17
|
-
|
|
18
13
|
var _steps = require("@atlaskit/adf-schema/steps");
|
|
19
|
-
|
|
20
14
|
var _utils2 = require("../utils");
|
|
21
|
-
|
|
22
15
|
var _getAllowAddColumnCustomStep = require("../utils/get-allow-add-column-custom-step");
|
|
23
|
-
|
|
24
16
|
var _columnWidth = require("../transforms/column-width");
|
|
25
|
-
|
|
26
17
|
// #region Imports
|
|
18
|
+
|
|
27
19
|
// #endregion
|
|
20
|
+
|
|
28
21
|
function addColumnAtCustomStep(column) {
|
|
29
22
|
return function (tr) {
|
|
30
23
|
var table = (0, _utils.findTable)(tr.selection);
|
|
31
|
-
|
|
32
24
|
if (table) {
|
|
33
25
|
return tr.step(_steps.AddColumnStep.create(tr.doc, table.pos, column));
|
|
34
26
|
}
|
|
35
|
-
|
|
36
27
|
return tr;
|
|
37
28
|
};
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
function addColumnAt(getEditorContainerWidth) {
|
|
41
31
|
return function (column) {
|
|
42
32
|
var allowAddColumnCustomStep = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
43
33
|
var view = arguments.length > 2 ? arguments[2] : undefined;
|
|
44
34
|
return function (tr) {
|
|
45
35
|
var updatedTr = tr;
|
|
46
|
-
|
|
47
36
|
if (allowAddColumnCustomStep) {
|
|
48
37
|
updatedTr = addColumnAtCustomStep(column)(updatedTr);
|
|
49
38
|
} else {
|
|
50
39
|
updatedTr = (0, _utils.addColumnAt)(column)(updatedTr);
|
|
51
40
|
}
|
|
52
|
-
|
|
53
41
|
var table = (0, _utils.findTable)(updatedTr.selection);
|
|
54
|
-
|
|
55
42
|
if (table) {
|
|
56
43
|
// [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
|
|
57
44
|
updatedTr = (0, _columnWidth.rescaleColumns)(getEditorContainerWidth)(table, view)(updatedTr);
|
|
58
45
|
}
|
|
59
|
-
|
|
60
46
|
return updatedTr;
|
|
61
47
|
};
|
|
62
48
|
};
|
|
63
|
-
}
|
|
64
|
-
// Command to add a column before the column with the selection.
|
|
65
|
-
|
|
49
|
+
}
|
|
66
50
|
|
|
51
|
+
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
52
|
+
// Command to add a column before the column with the selection.
|
|
67
53
|
var addColumnBefore = function addColumnBefore(getEditorContainerWidth) {
|
|
68
54
|
return function (state, dispatch, view) {
|
|
69
55
|
var table = (0, _utils.findTable)(state.selection);
|
|
70
|
-
|
|
71
56
|
if (!table) {
|
|
72
57
|
return false;
|
|
73
58
|
}
|
|
74
|
-
|
|
75
59
|
if (dispatch) {
|
|
76
60
|
var rect = (0, _utils.selectedRect)(state);
|
|
77
61
|
dispatch(addColumnAt(getEditorContainerWidth)(rect.left, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), view)(state.tr));
|
|
78
62
|
}
|
|
79
|
-
|
|
80
63
|
return true;
|
|
81
64
|
};
|
|
82
|
-
};
|
|
83
|
-
// Command to add a column after the column with the selection.
|
|
84
|
-
|
|
65
|
+
};
|
|
85
66
|
|
|
67
|
+
// :: (EditorState, dispatch: ?(tr: Transaction)) → bool
|
|
68
|
+
// Command to add a column after the column with the selection.
|
|
86
69
|
exports.addColumnBefore = addColumnBefore;
|
|
87
|
-
|
|
88
70
|
var addColumnAfter = function addColumnAfter(getEditorContainerWidth) {
|
|
89
71
|
return function (state, dispatch, view) {
|
|
90
72
|
var table = (0, _utils.findTable)(state.selection);
|
|
91
|
-
|
|
92
73
|
if (!table) {
|
|
93
74
|
return false;
|
|
94
75
|
}
|
|
95
|
-
|
|
96
76
|
if (dispatch) {
|
|
97
77
|
var rect = (0, _utils.selectedRect)(state);
|
|
98
78
|
dispatch(addColumnAt(getEditorContainerWidth)(rect.right, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), view)(state.tr));
|
|
99
79
|
}
|
|
100
|
-
|
|
101
80
|
return true;
|
|
102
81
|
};
|
|
103
|
-
};
|
|
104
|
-
|
|
82
|
+
};
|
|
105
83
|
|
|
84
|
+
// #region Commands
|
|
106
85
|
exports.addColumnAfter = addColumnAfter;
|
|
107
|
-
|
|
108
86
|
var insertColumn = function insertColumn(getEditorContainerWidth) {
|
|
109
87
|
return function (column) {
|
|
110
88
|
return function (state, dispatch, view) {
|
|
111
89
|
var tr = addColumnAt(getEditorContainerWidth)(column, (0, _getAllowAddColumnCustomStep.getAllowAddColumnCustomStep)(state), view)(state.tr);
|
|
112
90
|
var table = (0, _utils.findTable)(tr.selection);
|
|
113
|
-
|
|
114
91
|
if (!table) {
|
|
115
92
|
return false;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
93
|
+
}
|
|
94
|
+
// move the cursor to the newly created column
|
|
119
95
|
var pos = _tableMap.TableMap.get(table.node).positionAt(0, column, table.node);
|
|
120
|
-
|
|
121
96
|
if (dispatch) {
|
|
122
97
|
dispatch(tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(table.start + pos))));
|
|
123
98
|
}
|
|
124
|
-
|
|
125
99
|
return true;
|
|
126
100
|
};
|
|
127
101
|
};
|
|
128
102
|
};
|
|
129
|
-
|
|
130
103
|
exports.insertColumn = insertColumn;
|
|
131
|
-
|
|
132
104
|
var insertRow = function insertRow(row, moveCursorToTheNewRow) {
|
|
133
105
|
return function (state, dispatch) {
|
|
134
106
|
// Don't clone the header row
|
|
135
107
|
var headerRowEnabled = (0, _utils2.checkIfHeaderRowEnabled)(state.selection);
|
|
136
|
-
var clonePreviousRow = headerRowEnabled && row > 1 || !headerRowEnabled && row > 0;
|
|
137
|
-
// we should not add row on the position zero
|
|
108
|
+
var clonePreviousRow = headerRowEnabled && row > 1 || !headerRowEnabled && row > 0;
|
|
138
109
|
|
|
110
|
+
// When the table have header row
|
|
111
|
+
// we should not add row on the position zero
|
|
139
112
|
if (row === 0 && headerRowEnabled) {
|
|
140
113
|
return false;
|
|
141
114
|
}
|
|
142
|
-
|
|
143
115
|
var tr = clonePreviousRow ? (0, _utils2.copyPreviousRow)(state.schema)(row)(state.tr) : (0, _utils.addRowAt)(row)(state.tr);
|
|
144
116
|
var table = (0, _utils.findTable)(tr.selection);
|
|
145
|
-
|
|
146
117
|
if (!table) {
|
|
147
118
|
return false;
|
|
148
119
|
}
|
|
149
|
-
|
|
150
120
|
if (dispatch) {
|
|
151
121
|
var selection = state.selection;
|
|
152
|
-
|
|
153
122
|
if (moveCursorToTheNewRow) {
|
|
154
123
|
// move the cursor to the newly created row
|
|
155
124
|
var pos = _tableMap.TableMap.get(table.node).positionAt(row, 0, table.node);
|
|
156
|
-
|
|
157
125
|
tr.setSelection(_prosemirrorState.Selection.near(tr.doc.resolve(table.start + pos)));
|
|
158
126
|
} else {
|
|
159
127
|
tr.setSelection(selection.map(tr.doc, tr.mapping));
|
|
160
128
|
}
|
|
161
|
-
|
|
162
129
|
dispatch(tr);
|
|
163
130
|
}
|
|
164
|
-
|
|
165
131
|
return true;
|
|
166
132
|
};
|
|
167
133
|
};
|
|
168
|
-
|
|
169
134
|
exports.insertRow = insertRow;
|
|
170
|
-
|
|
171
135
|
var createTable = function createTable() {
|
|
172
136
|
return function (state, dispatch) {
|
|
173
137
|
var table = (0, _utils.createTable)({
|
|
174
138
|
schema: state.schema
|
|
175
139
|
});
|
|
176
|
-
|
|
177
140
|
if (dispatch) {
|
|
178
141
|
dispatch((0, _prosemirrorUtils.safeInsert)(table)(state.tr).scrollIntoView());
|
|
179
142
|
}
|
|
180
|
-
|
|
181
143
|
return true;
|
|
182
144
|
};
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
|
|
145
|
+
};
|
|
146
|
+
// #endregion
|
|
186
147
|
exports.createTable = createTable;
|