@atlaskit/editor-plugin-table 1.1.1 → 1.1.3
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 +18 -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 +95 -191
- 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 +18 -43
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +20 -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 +16 -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 +51 -40
- 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 +17 -73
- 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 +58 -49
- 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 +10 -22
- 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 +40 -103
- 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 +14 -17
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +13 -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 +14 -3
- 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 +46 -21
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +31 -61
- 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 +60 -32
- 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 +11 -7
- 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 +95 -184
- 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 +18 -25
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +20 -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 +14 -3
- 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 +49 -26
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +17 -62
- 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 +58 -36
- 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 +9 -10
- 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/dist/types/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +7 -0
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +2 -1
- package/dist/types/plugins/table/ui/common-styles.d.ts +1 -0
- package/package.json +8 -6
- package/src/__tests__/integration/__fixtures__/empty-layout.ts +35 -0
- package/src/__tests__/integration/__fixtures__/nested-in-expand.ts +129 -0
- package/src/__tests__/integration/horizontal-scroll.ts +489 -0
- package/src/__tests__/unit/commands/insert.ts +3 -3
- package/src/__tests__/unit/keymap.ts +3 -1
- package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +38 -0
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +5 -2
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +2 -2
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +2 -2
- package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +2 -2
- package/src/__tests__/visual-regression/sticky-header.ts +2 -1
- package/src/plugins/table/nodeviews/TableComponent.tsx +16 -3
- package/src/plugins/table/pm-plugins/table-resizing/commands.ts +6 -2
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +9 -1
- package/src/plugins/table/pm-plugins/table-resizing/utils/colgroup.ts +19 -1
- package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +57 -5
- package/src/plugins/table/pm-plugins/table-resizing/utils/resize-logic.ts +2 -2
- package/src/plugins/table/transforms/column-width.ts +60 -6
- package/src/plugins/table/ui/common-styles.ts +5 -2
|
@@ -8,11 +8,8 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
10
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
11
|
-
|
|
12
11
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
-
|
|
14
12
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
-
|
|
16
13
|
import React from 'react';
|
|
17
14
|
import { DOMSerializer } from 'prosemirror-model';
|
|
18
15
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
@@ -24,7 +21,6 @@ import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizin
|
|
|
24
21
|
import { generateColgroup } from '../pm-plugins/table-resizing/utils';
|
|
25
22
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
26
23
|
import TableComponent from './TableComponent';
|
|
27
|
-
|
|
28
24
|
var tableAttributes = function tableAttributes(node) {
|
|
29
25
|
return {
|
|
30
26
|
'data-number-column': node.attrs.isNumberColumnEnabled,
|
|
@@ -33,61 +29,45 @@ var tableAttributes = function tableAttributes(node) {
|
|
|
33
29
|
'data-table-local-id': node.attrs.localId || ''
|
|
34
30
|
};
|
|
35
31
|
};
|
|
36
|
-
|
|
37
32
|
var toDOM = function toDOM(node, props) {
|
|
38
33
|
var colgroup = '';
|
|
39
|
-
|
|
40
34
|
if (props.allowColumnResizing) {
|
|
41
35
|
colgroup = ['colgroup', {}].concat(_toConsumableArray(generateColgroup(node)));
|
|
42
36
|
}
|
|
43
|
-
|
|
44
37
|
return ['table', tableAttributes(node), colgroup, ['tbody', 0]];
|
|
45
38
|
};
|
|
46
|
-
|
|
47
39
|
var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
48
40
|
_inherits(TableView, _ReactNodeView);
|
|
49
|
-
|
|
50
41
|
var _super = _createSuper(TableView);
|
|
51
|
-
|
|
52
42
|
function TableView(props) {
|
|
53
43
|
var _this;
|
|
54
|
-
|
|
55
44
|
_classCallCheck(this, TableView);
|
|
56
|
-
|
|
57
45
|
_this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props, undefined, undefined, undefined, props.hasIntlContext);
|
|
58
|
-
|
|
59
46
|
_defineProperty(_assertThisInitialized(_this), "getNode", function () {
|
|
60
47
|
return _this.node;
|
|
61
48
|
});
|
|
62
|
-
|
|
63
49
|
_defineProperty(_assertThisInitialized(_this), "hasHoveredRows", false);
|
|
64
|
-
|
|
65
50
|
_this.getPos = props.getPos;
|
|
66
51
|
_this.tableRenderOptimization = props.tableRenderOptimization;
|
|
67
52
|
_this.eventDispatcher = props.eventDispatcher;
|
|
68
53
|
return _this;
|
|
69
54
|
}
|
|
70
|
-
|
|
71
55
|
_createClass(TableView, [{
|
|
72
56
|
key: "getContentDOM",
|
|
73
57
|
value: function getContentDOM() {
|
|
74
58
|
var rendered = DOMSerializer.renderSpec(document, toDOM(this.node, this.reactComponentProps));
|
|
75
|
-
|
|
76
59
|
if (rendered.dom) {
|
|
77
60
|
this.table = rendered.dom;
|
|
78
61
|
}
|
|
79
|
-
|
|
80
62
|
return rendered;
|
|
81
63
|
}
|
|
82
64
|
}, {
|
|
83
65
|
key: "setDomAttrs",
|
|
84
66
|
value: function setDomAttrs(node) {
|
|
85
67
|
var _this2 = this;
|
|
86
|
-
|
|
87
68
|
if (!this.table) {
|
|
88
69
|
return;
|
|
89
70
|
}
|
|
90
|
-
|
|
91
71
|
var attrs = tableAttributes(node);
|
|
92
72
|
Object.keys(attrs).forEach(function (attr) {
|
|
93
73
|
_this2.table.setAttribute(attr, attrs[attr]);
|
|
@@ -97,7 +77,6 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
97
77
|
key: "render",
|
|
98
78
|
value: function render(props, forwardRef) {
|
|
99
79
|
var _this3 = this;
|
|
100
|
-
|
|
101
80
|
// TODO: ED-15663
|
|
102
81
|
// Please, do not copy or use this kind of code below
|
|
103
82
|
// @ts-ignore
|
|
@@ -106,10 +85,11 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
106
85
|
getState: function getState(state) {
|
|
107
86
|
return state['widthPlugin$'];
|
|
108
87
|
}
|
|
109
|
-
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// TODO: ED-15663
|
|
110
91
|
// Please, do not copy or use this kind of code below
|
|
111
92
|
// @ts-ignore
|
|
112
|
-
|
|
113
93
|
var fakeMediaPluginKey = {
|
|
114
94
|
key: 'mediaPlugin$',
|
|
115
95
|
getState: function getState(state) {
|
|
@@ -126,8 +106,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
126
106
|
editorView: props.view,
|
|
127
107
|
render: function render(pluginStates) {
|
|
128
108
|
var tableResizingPluginState = pluginStates.tableResizingPluginState,
|
|
129
|
-
|
|
130
|
-
|
|
109
|
+
pluginState = pluginStates.pluginState,
|
|
110
|
+
mediaState = pluginStates.mediaState;
|
|
131
111
|
var tableActive = props.getPos() === pluginState.tablePos;
|
|
132
112
|
var containerWidth = props.getEditorContainerWidth();
|
|
133
113
|
return /*#__PURE__*/React.createElement(TableComponent, {
|
|
@@ -156,85 +136,65 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
156
136
|
value: function viewShouldUpdate(nextNode) {
|
|
157
137
|
if (this.tableRenderOptimization) {
|
|
158
138
|
var _getPluginState = getPluginState(this.view.state),
|
|
159
|
-
|
|
160
|
-
|
|
139
|
+
hoveredRows = _getPluginState.hoveredRows;
|
|
161
140
|
var hoveredRowsChanged = !!(hoveredRows !== null && hoveredRows !== void 0 && hoveredRows.length) !== this.hasHoveredRows;
|
|
162
|
-
|
|
163
141
|
if (nextNode.attrs.isNumberColumnEnabled && hoveredRowsChanged) {
|
|
164
142
|
this.hasHoveredRows = !!(hoveredRows !== null && hoveredRows !== void 0 && hoveredRows.length);
|
|
165
143
|
return true;
|
|
166
144
|
}
|
|
167
|
-
|
|
168
145
|
var _node = this.getNode();
|
|
169
|
-
|
|
170
146
|
if (_typeof(_node.attrs) !== _typeof(nextNode.attrs)) {
|
|
171
147
|
return true;
|
|
172
148
|
}
|
|
173
|
-
|
|
174
149
|
var attrKeys = Object.keys(_node.attrs);
|
|
175
150
|
var nextAttrKeys = Object.keys(nextNode.attrs);
|
|
176
|
-
|
|
177
151
|
if (attrKeys.length !== nextAttrKeys.length) {
|
|
178
152
|
return true;
|
|
179
153
|
}
|
|
180
|
-
|
|
181
154
|
var tableMap = TableMap.get(_node);
|
|
182
155
|
var nextTableMap = TableMap.get(nextNode);
|
|
183
|
-
|
|
184
156
|
if (tableMap.width !== nextTableMap.width) {
|
|
185
157
|
return true;
|
|
186
158
|
}
|
|
187
|
-
|
|
188
159
|
return attrKeys.some(function (key) {
|
|
189
160
|
return _node.attrs[key] !== nextNode.attrs[key];
|
|
190
161
|
});
|
|
191
162
|
}
|
|
192
|
-
|
|
193
163
|
return _get(_getPrototypeOf(TableView.prototype), "viewShouldUpdate", this).call(this, nextNode);
|
|
194
164
|
}
|
|
195
165
|
}, {
|
|
196
166
|
key: "ignoreMutation",
|
|
197
167
|
value: function ignoreMutation(mutation) {
|
|
198
168
|
var type = mutation.type,
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
169
|
+
_mutation$target = mutation.target,
|
|
170
|
+
nodeName = _mutation$target.nodeName,
|
|
171
|
+
firstChild = _mutation$target.firstChild;
|
|
203
172
|
if (type === 'selection' && (nodeName === null || nodeName === void 0 ? void 0 : nodeName.toUpperCase()) === 'DIV' && (firstChild === null || firstChild === void 0 ? void 0 : firstChild.nodeName.toUpperCase()) === 'TABLE') {
|
|
204
173
|
return false;
|
|
205
174
|
}
|
|
206
|
-
|
|
207
175
|
return true;
|
|
208
176
|
}
|
|
209
177
|
}, {
|
|
210
178
|
key: "destroy",
|
|
211
179
|
value: function destroy() {
|
|
212
180
|
var _this$eventDispatcher;
|
|
213
|
-
|
|
214
181
|
if (this.resizeObserver) {
|
|
215
182
|
this.resizeObserver.disconnect();
|
|
216
183
|
}
|
|
217
|
-
|
|
218
184
|
(_this$eventDispatcher = this.eventDispatcher) === null || _this$eventDispatcher === void 0 ? void 0 : _this$eventDispatcher.emit('TABLE_DELETED', this.node);
|
|
219
|
-
|
|
220
185
|
_get(_getPrototypeOf(TableView.prototype), "destroy", this).call(this);
|
|
221
186
|
}
|
|
222
187
|
}]);
|
|
223
|
-
|
|
224
188
|
return TableView;
|
|
225
189
|
}(ReactNodeView);
|
|
226
|
-
|
|
227
190
|
export { TableView as default };
|
|
228
191
|
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, options, getEditorContainerWidth, getEditorFeatureFlags) {
|
|
229
192
|
var _getPluginState2 = getPluginState(view.state),
|
|
230
|
-
|
|
231
|
-
|
|
193
|
+
pluginConfig = _getPluginState2.pluginConfig;
|
|
232
194
|
var _getPluginConfig = getPluginConfig(pluginConfig),
|
|
233
|
-
|
|
234
|
-
|
|
195
|
+
allowColumnResizing = _getPluginConfig.allowColumnResizing;
|
|
235
196
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
236
|
-
|
|
237
|
-
|
|
197
|
+
tableRenderOptimization = _getEditorFeatureFlag.tableRenderOptimization;
|
|
238
198
|
var hasIntlContext = true;
|
|
239
199
|
return new TableView({
|
|
240
200
|
node: node,
|
|
@@ -6,25 +6,19 @@ import { DOMSerializer } from 'prosemirror-model';
|
|
|
6
6
|
import { getCellDomAttrs, getCellAttrs } from '@atlaskit/adf-schema';
|
|
7
7
|
var DEFAULT_COL_SPAN = 1;
|
|
8
8
|
var DEFAULT_ROW_SPAN = 1;
|
|
9
|
-
|
|
10
9
|
var TableCellNodeView = /*#__PURE__*/function () {
|
|
11
10
|
function TableCellNodeView(node, view, getPos, getEditorFeatureFlags, observer) {
|
|
12
11
|
_classCallCheck(this, TableCellNodeView);
|
|
13
|
-
|
|
14
12
|
this.view = view;
|
|
15
13
|
this.node = node;
|
|
16
|
-
|
|
17
14
|
var _DOMSerializer$render = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node)),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
dom = _DOMSerializer$render.dom,
|
|
16
|
+
contentDOM = _DOMSerializer$render.contentDOM;
|
|
21
17
|
this.getPos = getPos;
|
|
22
18
|
this.dom = dom;
|
|
23
19
|
this.contentDOM = contentDOM;
|
|
24
|
-
|
|
25
20
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
mouseMoveOptimization = _getEditorFeatureFlag.mouseMoveOptimization;
|
|
28
22
|
if (mouseMoveOptimization && observer) {
|
|
29
23
|
this.contentDOM.id = uuid();
|
|
30
24
|
this.mouseMoveOptimization = mouseMoveOptimization;
|
|
@@ -32,71 +26,61 @@ var TableCellNodeView = /*#__PURE__*/function () {
|
|
|
32
26
|
observer.observe(this.contentDOM);
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
|
-
|
|
36
29
|
_createClass(TableCellNodeView, [{
|
|
37
30
|
key: "updateNodeView",
|
|
38
31
|
value: function updateNodeView(node) {
|
|
39
32
|
var _this = this;
|
|
40
|
-
|
|
41
33
|
if (this.node.type !== node.type) {
|
|
42
34
|
return false;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
var attrs = getCellDomAttrs(this.node);
|
|
46
37
|
var nextAttrs = getCellDomAttrs(node);
|
|
47
|
-
|
|
48
38
|
var _getCellAttrs = getCellAttrs(this.dom),
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// this can happen when undoing merge cells
|
|
52
|
-
|
|
39
|
+
colspan = _getCellAttrs.colspan,
|
|
40
|
+
rowspan = _getCellAttrs.rowspan;
|
|
53
41
|
|
|
42
|
+
// need to rerender when colspan/rowspan in dom are different from the node attrs
|
|
43
|
+
// this can happen when undoing merge cells
|
|
54
44
|
if (colspan !== (node.attrs.colspan || DEFAULT_COL_SPAN) || rowspan !== (node.attrs.rowspan || DEFAULT_ROW_SPAN)) {
|
|
55
45
|
return false;
|
|
56
|
-
}
|
|
57
|
-
|
|
46
|
+
}
|
|
58
47
|
|
|
48
|
+
// added + changed attributes
|
|
59
49
|
var addedAttrs = Object.entries(nextAttrs).filter(function (_ref) {
|
|
60
50
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
51
|
+
key = _ref2[0],
|
|
52
|
+
value = _ref2[1];
|
|
64
53
|
return attrs[key] !== value;
|
|
65
54
|
});
|
|
66
55
|
var removedAttrs = Object.keys(attrs).filter(function (key) {
|
|
67
56
|
return !nextAttrs.hasOwnProperty(key);
|
|
68
57
|
});
|
|
69
|
-
|
|
70
58
|
if (addedAttrs.length || removedAttrs.length) {
|
|
71
59
|
addedAttrs.forEach(function (_ref3) {
|
|
72
60
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
61
|
+
key = _ref4[0],
|
|
62
|
+
value = _ref4[1];
|
|
76
63
|
return _this.dom.setAttribute(key, value || '');
|
|
77
64
|
});
|
|
78
65
|
removedAttrs.forEach(function (key) {
|
|
79
66
|
return _this.dom.removeAttribute(key);
|
|
80
67
|
});
|
|
81
68
|
return true;
|
|
82
|
-
}
|
|
83
|
-
|
|
69
|
+
}
|
|
84
70
|
|
|
71
|
+
// Return true to not re-render this node view
|
|
85
72
|
if (this.node.sameMarkup(node)) {
|
|
86
73
|
return true;
|
|
87
74
|
}
|
|
88
|
-
|
|
89
75
|
return false;
|
|
90
76
|
}
|
|
91
77
|
}, {
|
|
92
78
|
key: "update",
|
|
93
79
|
value: function update(node) {
|
|
94
80
|
var didUpdate = this.updateNodeView(node);
|
|
95
|
-
|
|
96
81
|
if (didUpdate) {
|
|
97
82
|
this.node = node;
|
|
98
83
|
}
|
|
99
|
-
|
|
100
84
|
return didUpdate;
|
|
101
85
|
}
|
|
102
86
|
}, {
|
|
@@ -107,8 +91,6 @@ var TableCellNodeView = /*#__PURE__*/function () {
|
|
|
107
91
|
}
|
|
108
92
|
}
|
|
109
93
|
}]);
|
|
110
|
-
|
|
111
94
|
return TableCellNodeView;
|
|
112
95
|
}();
|
|
113
|
-
|
|
114
96
|
export { TableCellNodeView as default };
|
|
@@ -8,42 +8,35 @@ export var updateShadowListForStickyStyles = function updateShadowListForStickyS
|
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
|
|
11
12
|
/**
|
|
12
13
|
* Update overflow shadows for a given wrapper & table.
|
|
13
14
|
* if `overflowShadowOptimization` is enabled, this will exit early.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
16
|
export var updateOverflowShadows = function updateOverflowShadows(getEditorFeatureFlags) {
|
|
17
17
|
return function (editorState, wrapper, table, rightShadows, leftShadows) {
|
|
18
18
|
var _getEditorFeatureFlag;
|
|
19
|
-
|
|
20
19
|
if (((_getEditorFeatureFlag = getEditorFeatureFlags()) === null || _getEditorFeatureFlag === void 0 ? void 0 : _getEditorFeatureFlag.tableOverflowShadowsOptimization) === true) {
|
|
21
20
|
return false;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
}
|
|
22
|
+
// Right shadow
|
|
25
23
|
if (table && wrapper) {
|
|
26
24
|
var stickyRow = wrapper.querySelector('tr.sticky');
|
|
27
25
|
var stickyCell = stickyRow && stickyRow.firstElementChild;
|
|
28
|
-
|
|
29
26
|
if (rightShadows) {
|
|
30
27
|
var diff = table.offsetWidth - wrapper.offsetWidth;
|
|
31
|
-
|
|
32
28
|
for (var i = 0; i < rightShadows.length; i++) {
|
|
33
29
|
var rightShadow = rightShadows[i];
|
|
34
30
|
rightShadow.style.display = diff > 0 && diff > wrapper.scrollLeft ? 'block' : 'none';
|
|
35
|
-
|
|
36
31
|
if (rightShadow.classList.contains(ClassName.TABLE_STICKY_SHADOW) && stickyCell) {
|
|
37
32
|
rightShadow.style.height = "".concat(stickyCell.clientHeight + 1, "px");
|
|
38
33
|
}
|
|
39
34
|
}
|
|
40
35
|
}
|
|
41
|
-
|
|
42
36
|
if (leftShadows) {
|
|
43
37
|
for (var _i = 0; _i < leftShadows.length; _i++) {
|
|
44
38
|
var leftShadow = leftShadows[_i];
|
|
45
39
|
leftShadow.style.display = wrapper.scrollLeft > 0 ? 'block' : 'none';
|
|
46
|
-
|
|
47
40
|
if (leftShadow.classList.contains(ClassName.TABLE_STICKY_SHADOW) && stickyCell) {
|
|
48
41
|
leftShadow.style.height = "".concat(stickyCell.clientHeight + 1, "px");
|
|
49
42
|
}
|
|
@@ -16,7 +16,6 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
|
|
|
16
16
|
});
|
|
17
17
|
} else if (tr.selectionSet) {
|
|
18
18
|
var isTransactionFromMouseClick = !tr.docChanged && tr.selectionSet && tr.getMeta('pointer');
|
|
19
|
-
|
|
20
19
|
if (isTransactionFromMouseClick || oldState.selection instanceof CellSelection) {
|
|
21
20
|
return maybeUpdateColumnControlsSelectedDecoration({
|
|
22
21
|
decorationSet: decorationSet,
|
|
@@ -24,7 +23,6 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
|
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
return decorationSet;
|
|
29
27
|
};
|
|
30
28
|
export var createPlugin = function createPlugin() {
|
|
@@ -36,16 +34,13 @@ export var createPlugin = function createPlugin() {
|
|
|
36
34
|
apply: function apply(tr, decorationSet, oldState) {
|
|
37
35
|
var pluginState = decorationSet;
|
|
38
36
|
var meta = tr.getMeta(tablePluginKey);
|
|
39
|
-
|
|
40
37
|
if (meta && meta.data && meta.data.decorationSet) {
|
|
41
38
|
pluginState = meta.data.decorationSet;
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
if (tr.docChanged || tr.selectionSet) {
|
|
45
41
|
pluginState = pluginState.map(tr.mapping, tr.doc);
|
|
46
42
|
return handleDocOrSelectionChanged(tr, pluginState, oldState);
|
|
47
43
|
}
|
|
48
|
-
|
|
49
44
|
return pluginState;
|
|
50
45
|
}
|
|
51
46
|
},
|
|
@@ -3,58 +3,47 @@ import { findTable } from '@atlaskit/editor-tables/utils';
|
|
|
3
3
|
import { TableDecorations } from '../../../types';
|
|
4
4
|
import { createColumnControlsDecoration, createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../../utils/decoration';
|
|
5
5
|
import { composeDecorations } from './compose-decorations';
|
|
6
|
-
|
|
7
6
|
var isColumnSelected = function isColumnSelected(tr) {
|
|
8
7
|
return tr.selection instanceof CellSelection && tr.selection.isColSelection();
|
|
9
|
-
};
|
|
10
|
-
|
|
8
|
+
};
|
|
11
9
|
|
|
10
|
+
// @see: https://product-fabric.atlassian.net/browse/ED-3796
|
|
12
11
|
var removeControlsHoverDecoration = function removeControlsHoverDecoration(_ref) {
|
|
13
12
|
var decorationSet = _ref.decorationSet;
|
|
14
13
|
return decorationSet.remove(findControlsHoverDecoration(decorationSet));
|
|
15
14
|
};
|
|
16
|
-
|
|
17
15
|
var maybeUpdateColumnSelectedDecoration = function maybeUpdateColumnSelectedDecoration(_ref2) {
|
|
18
16
|
var decorationSet = _ref2.decorationSet,
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
tr = _ref2.tr;
|
|
21
18
|
if (!isColumnSelected(tr)) {
|
|
22
19
|
return decorationSet;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
return updateDecorations(tr.doc, decorationSet, createColumnSelectedDecoration(tr), TableDecorations.COLUMN_SELECTED);
|
|
26
22
|
};
|
|
27
|
-
|
|
28
23
|
var maybeUpdateColumnControlsDecoration = function maybeUpdateColumnControlsDecoration(_ref3) {
|
|
29
24
|
var decorationSet = _ref3.decorationSet,
|
|
30
|
-
|
|
25
|
+
tr = _ref3.tr;
|
|
31
26
|
var table = findTable(tr.selection);
|
|
32
|
-
|
|
33
27
|
if (!table) {
|
|
34
28
|
return decorationSet;
|
|
35
29
|
}
|
|
36
|
-
|
|
37
30
|
return updateDecorations(tr.doc, decorationSet, createColumnControlsDecoration(tr.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
|
|
38
|
-
};
|
|
39
|
-
|
|
31
|
+
};
|
|
40
32
|
|
|
33
|
+
// @see: https://product-fabric.atlassian.net/browse/ED-7304
|
|
41
34
|
var removeColumnControlsSelectedDecoration = function removeColumnControlsSelectedDecoration(_ref4) {
|
|
42
35
|
var decorationSet = _ref4.decorationSet;
|
|
43
36
|
return decorationSet.remove(findColumnControlSelectedDecoration(decorationSet));
|
|
44
37
|
};
|
|
45
|
-
|
|
46
38
|
var hasColumnSelectedDecorations = function hasColumnSelectedDecorations(decorationSet) {
|
|
47
39
|
return !!findColumnControlSelectedDecoration(decorationSet).length;
|
|
48
40
|
};
|
|
49
|
-
|
|
50
41
|
export var maybeUpdateColumnControlsSelectedDecoration = function maybeUpdateColumnControlsSelectedDecoration(_ref5) {
|
|
51
42
|
var decorationSet = _ref5.decorationSet,
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
tr = _ref5.tr;
|
|
54
44
|
if (!hasColumnSelectedDecorations(decorationSet)) {
|
|
55
45
|
return decorationSet;
|
|
56
46
|
}
|
|
57
|
-
|
|
58
47
|
return removeColumnControlsSelectedDecoration({
|
|
59
48
|
decorationSet: decorationSet,
|
|
60
49
|
tr: tr
|
|
@@ -62,7 +51,7 @@ export var maybeUpdateColumnControlsSelectedDecoration = function maybeUpdateCol
|
|
|
62
51
|
};
|
|
63
52
|
export var buildColumnControlsDecorations = function buildColumnControlsDecorations(_ref6) {
|
|
64
53
|
var decorationSet = _ref6.decorationSet,
|
|
65
|
-
|
|
54
|
+
tr = _ref6.tr;
|
|
66
55
|
return composeDecorations([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration, maybeUpdateColumnControlsDecoration])({
|
|
67
56
|
decorationSet: decorationSet,
|
|
68
57
|
tr: tr
|
|
@@ -3,35 +3,30 @@ import { TableDecorations } from '../../../types';
|
|
|
3
3
|
import { createResizeHandleDecoration, updateDecorations } from '../../../utils/decoration';
|
|
4
4
|
import { composeDecorations } from './compose-decorations';
|
|
5
5
|
var emptyDecorations = [[], []];
|
|
6
|
-
|
|
7
6
|
var updateColumnResizeHandle = function updateColumnResizeHandle(columnResizesDecorations) {
|
|
8
7
|
return function (_ref) {
|
|
9
8
|
var decorationSet = _ref.decorationSet,
|
|
10
|
-
|
|
9
|
+
tr = _ref.tr;
|
|
11
10
|
return updateDecorations(tr.doc, decorationSet, columnResizesDecorations, TableDecorations.COLUMN_RESIZING_HANDLE);
|
|
12
11
|
};
|
|
13
12
|
};
|
|
14
|
-
|
|
15
13
|
var updateLastCellElement = function updateLastCellElement(lastCellElementsDecorations) {
|
|
16
14
|
return function (_ref2) {
|
|
17
15
|
var decorationSet = _ref2.decorationSet,
|
|
18
|
-
|
|
16
|
+
tr = _ref2.tr;
|
|
19
17
|
return updateDecorations(tr.doc, decorationSet, lastCellElementsDecorations, TableDecorations.LAST_CELL_ELEMENT);
|
|
20
18
|
};
|
|
21
19
|
};
|
|
22
|
-
|
|
23
20
|
export var buildColumnResizingDecorations = function buildColumnResizingDecorations(rowEndIndex, columnEndIndex) {
|
|
24
21
|
return function (_ref3) {
|
|
25
22
|
var tr = _ref3.tr,
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
decorationSet = _ref3.decorationSet;
|
|
28
24
|
var _ref4 = columnEndIndex < 0 ? emptyDecorations : createResizeHandleDecoration(tr, rowEndIndex, {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
right: columnEndIndex
|
|
26
|
+
}),
|
|
27
|
+
_ref5 = _slicedToArray(_ref4, 2),
|
|
28
|
+
columnResizesDecorations = _ref5[0],
|
|
29
|
+
lastCellElementsDecorations = _ref5[1];
|
|
35
30
|
return composeDecorations([updateColumnResizeHandle(columnResizesDecorations), updateLastCellElement(lastCellElementsDecorations)])({
|
|
36
31
|
decorationSet: decorationSet,
|
|
37
32
|
tr: tr
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export var composeDecorations = function composeDecorations(transformers) {
|
|
2
2
|
return function (_ref) {
|
|
3
3
|
var decorationSet = _ref.decorationSet,
|
|
4
|
-
|
|
4
|
+
tr = _ref.tr;
|
|
5
5
|
return transformers.reduce(function (decorationSet, transform) {
|
|
6
6
|
return transform({
|
|
7
7
|
decorationSet: decorationSet,
|
|
@@ -6,7 +6,6 @@ import { triggerUnlessTableHeader, createTable, goToNextCell, moveCursorBackward
|
|
|
6
6
|
import { addRowAroundSelection, emptyMultipleCellsWithAnalytics, deleteTableIfSelectedWithAnalytics } from '../commands-with-analytics';
|
|
7
7
|
import { addColumnAfter, addColumnBefore } from '../commands/insert';
|
|
8
8
|
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
9
|
-
|
|
10
9
|
var createTableWithAnalytics = function createTableWithAnalytics(editorAnalyticsAPI) {
|
|
11
10
|
return withEditorAnalyticsAPI({
|
|
12
11
|
action: ACTION.INSERTED,
|
|
@@ -18,15 +17,15 @@ var createTableWithAnalytics = function createTableWithAnalytics(editorAnalytics
|
|
|
18
17
|
eventType: EVENT_TYPE.TRACK
|
|
19
18
|
})(editorAnalyticsAPI)(createTable());
|
|
20
19
|
};
|
|
21
|
-
|
|
22
20
|
export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
|
|
23
21
|
var list = {};
|
|
24
22
|
keymaps.bindKeymapWithCommand(keymaps.nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
|
|
25
23
|
keymaps.bindKeymapWithCommand(keymaps.previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
|
|
26
24
|
keymaps.bindKeymapWithCommand(keymaps.toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
|
|
27
25
|
keymaps.bindKeymapWithCommand(keymaps.backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
|
|
28
|
-
keymaps.bindKeymapWithCommand(keymaps.backspace.common, moveCursorBackward, list);
|
|
26
|
+
keymaps.bindKeymapWithCommand(keymaps.backspace.common, moveCursorBackward, list);
|
|
29
27
|
|
|
28
|
+
// Add row/column shortcuts
|
|
30
29
|
keymaps.bindKeymapWithCommand(keymaps.addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
31
30
|
keymaps.bindKeymapWithCommand(keymaps.addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
32
31
|
keymaps.bindKeymapWithCommand(keymaps.addColumnBefore.common, triggerUnlessTableHeader(addColumnBefore(getEditorContainerWidth)), list);
|