@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// #region Imports
|
|
2
|
+
|
|
2
3
|
import { findParentNodeOfType } from 'prosemirror-utils';
|
|
3
4
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
4
5
|
import { isTextInput } from '@atlaskit/editor-common/utils';
|
|
@@ -8,59 +9,51 @@ import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing
|
|
|
8
9
|
import { TableSortStep } from '@atlaskit/adf-schema/steps';
|
|
9
10
|
// #endregion
|
|
10
11
|
import { checkIfNumberColumnEnabled, checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled } from './utils/nodes';
|
|
11
|
-
|
|
12
12
|
const nextTableSorting = (tr, table) => {
|
|
13
13
|
const tableSortStep = tr.steps.find(step => step instanceof TableSortStep);
|
|
14
14
|
return tableSortStep && table && table.pos === tableSortStep.pos ? tableSortStep.next : undefined;
|
|
15
15
|
};
|
|
16
|
-
|
|
17
16
|
const nextResizeHandleColumnIndex = (tr, resizeHandleColumnIndex) => {
|
|
18
17
|
if (tr.getMeta(tableResizingPluginKey)) {
|
|
19
18
|
return undefined;
|
|
20
19
|
}
|
|
21
|
-
|
|
22
20
|
return resizeHandleColumnIndex;
|
|
23
21
|
};
|
|
24
|
-
|
|
25
22
|
const updateTargetCellPosition = ({
|
|
26
23
|
tr,
|
|
27
24
|
table
|
|
28
25
|
}) => pluginState => {
|
|
29
26
|
const tableNode = table && table.node;
|
|
30
|
-
|
|
31
27
|
if (!tableNode) {
|
|
32
|
-
return {
|
|
28
|
+
return {
|
|
29
|
+
...pluginState,
|
|
33
30
|
targetCellPosition: undefined
|
|
34
31
|
};
|
|
35
32
|
}
|
|
36
|
-
|
|
37
33
|
const {
|
|
38
34
|
tableCell,
|
|
39
35
|
tableHeader
|
|
40
36
|
} = tr.doc.type.schema.nodes;
|
|
41
37
|
const cell = findParentNodeOfType([tableCell, tableHeader])(tr.selection);
|
|
42
38
|
const targetCellPosition = cell ? cell.pos : undefined;
|
|
43
|
-
|
|
44
39
|
if (pluginState.targetCellPosition === targetCellPosition) {
|
|
45
40
|
return pluginState;
|
|
46
41
|
}
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
return {
|
|
43
|
+
...pluginState,
|
|
49
44
|
targetCellPosition
|
|
50
45
|
};
|
|
51
46
|
};
|
|
52
|
-
|
|
53
47
|
const updateTableNodePluginState = ({
|
|
54
48
|
tr,
|
|
55
49
|
table
|
|
56
50
|
}) => pluginState => {
|
|
57
51
|
const tableNode = table && table.node;
|
|
58
|
-
|
|
59
52
|
if (!tableNode || isTextInput(tr)) {
|
|
60
53
|
return pluginState;
|
|
61
54
|
}
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
return {
|
|
56
|
+
...pluginState,
|
|
64
57
|
...defaultTableSelection,
|
|
65
58
|
tableNode,
|
|
66
59
|
ordering: nextTableSorting(tr, table),
|
|
@@ -70,7 +63,6 @@ const updateTableNodePluginState = ({
|
|
|
70
63
|
isHeaderRowEnabled: checkIfHeaderRowEnabled(tr.selection)
|
|
71
64
|
};
|
|
72
65
|
};
|
|
73
|
-
|
|
74
66
|
const updateCollapseHandler = ({
|
|
75
67
|
tr,
|
|
76
68
|
table
|
|
@@ -80,42 +72,40 @@ const updateCollapseHandler = ({
|
|
|
80
72
|
const allowCollapse = pluginState.pluginConfig.allowCollapse;
|
|
81
73
|
const isExpandInSchema = schema.nodes.expand !== undefined;
|
|
82
74
|
const isCollapseEnabled = allowCollapse && isExpandInSchema;
|
|
75
|
+
|
|
83
76
|
/**
|
|
84
77
|
* If we don't have focus, or collapse isn't allowed, or a table node doesn't
|
|
85
78
|
* exist, we don't need to waste extra checks below
|
|
86
79
|
*/
|
|
87
|
-
|
|
88
80
|
if (!pluginState.editorHasFocus || !isCollapseEnabled || !tableNode) {
|
|
89
81
|
return pluginState;
|
|
90
82
|
}
|
|
91
|
-
|
|
92
83
|
const expandNodeType = schema.nodes.expand;
|
|
93
84
|
const isTableCollapsed = expandNodeType && !!findParentNodeOfType(expandNodeType)(tr.selection);
|
|
94
|
-
const trCanBeCollapsed = isTableCollapsible(tr).tableIsCollapsible;
|
|
85
|
+
const trCanBeCollapsed = isTableCollapsible(tr).tableIsCollapsible;
|
|
95
86
|
|
|
96
|
-
|
|
87
|
+
// We're focused on a table + we're not inside an expand
|
|
88
|
+
const canCollapseTable = !!pluginState.tableNode &&
|
|
89
|
+
// is it already collapsed?
|
|
97
90
|
!isTableCollapsed && !!trCanBeCollapsed;
|
|
98
|
-
|
|
99
91
|
if (pluginState.isTableCollapsed !== isTableCollapsed || pluginState.canCollapseTable !== canCollapseTable) {
|
|
100
|
-
return {
|
|
92
|
+
return {
|
|
93
|
+
...pluginState,
|
|
101
94
|
isTableCollapsed,
|
|
102
95
|
canCollapseTable
|
|
103
96
|
};
|
|
104
97
|
}
|
|
105
|
-
|
|
106
98
|
return pluginState;
|
|
107
99
|
};
|
|
108
|
-
|
|
109
100
|
const buildPluginState = builders => props => pluginState => {
|
|
110
101
|
if (!props.table) {
|
|
111
|
-
return pluginState.targetCellPosition ? {
|
|
102
|
+
return pluginState.targetCellPosition ? {
|
|
103
|
+
...pluginState,
|
|
112
104
|
targetCellPosition: undefined
|
|
113
105
|
} : pluginState;
|
|
114
106
|
}
|
|
115
|
-
|
|
116
107
|
return builders.reduce((_pluginState, transform) => transform(props)(_pluginState), pluginState);
|
|
117
108
|
};
|
|
118
|
-
|
|
119
109
|
export const handleDocOrSelectionChanged = (tr, pluginState) => buildPluginState([updateTargetCellPosition, updateTableNodePluginState, updateCollapseHandler])({
|
|
120
110
|
tr,
|
|
121
111
|
table: findTable(tr.selection)
|
|
@@ -28,37 +28,31 @@ import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
|
28
28
|
import LayoutButton from './ui/LayoutButton';
|
|
29
29
|
import { isLayoutSupported } from './utils';
|
|
30
30
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
31
|
-
|
|
32
31
|
const defaultGetEditorFeatureFlags = () => ({});
|
|
33
|
-
|
|
34
32
|
const tablesPlugin = options => {
|
|
35
33
|
const editorViewRef = {
|
|
36
34
|
current: null
|
|
37
35
|
};
|
|
38
|
-
|
|
39
36
|
const defaultGetEditorContainerWidth = () => {
|
|
40
37
|
if (!editorViewRef.current) {
|
|
41
38
|
var _document, _document$body;
|
|
42
|
-
|
|
43
39
|
return {
|
|
44
40
|
width: ((_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) || 500
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
|
-
|
|
48
43
|
const {
|
|
49
44
|
current: {
|
|
50
45
|
state
|
|
51
46
|
}
|
|
52
|
-
} = editorViewRef;
|
|
47
|
+
} = editorViewRef;
|
|
48
|
+
|
|
49
|
+
// TODO: ED-15663
|
|
53
50
|
// Please, do not copy or use this kind of code below
|
|
54
51
|
// @ts-ignore
|
|
55
|
-
|
|
56
52
|
return state['widthPlugin$'];
|
|
57
53
|
};
|
|
58
|
-
|
|
59
54
|
return {
|
|
60
55
|
name: 'table',
|
|
61
|
-
|
|
62
56
|
nodes() {
|
|
63
57
|
return [{
|
|
64
58
|
name: 'table',
|
|
@@ -74,7 +68,6 @@ const tablesPlugin = options => {
|
|
|
74
68
|
node: tableCell
|
|
75
69
|
}];
|
|
76
70
|
},
|
|
77
|
-
|
|
78
71
|
pmPlugins() {
|
|
79
72
|
const plugins = [{
|
|
80
73
|
name: 'table',
|
|
@@ -115,7 +108,8 @@ const tablesPlugin = options => {
|
|
|
115
108
|
}, {
|
|
116
109
|
name: 'tableEditing',
|
|
117
110
|
plugin: () => createDecorationsPlugin()
|
|
118
|
-
},
|
|
111
|
+
},
|
|
112
|
+
// Needs to be lower priority than editor-tables.tableEditing
|
|
119
113
|
// plugin as it is currently swallowing backspace events inside tables
|
|
120
114
|
{
|
|
121
115
|
name: 'tableKeymap',
|
|
@@ -132,7 +126,6 @@ const tablesPlugin = options => {
|
|
|
132
126
|
reason
|
|
133
127
|
}) => {
|
|
134
128
|
var _options$editorAnalyt;
|
|
135
|
-
|
|
136
129
|
options === null || options === void 0 ? void 0 : (_options$editorAnalyt = options.editorAnalyticsAPI) === null || _options$editorAnalyt === void 0 ? void 0 : _options$editorAnalyt.attachAnalyticsEvent({
|
|
137
130
|
action: TABLE_ACTION.FIXED,
|
|
138
131
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -169,12 +162,14 @@ const tablesPlugin = options => {
|
|
|
169
162
|
}
|
|
170
163
|
});
|
|
171
164
|
}
|
|
172
|
-
}];
|
|
165
|
+
}];
|
|
166
|
+
|
|
167
|
+
// workaround for prosemirrors delayed dom selection syncing during pointer drag
|
|
173
168
|
// causing issues with table selections in Safari
|
|
174
169
|
// https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
|
|
170
|
+
|
|
175
171
|
// NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
|
|
176
172
|
// https://github.com/ProseMirror/prosemirror-view/pull/116
|
|
177
|
-
|
|
178
173
|
if (browser.safari) {
|
|
179
174
|
plugins.push({
|
|
180
175
|
name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
|
|
@@ -182,10 +177,10 @@ const tablesPlugin = options => {
|
|
|
182
177
|
return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
|
|
183
178
|
}
|
|
184
179
|
});
|
|
185
|
-
}
|
|
186
|
-
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
187
|
-
|
|
180
|
+
}
|
|
188
181
|
|
|
182
|
+
// Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
|
|
183
|
+
// https://github.com/ProseMirror/prosemirror/issues/934
|
|
189
184
|
if (browser.safari) {
|
|
190
185
|
plugins.push({
|
|
191
186
|
name: 'tableSafariDeleteCompositionTextIssueWorkaround',
|
|
@@ -194,10 +189,8 @@ const tablesPlugin = options => {
|
|
|
194
189
|
}
|
|
195
190
|
});
|
|
196
191
|
}
|
|
197
|
-
|
|
198
192
|
return plugins;
|
|
199
193
|
},
|
|
200
|
-
|
|
201
194
|
contentComponent({
|
|
202
195
|
editorView,
|
|
203
196
|
popupsMountPoint,
|
|
@@ -301,7 +294,6 @@ const tablesPlugin = options => {
|
|
|
301
294
|
}
|
|
302
295
|
}));
|
|
303
296
|
},
|
|
304
|
-
|
|
305
297
|
pluginsOptions: {
|
|
306
298
|
// TODO: ED-14676 This is not the final API design
|
|
307
299
|
// For now, we are using this on (insert-api/api.ts) but we may create a proper place for it
|
|
@@ -313,7 +305,6 @@ const tablesPlugin = options => {
|
|
|
313
305
|
if (nodeName !== 'table') {
|
|
314
306
|
return null;
|
|
315
307
|
}
|
|
316
|
-
|
|
317
308
|
const table = createTable({
|
|
318
309
|
schema
|
|
319
310
|
});
|
|
@@ -329,10 +320,8 @@ const tablesPlugin = options => {
|
|
|
329
320
|
priority: 600,
|
|
330
321
|
keyshortcut: tooltip(toggleTable),
|
|
331
322
|
icon: () => /*#__PURE__*/React.createElement(IconTable, null),
|
|
332
|
-
|
|
333
323
|
action(insert, state) {
|
|
334
324
|
var _options$editorAnalyt2;
|
|
335
|
-
|
|
336
325
|
const tr = insert(createTable({
|
|
337
326
|
schema: state.schema
|
|
338
327
|
}));
|
|
@@ -347,11 +336,9 @@ const tablesPlugin = options => {
|
|
|
347
336
|
})(tr);
|
|
348
337
|
return tr;
|
|
349
338
|
}
|
|
350
|
-
|
|
351
339
|
}],
|
|
352
340
|
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, options === null || options === void 0 ? void 0 : options.editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, () => editorViewRef.current)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
353
341
|
}
|
|
354
342
|
};
|
|
355
343
|
};
|
|
356
|
-
|
|
357
344
|
export default tablesPlugin;
|
|
@@ -6,48 +6,34 @@ export class OverflowShadowsObserver {
|
|
|
6
6
|
// updateShadowState is a method to update shadow key
|
|
7
7
|
constructor(updateShadowState, _table, wrapper) {
|
|
8
8
|
_defineProperty(this, "firstCell", null);
|
|
9
|
-
|
|
10
9
|
_defineProperty(this, "lastCell", null);
|
|
11
|
-
|
|
12
10
|
_defineProperty(this, "getFirstCell", (isSticky, hasHeaderRow) => {
|
|
13
11
|
var _this$table;
|
|
14
|
-
|
|
15
12
|
return (_this$table = this.table) === null || _this$table === void 0 ? void 0 : _this$table.querySelector(isSticky || !hasHeaderRow ? 'table tbody tr td' : 'table tbody tr th');
|
|
16
13
|
});
|
|
17
|
-
|
|
18
14
|
_defineProperty(this, "getLastCell", (isSticky, hasHeaderRow) => {
|
|
19
15
|
var _this$table2;
|
|
20
|
-
|
|
21
16
|
return (_this$table2 = this.table) === null || _this$table2 === void 0 ? void 0 : _this$table2.querySelector(isSticky || !hasHeaderRow ? 'table tbody tr td:last-child' : 'table tbody tr th:last-child');
|
|
22
17
|
});
|
|
23
|
-
|
|
24
18
|
_defineProperty(this, "isSticky", false);
|
|
25
|
-
|
|
26
19
|
_defineProperty(this, "stickyRowHeight", 0);
|
|
27
|
-
|
|
28
20
|
_defineProperty(this, "init", () => {
|
|
29
21
|
const table = this.table;
|
|
30
|
-
|
|
31
22
|
if (!this.wrapper || !table) {
|
|
32
23
|
return;
|
|
33
24
|
}
|
|
34
|
-
|
|
35
25
|
if (!this.tableIntersectionObserver) {
|
|
36
26
|
const intersectonOnbserverCallback = entry => {
|
|
37
27
|
var _entry$rootBounds, _entry$rootBounds2;
|
|
38
|
-
|
|
39
28
|
if (!((_entry$rootBounds = entry.rootBounds) !== null && _entry$rootBounds !== void 0 && _entry$rootBounds.height) && !((_entry$rootBounds2 = entry.rootBounds) !== null && _entry$rootBounds2 !== void 0 && _entry$rootBounds2.width)) {
|
|
40
29
|
return;
|
|
41
30
|
}
|
|
42
|
-
|
|
43
31
|
if (entry.target !== this.firstCell && entry.target !== this.lastCell) {
|
|
44
32
|
return;
|
|
45
33
|
}
|
|
46
|
-
|
|
47
34
|
this.updateStickyShadowsHeightIfChanged();
|
|
48
35
|
this.checkIntersectionEvent(entry, this.firstCell === entry.target ? ShadowEvent.SHOW_BEFORE_SHADOW : ShadowEvent.SHOW_AFTER_SHADOW);
|
|
49
36
|
};
|
|
50
|
-
|
|
51
37
|
this.tableIntersectionObserver = new IntersectionObserver((entries, _) => {
|
|
52
38
|
entries.forEach(entry => intersectonOnbserverCallback(entry));
|
|
53
39
|
}, {
|
|
@@ -58,102 +44,84 @@ export class OverflowShadowsObserver {
|
|
|
58
44
|
return;
|
|
59
45
|
}
|
|
60
46
|
});
|
|
61
|
-
|
|
62
47
|
_defineProperty(this, "checkIntersectionEvent", (entry, shadowKey) => {
|
|
63
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
// If it's in full view, don't show shadow.
|
|
64
50
|
entry.isIntersecting && entry.intersectionRatio === 1) {
|
|
65
51
|
this.updateShadowState(shadowKey, false);
|
|
66
|
-
} else if (
|
|
52
|
+
} else if (
|
|
53
|
+
// If it's in partial view, show a shadow
|
|
67
54
|
entry.intersectionRatio < 1) {
|
|
68
55
|
this.updateShadowState(shadowKey, true);
|
|
69
56
|
}
|
|
70
57
|
});
|
|
71
|
-
|
|
72
58
|
_defineProperty(this, "observeCells", (isSticky, hasHeaderRow) => {
|
|
73
59
|
const stickyChanged = !!isSticky !== this.isSticky;
|
|
74
|
-
this.isSticky = !!isSticky;
|
|
60
|
+
this.isSticky = !!isSticky;
|
|
75
61
|
|
|
62
|
+
// update sticky shadows
|
|
76
63
|
this.updateStickyShadowsHeightIfChanged();
|
|
77
|
-
|
|
78
64
|
if (!stickyChanged) {
|
|
79
65
|
const firstCell = this.getFirstCell(isSticky, hasHeaderRow);
|
|
80
66
|
const lastCell = this.getLastCell(isSticky, hasHeaderRow);
|
|
81
|
-
|
|
82
67
|
if (!firstCell || !lastCell || firstCell === this.firstCell && lastCell === this.lastCell) {
|
|
83
68
|
return;
|
|
84
69
|
}
|
|
85
70
|
}
|
|
86
|
-
|
|
87
71
|
this.firstCell = this.getFirstCell(isSticky, hasHeaderRow);
|
|
88
72
|
this.lastCell = this.getLastCell(isSticky, hasHeaderRow);
|
|
89
|
-
|
|
90
73
|
if (this.tableIntersectionObserver && this.firstCell && this.lastCell) {
|
|
91
74
|
this.tableIntersectionObserver.disconnect();
|
|
92
75
|
this.tableIntersectionObserver.observe(this.firstCell);
|
|
93
76
|
this.tableIntersectionObserver.observe(this.lastCell);
|
|
94
77
|
}
|
|
95
78
|
});
|
|
96
|
-
|
|
97
79
|
_defineProperty(this, "updateStickyShadows", stickyRowHeight => {
|
|
98
80
|
var _this$wrapper, _this$wrapper2, _this$wrapper2$parent, _this$wrapper3, _this$wrapper3$parent;
|
|
99
|
-
|
|
100
81
|
if (!this.isSticky) {
|
|
101
82
|
return;
|
|
102
83
|
}
|
|
103
|
-
|
|
104
84
|
const stickyCell = this.getStickyCell();
|
|
105
|
-
|
|
106
85
|
if (!stickyCell || !((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement)) {
|
|
107
86
|
return;
|
|
108
87
|
}
|
|
109
|
-
|
|
110
|
-
|
|
88
|
+
const heightStyleOrCompute = `${stickyRowHeight || stickyCell.clientHeight + 1}px`;
|
|
89
|
+
// Use getElementsByClassName here for a live node list to capture
|
|
111
90
|
// sticky shadows
|
|
112
|
-
|
|
113
91
|
const liveRightShadows = (_this$wrapper2 = this.wrapper) === null || _this$wrapper2 === void 0 ? void 0 : (_this$wrapper2$parent = _this$wrapper2.parentElement) === null || _this$wrapper2$parent === void 0 ? void 0 : _this$wrapper2$parent.getElementsByClassName(`${ClassName.TABLE_RIGHT_SHADOW}`);
|
|
114
92
|
const liveLeftShadows = (_this$wrapper3 = this.wrapper) === null || _this$wrapper3 === void 0 ? void 0 : (_this$wrapper3$parent = _this$wrapper3.parentElement) === null || _this$wrapper3$parent === void 0 ? void 0 : _this$wrapper3$parent.getElementsByClassName(`${ClassName.TABLE_LEFT_SHADOW}`);
|
|
115
93
|
updateShadowListForStickyStyles(heightStyleOrCompute, liveLeftShadows);
|
|
116
94
|
updateShadowListForStickyStyles(heightStyleOrCompute, liveRightShadows);
|
|
117
95
|
});
|
|
118
|
-
|
|
119
96
|
this.updateShadowState = updateShadowState;
|
|
120
97
|
this.table = _table;
|
|
121
98
|
this.wrapper = wrapper;
|
|
122
99
|
this.init();
|
|
123
100
|
}
|
|
124
|
-
|
|
125
101
|
updateStickyShadowsHeightIfChanged() {
|
|
126
102
|
if (!this.isSticky) {
|
|
127
103
|
return;
|
|
128
104
|
}
|
|
129
|
-
|
|
130
105
|
const stickyCell = this.getStickyCell();
|
|
131
|
-
|
|
132
106
|
if (!stickyCell) {
|
|
133
107
|
return;
|
|
134
108
|
}
|
|
135
|
-
|
|
136
109
|
const newStickyRowHeight = stickyCell.clientHeight + 1;
|
|
137
|
-
|
|
138
110
|
if (newStickyRowHeight === this.stickyRowHeight) {
|
|
139
111
|
this.stickyRowHeight = newStickyRowHeight;
|
|
140
112
|
this.updateStickyShadows(this.stickyRowHeight);
|
|
141
113
|
}
|
|
142
114
|
}
|
|
143
|
-
|
|
144
115
|
getStickyCell() {
|
|
145
116
|
var _this$wrapper4;
|
|
146
|
-
|
|
147
117
|
const stickyRow = (_this$wrapper4 = this.wrapper) === null || _this$wrapper4 === void 0 ? void 0 : _this$wrapper4.querySelector('tr.sticky');
|
|
148
118
|
const stickyCell = stickyRow && stickyRow.firstElementChild;
|
|
149
119
|
return stickyCell;
|
|
150
120
|
}
|
|
151
|
-
|
|
152
121
|
dispose() {
|
|
153
122
|
if (this.tableIntersectionObserver) {
|
|
154
123
|
this.tableIntersectionObserver.disconnect();
|
|
155
124
|
this.tableIntersectionObserver = undefined;
|
|
156
125
|
}
|
|
157
126
|
}
|
|
158
|
-
|
|
159
127
|
}
|