@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
|
@@ -3,17 +3,16 @@ import { Selection } from 'prosemirror-state';
|
|
|
3
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
5
|
import { findTable, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
6
|
-
import { setMeta } from './metadata';
|
|
6
|
+
import { setMeta } from './metadata';
|
|
7
7
|
|
|
8
|
+
// re-creates table node with merged cells
|
|
8
9
|
export function mergeCells(tr) {
|
|
9
10
|
const {
|
|
10
11
|
selection
|
|
11
12
|
} = tr;
|
|
12
|
-
|
|
13
13
|
if (!(selection instanceof CellSelection) || !canMergeCells(tr)) {
|
|
14
14
|
return tr;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
const rect = getSelectionRect(selection);
|
|
18
17
|
const table = findTable(selection);
|
|
19
18
|
const map = TableMap.get(table.node);
|
|
@@ -21,53 +20,45 @@ export function mergeCells(tr) {
|
|
|
21
20
|
const selectedCells = map.cellsInRect(rect);
|
|
22
21
|
let mergedCellPos;
|
|
23
22
|
const rows = [];
|
|
24
|
-
|
|
25
23
|
for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
26
24
|
const rowCells = [];
|
|
27
25
|
const row = table.node.child(rowIndex);
|
|
28
|
-
|
|
29
26
|
for (let colIndex = 0; colIndex < map.width; colIndex++) {
|
|
30
27
|
const cellPos = map.map[rowIndex * map.width + colIndex];
|
|
31
28
|
const cell = table.node.nodeAt(cellPos);
|
|
32
|
-
|
|
33
29
|
if (!cell || seen.indexOf(cellPos) > -1) {
|
|
34
30
|
continue;
|
|
35
31
|
}
|
|
32
|
+
seen.push(cellPos);
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
// merged cell
|
|
39
35
|
if (colIndex === rect.left && rowIndex === rect.top) {
|
|
40
|
-
mergedCellPos = cellPos;
|
|
41
|
-
|
|
36
|
+
mergedCellPos = cellPos;
|
|
37
|
+
// merge content of the selected cells, dropping empty cells
|
|
42
38
|
let content = isEmptyCell(cell) ? Fragment.empty : cell.content;
|
|
43
39
|
const seenContent = [mergedCellPos];
|
|
44
|
-
|
|
45
40
|
for (let i = rect.top; i < rect.bottom; i++) {
|
|
46
41
|
for (let j = rect.left; j < rect.right; j++) {
|
|
47
42
|
const pos = map.map[i * map.width + j];
|
|
48
|
-
|
|
49
43
|
if (seenContent.indexOf(pos) === -1) {
|
|
50
44
|
seenContent.push(pos);
|
|
51
45
|
const copyCell = table.node.nodeAt(pos);
|
|
52
|
-
|
|
53
46
|
if (copyCell && !isEmptyCell(copyCell)) {
|
|
54
47
|
content = content.append(copyCell.content);
|
|
55
48
|
}
|
|
56
49
|
}
|
|
57
50
|
}
|
|
58
51
|
}
|
|
59
|
-
|
|
60
52
|
const rowspan = rect.bottom - rect.top;
|
|
61
|
-
|
|
62
53
|
if (rowspan < 1) {
|
|
63
54
|
return setMeta({
|
|
64
55
|
type: 'MERGE_CELLS',
|
|
65
56
|
problem: 'NEGATIVE_ROWSPAN'
|
|
66
57
|
})(tr);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
}
|
|
59
|
+
// update colspan and rowspan of the merged cell to span the selection
|
|
60
|
+
const attrs = addColSpan({
|
|
61
|
+
...cell.attrs,
|
|
71
62
|
rowspan
|
|
72
63
|
}, cell.attrs.colspan, rect.right - rect.left - cell.attrs.colspan);
|
|
73
64
|
const newCell = content === Fragment.empty ? cell.type.createAndFill(attrs, content, cell.marks) : cell.type.createChecked(attrs, content, cell.marks);
|
|
@@ -78,7 +69,6 @@ export function mergeCells(tr) {
|
|
|
78
69
|
rowCells.push(cell);
|
|
79
70
|
}
|
|
80
71
|
}
|
|
81
|
-
|
|
82
72
|
if (rowCells.length) {
|
|
83
73
|
rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
|
|
84
74
|
} else {
|
|
@@ -87,56 +77,49 @@ export function mergeCells(tr) {
|
|
|
87
77
|
const prevRow = rows[i];
|
|
88
78
|
const cells = [];
|
|
89
79
|
let rowChanged = false;
|
|
90
|
-
|
|
91
80
|
for (let j = 0; j < prevRow.childCount; j++) {
|
|
92
81
|
const cell = prevRow.child(j);
|
|
93
82
|
const {
|
|
94
83
|
rowspan
|
|
95
84
|
} = cell.attrs;
|
|
96
|
-
|
|
97
85
|
if (rowspan && rowspan + i - 1 >= rows.length) {
|
|
98
86
|
rowChanged = true;
|
|
99
|
-
|
|
100
87
|
if (rowspan < 2) {
|
|
101
88
|
return setMeta({
|
|
102
89
|
type: 'MERGE_CELLS',
|
|
103
90
|
problem: 'NEGATIVE_ROWSPAN'
|
|
104
91
|
})(tr);
|
|
105
92
|
}
|
|
106
|
-
|
|
107
|
-
|
|
93
|
+
cells.push(cell.type.createChecked({
|
|
94
|
+
...cell.attrs,
|
|
108
95
|
rowspan: rowspan - 1
|
|
109
96
|
}, cell.content, cell.marks));
|
|
110
97
|
} else {
|
|
111
98
|
cells.push(cell);
|
|
112
99
|
}
|
|
113
100
|
}
|
|
114
|
-
|
|
115
101
|
if (rowChanged) {
|
|
116
102
|
rows[i] = row.type.createChecked(prevRow.attrs, cells, prevRow.marks);
|
|
117
103
|
}
|
|
118
104
|
}
|
|
119
105
|
}
|
|
120
|
-
}
|
|
121
|
-
|
|
106
|
+
}
|
|
122
107
|
|
|
108
|
+
// empty tables? cancel merging like nothing happened
|
|
123
109
|
if (!rows.length) {
|
|
124
110
|
return setMeta({
|
|
125
111
|
type: 'MERGE_CELLS',
|
|
126
112
|
problem: 'EMPTY_TABLE'
|
|
127
113
|
})(tr);
|
|
128
114
|
}
|
|
129
|
-
|
|
130
115
|
const newTable = table.node.type.createChecked(table.node.attrs, rows, table.node.marks);
|
|
131
116
|
const fixedTable = removeEmptyColumns(newTable);
|
|
132
|
-
|
|
133
117
|
if (fixedTable === null) {
|
|
134
118
|
return setMeta({
|
|
135
119
|
type: 'MERGE_CELLS',
|
|
136
120
|
problem: 'REMOVE_EMPTY_COLUMNS'
|
|
137
121
|
})(tr);
|
|
138
122
|
}
|
|
139
|
-
|
|
140
123
|
return setMeta({
|
|
141
124
|
type: 'MERGE_CELLS'
|
|
142
125
|
})(tr.replaceWith(table.pos, table.pos + table.node.nodeSize, fixedTable).setSelection(Selection.near(tr.doc.resolve((mergedCellPos || 0) + table.start))));
|
|
@@ -145,50 +128,39 @@ export function canMergeCells(tr) {
|
|
|
145
128
|
const {
|
|
146
129
|
selection
|
|
147
130
|
} = tr;
|
|
148
|
-
|
|
149
131
|
if (!(selection instanceof CellSelection) || selection.$anchorCell.pos === selection.$headCell.pos) {
|
|
150
132
|
return false;
|
|
151
133
|
}
|
|
152
|
-
|
|
153
134
|
const rect = getSelectionRect(selection);
|
|
154
|
-
|
|
155
135
|
if (!rect) {
|
|
156
136
|
return false;
|
|
157
137
|
}
|
|
158
|
-
|
|
159
138
|
const table = selection.$anchorCell.node(-1);
|
|
160
139
|
const map = TableMap.get(table);
|
|
161
|
-
|
|
162
140
|
if (cellsOverlapRectangle(map, rect)) {
|
|
163
141
|
return false;
|
|
164
142
|
}
|
|
165
|
-
|
|
166
143
|
return true;
|
|
167
144
|
}
|
|
168
|
-
|
|
169
145
|
function isEmptyCell(cell) {
|
|
170
146
|
const {
|
|
171
147
|
content
|
|
172
148
|
} = cell;
|
|
173
149
|
return content.childCount === 1 && content.firstChild && content.firstChild.isTextblock && content.firstChild.childCount === 0;
|
|
174
150
|
}
|
|
175
|
-
|
|
176
151
|
function addColSpan(attrs, pos, span = 1) {
|
|
177
|
-
const newAttrs = {
|
|
152
|
+
const newAttrs = {
|
|
153
|
+
...attrs,
|
|
178
154
|
colspan: (attrs.colspan || 1) + span
|
|
179
155
|
};
|
|
180
|
-
|
|
181
156
|
if (newAttrs.colwidth) {
|
|
182
157
|
newAttrs.colwidth = newAttrs.colwidth.slice();
|
|
183
|
-
|
|
184
158
|
for (let i = 0; i < span; i++) {
|
|
185
159
|
newAttrs.colwidth.splice(pos, 0, 0);
|
|
186
160
|
}
|
|
187
161
|
}
|
|
188
|
-
|
|
189
162
|
return newAttrs;
|
|
190
163
|
}
|
|
191
|
-
|
|
192
164
|
function cellsOverlapRectangle({
|
|
193
165
|
width,
|
|
194
166
|
height,
|
|
@@ -198,33 +170,27 @@ function cellsOverlapRectangle({
|
|
|
198
170
|
let indexLeft = indexTop;
|
|
199
171
|
let indexBottom = (rect.bottom - 1) * width + rect.left;
|
|
200
172
|
let indexRight = indexTop + (rect.right - rect.left - 1);
|
|
201
|
-
|
|
202
173
|
for (let i = rect.top; i < rect.bottom; i++) {
|
|
203
174
|
if (rect.left > 0 && map[indexLeft] === map[indexLeft - 1] || rect.right < width && map[indexRight] === map[indexRight + 1]) {
|
|
204
175
|
return true;
|
|
205
176
|
}
|
|
206
|
-
|
|
207
177
|
indexLeft += width;
|
|
208
178
|
indexRight += width;
|
|
209
179
|
}
|
|
210
|
-
|
|
211
180
|
for (let i = rect.left; i < rect.right; i++) {
|
|
212
181
|
if (rect.top > 0 && map[indexTop] === map[indexTop - width] || rect.bottom < height && map[indexBottom] === map[indexBottom + width]) {
|
|
213
182
|
return true;
|
|
214
183
|
}
|
|
215
|
-
|
|
216
184
|
indexTop++;
|
|
217
185
|
indexBottom++;
|
|
218
186
|
}
|
|
219
|
-
|
|
220
187
|
return false;
|
|
221
|
-
}
|
|
222
|
-
|
|
188
|
+
}
|
|
223
189
|
|
|
190
|
+
// returns an array of numbers, each number indicates the minimum colSpan in each column
|
|
224
191
|
function getMinColSpans(table) {
|
|
225
192
|
const map = TableMap.get(table);
|
|
226
193
|
const minColspans = [];
|
|
227
|
-
|
|
228
194
|
for (let colIndex = map.width - 1; colIndex >= 0; colIndex--) {
|
|
229
195
|
const cellsPositions = map.cellsInRect({
|
|
230
196
|
left: colIndex,
|
|
@@ -232,17 +198,15 @@ function getMinColSpans(table) {
|
|
|
232
198
|
top: 0,
|
|
233
199
|
bottom: map.height
|
|
234
200
|
});
|
|
235
|
-
|
|
236
201
|
if (cellsPositions.length) {
|
|
237
202
|
const colspans = cellsPositions.map(cellPos => {
|
|
238
203
|
const cell = table.nodeAt(cellPos);
|
|
239
|
-
|
|
240
204
|
if (cell) {
|
|
241
205
|
return cell.attrs.colspan;
|
|
242
206
|
}
|
|
243
207
|
});
|
|
244
|
-
const minColspan = Math.min(...colspans);
|
|
245
|
-
|
|
208
|
+
const minColspan = Math.min(...colspans);
|
|
209
|
+
// only care about the case when the next column is invisible
|
|
246
210
|
if (!minColspans[colIndex + 1]) {
|
|
247
211
|
minColspans[colIndex] = minColspan;
|
|
248
212
|
} else {
|
|
@@ -250,42 +214,34 @@ function getMinColSpans(table) {
|
|
|
250
214
|
}
|
|
251
215
|
}
|
|
252
216
|
}
|
|
253
|
-
|
|
254
217
|
return minColspans;
|
|
255
218
|
}
|
|
256
|
-
|
|
257
219
|
export function removeEmptyColumns(table) {
|
|
258
220
|
const map = TableMap.get(table);
|
|
259
221
|
const minColSpans = getMinColSpans(table);
|
|
260
|
-
|
|
261
222
|
if (!minColSpans.some(colspan => colspan > 1)) {
|
|
262
223
|
return table;
|
|
263
224
|
}
|
|
264
|
-
|
|
265
225
|
const rows = [];
|
|
266
|
-
|
|
267
226
|
for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
268
227
|
const cellsByCols = {};
|
|
269
228
|
const cols = Object.keys(minColSpans).map(Number);
|
|
270
|
-
|
|
271
229
|
for (let idx in cols) {
|
|
272
230
|
const colIndex = cols[idx];
|
|
273
231
|
const cellPos = map.map[colIndex + rowIndex * map.width];
|
|
274
232
|
const rect = map.findCell(cellPos);
|
|
275
233
|
const cell = cellsByCols[rect.left] || table.nodeAt(cellPos);
|
|
276
|
-
|
|
277
234
|
if (cell && rect.top === rowIndex) {
|
|
278
235
|
if (minColSpans[colIndex] > 1) {
|
|
279
236
|
const colspan = cell.attrs.colspan - minColSpans[colIndex] + 1;
|
|
280
|
-
|
|
281
237
|
if (colspan < 1) {
|
|
282
238
|
return null;
|
|
283
239
|
}
|
|
284
|
-
|
|
285
240
|
const {
|
|
286
241
|
colwidth
|
|
287
242
|
} = cell.attrs;
|
|
288
|
-
const newCell = cell.type.createChecked({
|
|
243
|
+
const newCell = cell.type.createChecked({
|
|
244
|
+
...cell.attrs,
|
|
289
245
|
colspan,
|
|
290
246
|
colwidth: colwidth ? colwidth.slice(0, colspan) : null
|
|
291
247
|
}, cell.content, cell.marks);
|
|
@@ -295,18 +251,14 @@ export function removeEmptyColumns(table) {
|
|
|
295
251
|
}
|
|
296
252
|
}
|
|
297
253
|
}
|
|
298
|
-
|
|
299
254
|
const rowCells = Object.keys(cellsByCols).map(col => cellsByCols[col]);
|
|
300
255
|
const row = table.child(rowIndex);
|
|
301
|
-
|
|
302
256
|
if (row) {
|
|
303
257
|
rows.push(row.type.createChecked(row.attrs, rowCells, row.marks));
|
|
304
258
|
}
|
|
305
259
|
}
|
|
306
|
-
|
|
307
260
|
if (!rows.length) {
|
|
308
261
|
return null;
|
|
309
262
|
}
|
|
310
|
-
|
|
311
263
|
return table.type.createChecked(table.attrs, rows, table.marks);
|
|
312
264
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { pluginKey } from '../pm-plugins/plugin-key';
|
|
2
|
-
import { fireAnalytics } from './fix-tables';
|
|
2
|
+
import { fireAnalytics } from './fix-tables';
|
|
3
|
+
|
|
4
|
+
// Set metadata on a ProseMirror transaction for debugging purposes in Synchrony
|
|
3
5
|
|
|
4
6
|
export const setMeta = meta => tr => {
|
|
5
7
|
if ('problem' in meta) {
|
|
6
8
|
// Send analytics event whenever we encounter with a problem
|
|
7
9
|
fireAnalytics(meta);
|
|
8
10
|
}
|
|
9
|
-
|
|
10
11
|
return tr.setMeta(pluginKey, meta);
|
|
11
12
|
};
|
|
@@ -6,7 +6,6 @@ import { getSelectedTableInfo } from '../utils';
|
|
|
6
6
|
export const replaceSelectedTable = (state, content, inputMethod, editorAnalyticsAPI) => {
|
|
7
7
|
if (isTableSelected(state.selection)) {
|
|
8
8
|
const table = findTable(state.selection);
|
|
9
|
-
|
|
10
9
|
if (table) {
|
|
11
10
|
const slice = typeof content === 'string' ? new Slice(Fragment.from(state.schema.text(content)), 0, 0) : content;
|
|
12
11
|
let tr = state.tr.replace(table.pos, table.pos + table.node.nodeSize, slice);
|
|
@@ -28,6 +27,5 @@ export const replaceSelectedTable = (state, content, inputMethod, editorAnalytic
|
|
|
28
27
|
return tr;
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
return state.tr;
|
|
33
31
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Helper to split all the cells in a range of columns
|
|
5
4
|
* @param tr
|
|
@@ -10,63 +9,61 @@ import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
|
10
9
|
export function splitCellsInColumns(tr, tablePos, columnStart, columnEnd) {
|
|
11
10
|
let mapStart = tr.mapping.maps.length;
|
|
12
11
|
const table = tr.doc.nodeAt(tablePos);
|
|
13
|
-
|
|
14
12
|
if (!table) {
|
|
15
13
|
return tr;
|
|
16
14
|
}
|
|
17
|
-
|
|
18
15
|
const tableStart = tr.doc.resolve(tablePos).start(1);
|
|
19
16
|
const map = TableMap.get(table);
|
|
20
|
-
|
|
21
17
|
for (let column = columnStart; column < columnEnd; column++) {
|
|
22
18
|
for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
|
|
23
19
|
const cellIndex = rowIndex * map.width + column;
|
|
24
|
-
const cellPos = map.map[cellIndex];
|
|
25
|
-
|
|
26
|
-
const hasMergedCellsBefore = column > 0 && map.map[cellIndex - 1] === cellPos || rowIndex > 0 && map.map[(rowIndex - 1) * map.width + column] === cellPos; // Check if the cell contains another row/column
|
|
20
|
+
const cellPos = map.map[cellIndex];
|
|
27
21
|
|
|
22
|
+
// Check if the cell is contained by another by another row/column
|
|
23
|
+
const hasMergedCellsBefore = column > 0 && map.map[cellIndex - 1] === cellPos || rowIndex > 0 && map.map[(rowIndex - 1) * map.width + column] === cellPos;
|
|
24
|
+
// Check if the cell contains another row/column
|
|
28
25
|
const hasMergedCellsAfter = column < map.width - 1 && map.map[cellIndex + 1] === cellPos || rowIndex < map.height - 1 && map.map[(rowIndex + 1) * map.width + column] === cellPos;
|
|
29
|
-
|
|
30
26
|
if (!hasMergedCellsBefore && hasMergedCellsAfter) {
|
|
31
27
|
// Is a merged cell that start in this row/column
|
|
32
28
|
const cellNode = table.nodeAt(cellPos);
|
|
33
|
-
|
|
34
29
|
if (!cellNode) {
|
|
35
30
|
continue;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
const {
|
|
39
33
|
colwidth,
|
|
40
34
|
colspan = 1,
|
|
41
35
|
rowspan = 1
|
|
42
36
|
} = cellNode.attrs;
|
|
43
|
-
let mapping = tr.mapping.slice(mapStart);
|
|
37
|
+
let mapping = tr.mapping.slice(mapStart);
|
|
44
38
|
|
|
45
|
-
|
|
39
|
+
// Update current node with the simple colspan
|
|
40
|
+
const baseAttrs = {
|
|
41
|
+
...cellNode.attrs,
|
|
46
42
|
colspan: 1,
|
|
47
43
|
rowspan: 1
|
|
48
|
-
};
|
|
49
|
-
|
|
44
|
+
};
|
|
45
|
+
// Add the new cells
|
|
50
46
|
for (let cellRowIndex = rowIndex; cellRowIndex < rowIndex + rowspan; cellRowIndex++) {
|
|
51
47
|
for (let i = 0; i < colspan; i++) {
|
|
52
48
|
let mapping = tr.mapping.slice(mapStart);
|
|
53
49
|
const cellPos = map.positionAt(cellRowIndex, column + i, table);
|
|
54
|
-
tr.insert(mapping.map(cellPos + tableStart), cellNode.type.createAndFill({
|
|
50
|
+
tr.insert(mapping.map(cellPos + tableStart), cellNode.type.createAndFill({
|
|
51
|
+
...baseAttrs,
|
|
55
52
|
colwidth: colwidth ? [colwidth[i]] : undefined
|
|
56
53
|
}));
|
|
57
54
|
}
|
|
58
|
-
}
|
|
59
|
-
|
|
55
|
+
}
|
|
60
56
|
|
|
57
|
+
// Delete the original cell
|
|
61
58
|
mapping = tr.mapping.slice(mapStart);
|
|
62
|
-
tr.delete(mapping.map(cellPos + tableStart), mapping.map(cellPos + tableStart + cellNode.nodeSize));
|
|
59
|
+
tr.delete(mapping.map(cellPos + tableStart), mapping.map(cellPos + tableStart + cellNode.nodeSize));
|
|
63
60
|
|
|
61
|
+
// Skip rows based on rowspan
|
|
64
62
|
if (rowspan && rowspan > 1) {
|
|
65
63
|
rowIndex += rowspan - 1;
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
|
-
|
|
71
68
|
return tr;
|
|
72
69
|
}
|
|
@@ -2,7 +2,6 @@ import { tableCellSelector, tableHeaderSelector, tablePrefixSelector } from '@at
|
|
|
2
2
|
import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
|
|
3
3
|
export const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
|
|
4
4
|
export let TableDecorations;
|
|
5
|
-
|
|
6
5
|
(function (TableDecorations) {
|
|
7
6
|
TableDecorations["ALL_CONTROLS_HOVER"] = "CONTROLS_HOVER";
|
|
8
7
|
TableDecorations["ROW_CONTROLS_HOVER"] = "ROW_CONTROLS_HOVER";
|
|
@@ -15,8 +14,8 @@ export let TableDecorations;
|
|
|
15
14
|
TableDecorations["COLUMN_RESIZING_HANDLE_LINE"] = "COLUMN_RESIZING_HANDLE_LINE";
|
|
16
15
|
TableDecorations["LAST_CELL_ELEMENT"] = "LAST_CELL_ELEMENT";
|
|
17
16
|
})(TableDecorations || (TableDecorations = {}));
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
export const TableCssClassName = {
|
|
18
|
+
...TableSharedCssClassName,
|
|
20
19
|
COLUMN_CONTROLS: `${tablePrefixSelector}-column-controls`,
|
|
21
20
|
COLUMN_CONTROLS_DECORATIONS: `${tablePrefixSelector}-column-controls-decoration`,
|
|
22
21
|
COLUMN_SELECTED: `${tablePrefixSelector}-column__selected`,
|
|
@@ -78,7 +77,6 @@ export const TableCssClassName = { ...TableSharedCssClassName,
|
|
|
78
77
|
WITH_RESIZE_LINE_LAST_COLUMN: `${tablePrefixSelector}-column-resize-line-last-column`
|
|
79
78
|
};
|
|
80
79
|
export let ShadowEvent;
|
|
81
|
-
|
|
82
80
|
(function (ShadowEvent) {
|
|
83
81
|
ShadowEvent["SHOW_BEFORE_SHADOW"] = "showBeforeShadow";
|
|
84
82
|
ShadowEvent["SHOW_AFTER_SHADOW"] = "showAfterShadow";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
/** @jsx jsx */
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { jsx } from '@emotion/react';
|
|
@@ -20,23 +19,21 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
|
20
19
|
export class FloatingContextualButtonInner extends React.Component {
|
|
21
20
|
constructor(...args) {
|
|
22
21
|
super(...args);
|
|
23
|
-
|
|
24
22
|
_defineProperty(this, "handleClick", () => {
|
|
25
23
|
const {
|
|
26
24
|
state,
|
|
27
25
|
dispatch
|
|
28
|
-
} = this.props.editorView;
|
|
26
|
+
} = this.props.editorView;
|
|
27
|
+
// Clicking outside the dropdown handles toggling the menu closed
|
|
29
28
|
// (otherwise these two toggles combat each other).
|
|
30
29
|
// In the event a user clicks the chevron button again
|
|
31
30
|
// That will count as clicking outside the dropdown and
|
|
32
31
|
// will be toggled appropriately
|
|
33
|
-
|
|
34
32
|
if (!this.props.isContextualMenuOpen) {
|
|
35
33
|
toggleContextualMenu()(state, dispatch);
|
|
36
34
|
}
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
|
-
|
|
40
37
|
render() {
|
|
41
38
|
const {
|
|
42
39
|
mountPoint,
|
|
@@ -49,16 +46,13 @@ export class FloatingContextualButtonInner extends React.Component {
|
|
|
49
46
|
},
|
|
50
47
|
dispatchAnalyticsEvent
|
|
51
48
|
} = this.props; // : Props & WrappedComponentProps
|
|
52
|
-
|
|
53
49
|
const domAtPos = editorView.domAtPos.bind(editorView);
|
|
54
50
|
let targetCellRef;
|
|
55
|
-
|
|
56
51
|
try {
|
|
57
52
|
targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
|
|
58
53
|
} catch (error) {
|
|
59
54
|
// eslint-disable-next-line no-console
|
|
60
55
|
console.warn(error);
|
|
61
|
-
|
|
62
56
|
if (dispatchAnalyticsEvent) {
|
|
63
57
|
const payload = {
|
|
64
58
|
action: ACTION.ERRORED,
|
|
@@ -78,11 +72,9 @@ export class FloatingContextualButtonInner extends React.Component {
|
|
|
78
72
|
dispatchAnalyticsEvent(payload);
|
|
79
73
|
}
|
|
80
74
|
}
|
|
81
|
-
|
|
82
75
|
if (!targetCellRef || !(targetCellRef instanceof HTMLElement)) {
|
|
83
76
|
return null;
|
|
84
77
|
}
|
|
85
|
-
|
|
86
78
|
const tableWrapper = closestElement(targetCellRef, `.${ClassName.TABLE_NODE_WRAPPER}`);
|
|
87
79
|
const labelCellOptions = formatMessage(messages.cellOptions);
|
|
88
80
|
const button = jsx("div", {
|
|
@@ -102,7 +94,6 @@ export class FloatingContextualButtonInner extends React.Component {
|
|
|
102
94
|
"aria-label": labelCellOptions
|
|
103
95
|
}));
|
|
104
96
|
const parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
105
|
-
|
|
106
97
|
if (this.props.stickyHeader && parentSticky) {
|
|
107
98
|
const pos = targetCellRef.getBoundingClientRect();
|
|
108
99
|
return jsx("div", {
|
|
@@ -114,7 +105,6 @@ export class FloatingContextualButtonInner extends React.Component {
|
|
|
114
105
|
}
|
|
115
106
|
}, button);
|
|
116
107
|
}
|
|
117
|
-
|
|
118
108
|
return jsx(Popup, {
|
|
119
109
|
alignX: "right",
|
|
120
110
|
alignY: "start",
|
|
@@ -128,15 +118,11 @@ export class FloatingContextualButtonInner extends React.Component {
|
|
|
128
118
|
zIndex: akEditorSmallZIndex
|
|
129
119
|
}, button);
|
|
130
120
|
}
|
|
131
|
-
|
|
132
121
|
shouldComponentUpdate(nextProps) {
|
|
133
122
|
return this.props.tableNode !== nextProps.tableNode || this.props.targetCellPosition !== nextProps.targetCellPosition || this.props.layout !== nextProps.layout || this.props.isContextualMenuOpen !== nextProps.isContextualMenuOpen || this.props.isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || this.props.stickyHeader !== nextProps.stickyHeader;
|
|
134
123
|
}
|
|
135
|
-
|
|
136
124
|
}
|
|
137
|
-
|
|
138
125
|
_defineProperty(FloatingContextualButtonInner, "displayName", 'FloatingContextualButton');
|
|
139
|
-
|
|
140
126
|
const FloatingContextualButton = injectIntl(FloatingContextualButtonInner);
|
|
141
127
|
export default function (props) {
|
|
142
128
|
return jsx(ErrorBoundary, {
|