@atlaskit/editor-plugin-table 10.9.20 → 10.9.21
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 +9 -0
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +91 -78
- package/dist/cjs/nodeviews/TableContainer.js +41 -37
- package/dist/cjs/nodeviews/TableResizer.js +15 -11
- package/dist/cjs/tablePlugin.js +14 -10
- package/dist/cjs/ui/ContentComponent.js +21 -64
- package/dist/cjs/ui/DragHandle/index.js +19 -17
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +14 -11
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +14 -10
- package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +14 -10
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +14 -10
- package/dist/cjs/ui/global-styles.js +14 -10
- package/dist/cjs/ui/icons/SortingIconWrapper.js +14 -11
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +92 -78
- package/dist/es2019/nodeviews/TableContainer.js +44 -39
- package/dist/es2019/nodeviews/TableResizer.js +17 -12
- package/dist/es2019/tablePlugin.js +16 -11
- package/dist/es2019/ui/ContentComponent.js +21 -64
- package/dist/es2019/ui/DragHandle/index.js +21 -18
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +16 -12
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +16 -11
- package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +16 -11
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +16 -11
- package/dist/es2019/ui/global-styles.js +16 -11
- package/dist/es2019/ui/icons/SortingIconWrapper.js +16 -12
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +92 -79
- package/dist/esm/nodeviews/TableContainer.js +42 -38
- package/dist/esm/nodeviews/TableResizer.js +16 -12
- package/dist/esm/tablePlugin.js +15 -11
- package/dist/esm/ui/ContentComponent.js +21 -64
- package/dist/esm/ui/DragHandle/index.js +20 -18
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +15 -12
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +15 -11
- package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +15 -11
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +15 -11
- package/dist/esm/ui/global-styles.js +15 -11
- package/dist/esm/ui/icons/SortingIconWrapper.js +15 -12
- package/package.json +4 -4
- package/src/nodeviews/TableComponentWithSharedState.tsx +97 -125
- package/src/nodeviews/TableContainer.tsx +59 -67
- package/src/nodeviews/TableResizer.tsx +21 -17
- package/src/tablePlugin.tsx +24 -13
- package/src/ui/ContentComponent.tsx +19 -64
- package/src/ui/DragHandle/index.tsx +24 -24
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +21 -14
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +20 -12
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +20 -13
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +20 -13
- package/src/ui/global-styles.tsx +20 -13
- package/src/ui/icons/SortingIconWrapper.tsx +20 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.9.21
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#153302](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/153302)
|
|
8
|
+
[`9fc2b48677873`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9fc2b48677873) -
|
|
9
|
+
Refactor to use sharedPluginStateHookMigratorFactory
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 10.9.20
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -15,6 +15,79 @@ var _TableComponent = _interopRequireDefault(require("./TableComponent"));
|
|
|
15
15
|
// Ignored via go/ees005
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
17
|
|
|
18
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
19
|
+
// tableState
|
|
20
|
+
var isTableResizing = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableResizing');
|
|
21
|
+
var isHeaderColumnEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderColumnEnabled');
|
|
22
|
+
var isHeaderRowEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderRowEnabled');
|
|
23
|
+
var ordering = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'ordering');
|
|
24
|
+
var isResizing = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isResizing');
|
|
25
|
+
var isInDanger = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isInDanger');
|
|
26
|
+
var hoveredCell = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredCell');
|
|
27
|
+
var hoveredRows = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredRows');
|
|
28
|
+
var isTableHovered = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableHovered');
|
|
29
|
+
var isWholeTableInDanger = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isWholeTableInDanger');
|
|
30
|
+
|
|
31
|
+
// mediaState
|
|
32
|
+
var isFullscreen = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.isFullscreen');
|
|
33
|
+
|
|
34
|
+
// selectionState
|
|
35
|
+
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
36
|
+
|
|
37
|
+
// editorViewModeState
|
|
38
|
+
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
|
|
39
|
+
|
|
40
|
+
// widthState
|
|
41
|
+
var width = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.width');
|
|
42
|
+
var lineLength = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.lineLength');
|
|
43
|
+
return {
|
|
44
|
+
tableState: undefined,
|
|
45
|
+
widthState: undefined,
|
|
46
|
+
isTableResizing: isTableResizing,
|
|
47
|
+
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
48
|
+
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
49
|
+
ordering: ordering,
|
|
50
|
+
isResizing: isResizing,
|
|
51
|
+
isInDanger: isInDanger,
|
|
52
|
+
hoveredCell: hoveredCell,
|
|
53
|
+
hoveredRows: hoveredRows,
|
|
54
|
+
isTableHovered: isTableHovered,
|
|
55
|
+
isWholeTableInDanger: isWholeTableInDanger,
|
|
56
|
+
isFullscreen: isFullscreen,
|
|
57
|
+
selection: selection,
|
|
58
|
+
mode: mode,
|
|
59
|
+
width: width,
|
|
60
|
+
lineLength: lineLength
|
|
61
|
+
};
|
|
62
|
+
}, function (api) {
|
|
63
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media', 'selection', 'editorViewMode']),
|
|
64
|
+
widthState = _useSharedPluginState.widthState,
|
|
65
|
+
tableState = _useSharedPluginState.tableState,
|
|
66
|
+
mediaState = _useSharedPluginState.mediaState,
|
|
67
|
+
selectionState = _useSharedPluginState.selectionState,
|
|
68
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
69
|
+
var tableStateInternal = tableState;
|
|
70
|
+
return {
|
|
71
|
+
tableState: tableState,
|
|
72
|
+
widthState: widthState,
|
|
73
|
+
isTableResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableResizing,
|
|
74
|
+
isHeaderColumnEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderColumnEnabled,
|
|
75
|
+
isHeaderRowEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderRowEnabled,
|
|
76
|
+
ordering: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.ordering,
|
|
77
|
+
isResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isResizing,
|
|
78
|
+
isInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isInDanger,
|
|
79
|
+
hoveredCell: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredCell,
|
|
80
|
+
hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows,
|
|
81
|
+
isTableHovered: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableHovered,
|
|
82
|
+
isWholeTableInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isWholeTableInDanger,
|
|
83
|
+
isFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
|
|
84
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
|
|
85
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
86
|
+
width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
|
|
87
|
+
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength
|
|
88
|
+
};
|
|
89
|
+
});
|
|
90
|
+
|
|
18
91
|
/**
|
|
19
92
|
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
20
93
|
*/
|
|
@@ -32,89 +105,29 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
32
105
|
forwardRef = _ref.forwardRef,
|
|
33
106
|
allowTableAlignment = _ref.allowTableAlignment,
|
|
34
107
|
allowTableResizing = _ref.allowTableResizing;
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
54
|
-
});
|
|
55
|
-
var isResizingSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isResizing', {
|
|
56
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
57
|
-
});
|
|
58
|
-
var isInDangerSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isInDanger', {
|
|
59
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
60
|
-
});
|
|
61
|
-
var hoveredCellSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredCell', {
|
|
62
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
63
|
-
});
|
|
64
|
-
var hoveredRowsSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredRows', {
|
|
65
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
66
|
-
});
|
|
67
|
-
var isTableHoveredSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableHovered', {
|
|
68
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
69
|
-
});
|
|
70
|
-
var isWholeTableInDangerSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isWholeTableInDanger', {
|
|
71
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
// mediaState
|
|
75
|
-
var isFullscreenSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'media.isFullscreen', {
|
|
76
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
77
|
-
});
|
|
78
|
-
var isFullscreen = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isFullscreenSelector : mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen;
|
|
79
|
-
|
|
80
|
-
// selectionState
|
|
81
|
-
var selectionSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection', {
|
|
82
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
83
|
-
});
|
|
84
|
-
var selection = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? selectionSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
85
|
-
|
|
86
|
-
// editorViewModeState
|
|
87
|
-
var editorViewModeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode', {
|
|
88
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
89
|
-
});
|
|
90
|
-
var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? editorViewModeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
108
|
+
var _useSharedState = useSharedState(api),
|
|
109
|
+
tableState = _useSharedState.tableState,
|
|
110
|
+
widthState = _useSharedState.widthState,
|
|
111
|
+
mode = _useSharedState.mode,
|
|
112
|
+
hoveredCell = _useSharedState.hoveredCell,
|
|
113
|
+
hoveredRows = _useSharedState.hoveredRows,
|
|
114
|
+
isFullscreen = _useSharedState.isFullscreen,
|
|
115
|
+
isHeaderColumnEnabled = _useSharedState.isHeaderColumnEnabled,
|
|
116
|
+
isHeaderRowEnabled = _useSharedState.isHeaderRowEnabled,
|
|
117
|
+
isInDanger = _useSharedState.isInDanger,
|
|
118
|
+
isResizing = _useSharedState.isResizing,
|
|
119
|
+
isTableHovered = _useSharedState.isTableHovered,
|
|
120
|
+
isTableResizing = _useSharedState.isTableResizing,
|
|
121
|
+
isWholeTableInDanger = _useSharedState.isWholeTableInDanger,
|
|
122
|
+
lineLength = _useSharedState.lineLength,
|
|
123
|
+
ordering = _useSharedState.ordering,
|
|
124
|
+
selection = _useSharedState.selection,
|
|
125
|
+
width = _useSharedState.width;
|
|
91
126
|
var isLivePageViewMode = mode === 'view';
|
|
92
|
-
|
|
93
|
-
// widthState
|
|
94
|
-
var widthSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.width', {
|
|
95
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
96
|
-
});
|
|
97
|
-
var width = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? widthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.width;
|
|
98
|
-
var lineLengthSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'width.lineLength', {
|
|
99
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
100
|
-
});
|
|
101
|
-
var lineLength = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? lineLengthSelector : widthState === null || widthState === void 0 ? void 0 : widthState.lineLength;
|
|
102
127
|
if ((0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false) && !tableState) {
|
|
103
128
|
return null;
|
|
104
129
|
}
|
|
105
130
|
|
|
106
|
-
// tableState
|
|
107
|
-
var isTableResizing = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isTableResizingSelector : tableState.isTableResizing;
|
|
108
|
-
var isHeaderColumnEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isHeaderColumnEnabledSelector : tableState.isHeaderColumnEnabled;
|
|
109
|
-
var isHeaderRowEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isHeaderRowEnabledSelector : tableState.isHeaderRowEnabled;
|
|
110
|
-
var ordering = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? orderingSelector : tableState.ordering;
|
|
111
|
-
var isResizing = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isResizingSelector : tableState.isResizing;
|
|
112
|
-
var isInDanger = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isInDangerSelector : tableState.isInDanger;
|
|
113
|
-
var hoveredCell = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredCellSelector : tableState.hoveredCell;
|
|
114
|
-
var hoveredRows = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredRowsSelector : tableState.hoveredRows;
|
|
115
|
-
var isTableHovered = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isTableHoveredSelector : tableState.isTableHovered;
|
|
116
|
-
var isWholeTableInDanger = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isWholeTableInDangerSelector : tableState.isWholeTableInDanger;
|
|
117
|
-
|
|
118
131
|
/**
|
|
119
132
|
* ED-19810
|
|
120
133
|
* There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
|
|
@@ -44,6 +44,23 @@ var InnerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
44
44
|
"data-testid": "table-container"
|
|
45
45
|
}, children);
|
|
46
46
|
});
|
|
47
|
+
var useAlignmentStableContainerSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
48
|
+
var isFullWidthModeEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.isFullWidthModeEnabled');
|
|
49
|
+
var wasFullWidthModeEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.wasFullWidthModeEnabled');
|
|
50
|
+
return {
|
|
51
|
+
tableState: undefined,
|
|
52
|
+
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
53
|
+
wasFullWidthModeEnabled: wasFullWidthModeEnabled
|
|
54
|
+
};
|
|
55
|
+
}, function (pluginInjectionApi) {
|
|
56
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
|
|
57
|
+
tableState = _useSharedPluginState.tableState;
|
|
58
|
+
return {
|
|
59
|
+
tableState: tableState,
|
|
60
|
+
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
61
|
+
wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled
|
|
62
|
+
};
|
|
63
|
+
});
|
|
47
64
|
var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
48
65
|
var node = _ref2.node,
|
|
49
66
|
children = _ref2.children,
|
|
@@ -51,22 +68,10 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
51
68
|
getPos = _ref2.getPos,
|
|
52
69
|
editorView = _ref2.editorView;
|
|
53
70
|
var alignment = node.attrs.layout !== _alignment.ALIGN_START ? _alignment.ALIGN_CENTER : _alignment.ALIGN_START;
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// isFullWidthModeEnabled
|
|
60
|
-
var isTableFullWidthModeEnabledSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.isFullWidthModeEnabled', {
|
|
61
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
62
|
-
});
|
|
63
|
-
var isFullWidthModeEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isTableFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
64
|
-
|
|
65
|
-
// wasFullWidthModeEnabled
|
|
66
|
-
var wasFullWidthModeEnabledSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.wasFullWidthModeEnabled', {
|
|
67
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
68
|
-
});
|
|
69
|
-
var wasFullWidthModeEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? wasFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled;
|
|
71
|
+
var _useAlignmentStableCo = useAlignmentStableContainerSharedState(pluginInjectionApi),
|
|
72
|
+
tableState = _useAlignmentStableCo.tableState,
|
|
73
|
+
isFullWidthModeEnabled = _useAlignmentStableCo.isFullWidthModeEnabled,
|
|
74
|
+
wasFullWidthModeEnabled = _useAlignmentStableCo.wasFullWidthModeEnabled;
|
|
70
75
|
(0, _react.useEffect)(function () {
|
|
71
76
|
if (!tableState && (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)) {
|
|
72
77
|
return;
|
|
@@ -125,6 +130,22 @@ var AlignmentTableContainerWrapper = function AlignmentTableContainerWrapper(_re
|
|
|
125
130
|
editorView: editorView
|
|
126
131
|
}, children);
|
|
127
132
|
};
|
|
133
|
+
var useResizeableTableContainerSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
134
|
+
var isFullWidthModeEnabled = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.isFullWidthModeEnabled');
|
|
135
|
+
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode');
|
|
136
|
+
return {
|
|
137
|
+
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
138
|
+
mode: mode
|
|
139
|
+
};
|
|
140
|
+
}, function (pluginInjectionApi) {
|
|
141
|
+
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table', 'editorViewMode']),
|
|
142
|
+
tableState = _useSharedPluginState2.tableState,
|
|
143
|
+
editorViewModeState = _useSharedPluginState2.editorViewModeState;
|
|
144
|
+
return {
|
|
145
|
+
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
146
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
147
|
+
};
|
|
148
|
+
});
|
|
128
149
|
var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
129
150
|
var children = _ref4.children,
|
|
130
151
|
className = _ref4.className,
|
|
@@ -149,16 +170,9 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
149
170
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
150
171
|
resizing = _useState2[0],
|
|
151
172
|
setIsResizing = _useState2[1];
|
|
152
|
-
var
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
tableState = _useSharedPluginState2.tableState;
|
|
156
|
-
|
|
157
|
-
// isFullWidthModeEnabled
|
|
158
|
-
var isFullWidthModeEnabledSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.isFullWidthModeEnabled', {
|
|
159
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
160
|
-
});
|
|
161
|
-
var isFullWidthModeEnabled = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? isFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
173
|
+
var _useResizeableTableCo = useResizeableTableContainerSharedState(pluginInjectionApi),
|
|
174
|
+
isFullWidthModeEnabled = _useResizeableTableCo.isFullWidthModeEnabled,
|
|
175
|
+
mode = _useResizeableTableCo.mode;
|
|
162
176
|
var updateContainerHeight = (0, _react.useCallback)(function (height) {
|
|
163
177
|
var _containerRef$current;
|
|
164
178
|
// current StickyHeader State is not stable to be fetch.
|
|
@@ -212,16 +226,6 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
212
226
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
213
227
|
}, [pluginInjectionApi]);
|
|
214
228
|
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
215
|
-
var _useSharedPluginState3 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode'], {
|
|
216
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
217
|
-
}),
|
|
218
|
-
editorViewModeState = _useSharedPluginState3.editorViewModeState;
|
|
219
|
-
|
|
220
|
-
// mode
|
|
221
|
-
var modeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'editorViewMode.mode', {
|
|
222
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
223
|
-
});
|
|
224
|
-
var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
225
229
|
var responsiveContainerWidth = 0;
|
|
226
230
|
var resizeHandleSpacing = 12;
|
|
227
231
|
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
@@ -272,7 +276,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
272
276
|
onResizeStop: onResizeStop,
|
|
273
277
|
isCommentEditor: isCommentEditor
|
|
274
278
|
};
|
|
275
|
-
var isLivePageViewMode =
|
|
279
|
+
var isLivePageViewMode = mode === 'view';
|
|
276
280
|
return /*#__PURE__*/_react.default.createElement(AlignmentTableContainerWrapper, {
|
|
277
281
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
278
282
|
node: node,
|
|
@@ -23,7 +23,6 @@ var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
|
23
23
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
24
24
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
25
25
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
27
26
|
var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
|
|
28
27
|
var _misc = require("../pm-plugins/commands/misc");
|
|
29
28
|
var _tableAnalytics = require("../pm-plugins/table-analytics");
|
|
@@ -106,6 +105,19 @@ var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWi
|
|
|
106
105
|
return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < width + guidelineVisibleAdjustment;
|
|
107
106
|
});
|
|
108
107
|
};
|
|
108
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (pluginInjectionApi) {
|
|
109
|
+
var widthToWidest = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(pluginInjectionApi, 'widthToWidest');
|
|
110
|
+
return {
|
|
111
|
+
widthToWidest: widthToWidest
|
|
112
|
+
};
|
|
113
|
+
}, function (pluginInjectionApi) {
|
|
114
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
|
|
115
|
+
tableState = _useSharedPluginState.tableState;
|
|
116
|
+
var tableStateInternal = tableState;
|
|
117
|
+
return {
|
|
118
|
+
widthToWidest: tableStateInternal.widthToWidest
|
|
119
|
+
};
|
|
120
|
+
});
|
|
109
121
|
var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
110
122
|
var _editorView$state, _pluginInjectionApi$a2;
|
|
111
123
|
var children = _ref.children,
|
|
@@ -137,16 +149,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
137
149
|
var isResizing = (0, _react.useRef)(false);
|
|
138
150
|
var areResizeMetaKeysPressed = (0, _react.useRef)(false);
|
|
139
151
|
var resizerRef = (0, _react.useRef)(null);
|
|
140
|
-
var
|
|
141
|
-
|
|
142
|
-
}),
|
|
143
|
-
tableState = _useSharedPluginState.tableState;
|
|
144
|
-
|
|
145
|
-
// widthToWidest
|
|
146
|
-
var widthToWidestSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(pluginInjectionApi, 'widthToWidest', {
|
|
147
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
148
|
-
});
|
|
149
|
-
var widthToWidest = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? widthToWidestSelector : tableState.widthToWidest;
|
|
152
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
153
|
+
widthToWidest = _useSharedState.widthToWidest;
|
|
150
154
|
|
|
151
155
|
// used to reposition tooltip when table is resizing via keyboard
|
|
152
156
|
var updateTooltip = _react.default.useRef();
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -73,6 +73,18 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
73
73
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
74
74
|
return {};
|
|
75
75
|
};
|
|
76
|
+
var useTableSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
77
|
+
var mode = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode');
|
|
78
|
+
return {
|
|
79
|
+
mode: mode
|
|
80
|
+
};
|
|
81
|
+
}, function (api) {
|
|
82
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']),
|
|
83
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
84
|
+
return {
|
|
85
|
+
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
86
|
+
};
|
|
87
|
+
});
|
|
76
88
|
|
|
77
89
|
/**
|
|
78
90
|
* Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
@@ -687,16 +699,8 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
687
699
|
},
|
|
688
700
|
usePluginHook: function usePluginHook(_ref24) {
|
|
689
701
|
var editorView = _ref24.editorView;
|
|
690
|
-
var
|
|
691
|
-
|
|
692
|
-
}),
|
|
693
|
-
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
694
|
-
|
|
695
|
-
// mode
|
|
696
|
-
var modeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode', {
|
|
697
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
698
|
-
});
|
|
699
|
-
var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
702
|
+
var _useTableSharedState = useTableSharedState(api),
|
|
703
|
+
mode = _useTableSharedState.mode;
|
|
700
704
|
(0, _react.useEffect)(function () {
|
|
701
705
|
var state = editorView.state,
|
|
702
706
|
dispatch = editorView.dispatch;
|
|
@@ -9,7 +9,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
11
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
12
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
12
|
var _FloatingContextualButton = _interopRequireDefault(require("./FloatingContextualButton"));
|
|
14
13
|
var _FloatingContextualMenu = _interopRequireDefault(require("./FloatingContextualMenu"));
|
|
15
14
|
var _FloatingDeleteButton = _interopRequireDefault(require("./FloatingDeleteButton"));
|
|
@@ -35,71 +34,29 @@ var ContentComponentInternal = function ContentComponentInternal(_ref) {
|
|
|
35
34
|
defaultGetEditorFeatureFlags = _ref.defaultGetEditorFeatureFlags;
|
|
36
35
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
37
36
|
var ariaNotifyPlugin = api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify;
|
|
38
|
-
var resizingTableLocalId = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'resizingTableLocalId'
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
});
|
|
56
|
-
var targetCellPosition = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'targetCellPosition', {
|
|
57
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
58
|
-
});
|
|
59
|
-
var isContextualMenuOpen = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isContextualMenuOpen', {
|
|
60
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
61
|
-
});
|
|
62
|
-
var tableRef = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableRef', {
|
|
63
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
64
|
-
});
|
|
65
|
-
var pluginConfig = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'pluginConfig', {
|
|
66
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
67
|
-
});
|
|
68
|
-
var insertColumnButtonIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'insertColumnButtonIndex', {
|
|
69
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
70
|
-
});
|
|
71
|
-
var insertRowButtonIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'insertRowButtonIndex', {
|
|
72
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
73
|
-
});
|
|
74
|
-
var isHeaderColumnEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderColumnEnabled', {
|
|
75
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
76
|
-
});
|
|
77
|
-
var isHeaderRowEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderRowEnabled', {
|
|
78
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
79
|
-
});
|
|
80
|
-
var isDragAndDropEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isDragAndDropEnabled', {
|
|
81
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
82
|
-
});
|
|
83
|
-
var tableWrapperTarget = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableWrapperTarget', {
|
|
84
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
85
|
-
});
|
|
86
|
-
var isCellMenuOpenByKeyboard = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isCellMenuOpenByKeyboard', {
|
|
87
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
88
|
-
});
|
|
37
|
+
var resizingTableLocalId = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'resizingTableLocalId');
|
|
38
|
+
var resizingTableRef = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'resizingTableRef');
|
|
39
|
+
var isTableResizing = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isTableResizing');
|
|
40
|
+
var isResizing = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isResizing');
|
|
41
|
+
var widthToWidest = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'widthToWidest');
|
|
42
|
+
var tableNode = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableNode');
|
|
43
|
+
var targetCellPosition = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'targetCellPosition');
|
|
44
|
+
var isContextualMenuOpen = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isContextualMenuOpen');
|
|
45
|
+
var tableRef = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableRef');
|
|
46
|
+
var pluginConfig = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'pluginConfig');
|
|
47
|
+
var insertColumnButtonIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'insertColumnButtonIndex');
|
|
48
|
+
var insertRowButtonIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'insertRowButtonIndex');
|
|
49
|
+
var isHeaderColumnEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderColumnEnabled');
|
|
50
|
+
var isHeaderRowEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isHeaderRowEnabled');
|
|
51
|
+
var isDragAndDropEnabled = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isDragAndDropEnabled');
|
|
52
|
+
var tableWrapperTarget = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'tableWrapperTarget');
|
|
53
|
+
var isCellMenuOpenByKeyboard = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isCellMenuOpenByKeyboard');
|
|
89
54
|
var _ref2 = pluginConfig !== null && pluginConfig !== void 0 ? pluginConfig : {},
|
|
90
55
|
allowControls = _ref2.allowControls;
|
|
91
|
-
var stickyHeader = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'stickyHeader'
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var
|
|
95
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
96
|
-
});
|
|
97
|
-
var dragMenuIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'dragMenuIndex', {
|
|
98
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
99
|
-
});
|
|
100
|
-
var isDragMenuOpen = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isDragMenuOpen', {
|
|
101
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
102
|
-
});
|
|
56
|
+
var stickyHeader = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'stickyHeader');
|
|
57
|
+
var dragMenuDirection = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'dragMenuDirection');
|
|
58
|
+
var dragMenuIndex = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'dragMenuIndex');
|
|
59
|
+
var isDragMenuOpen = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'isDragMenuOpen');
|
|
103
60
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
|
|
104
61
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
105
62
|
editorView: editorView,
|
|
@@ -19,7 +19,6 @@ var _state = require("@atlaskit/editor-prosemirror/state");
|
|
|
19
19
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
20
20
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
21
21
|
var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
|
|
22
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
23
22
|
var _pluginFactory = require("../../pm-plugins/drag-and-drop/plugin-factory");
|
|
24
23
|
var _pluginFactory2 = require("../../pm-plugins/plugin-factory");
|
|
25
24
|
var _mergedCells = require("../../pm-plugins/utils/merged-cells");
|
|
@@ -255,6 +254,22 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
255
254
|
height: previewHeight
|
|
256
255
|
}), previewContainer));
|
|
257
256
|
};
|
|
257
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
258
|
+
var hoveredColumns = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredColumns');
|
|
259
|
+
var hoveredRows = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredRows');
|
|
260
|
+
return {
|
|
261
|
+
hoveredColumns: hoveredColumns,
|
|
262
|
+
hoveredRows: hoveredRows
|
|
263
|
+
};
|
|
264
|
+
}, function (api) {
|
|
265
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['table']),
|
|
266
|
+
tableState = _useSharedPluginState.tableState;
|
|
267
|
+
var tableStateInternal = tableState;
|
|
268
|
+
return {
|
|
269
|
+
hoveredColumns: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredColumns,
|
|
270
|
+
hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows
|
|
271
|
+
};
|
|
272
|
+
});
|
|
258
273
|
var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedState(_ref5) {
|
|
259
274
|
var isDragMenuTarget = _ref5.isDragMenuTarget,
|
|
260
275
|
tableLocalId = _ref5.tableLocalId,
|
|
@@ -272,22 +287,9 @@ var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedS
|
|
|
272
287
|
editorView = _ref5.editorView,
|
|
273
288
|
intl = _ref5.intl,
|
|
274
289
|
api = _ref5.api;
|
|
275
|
-
var
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
tableState = _ref6.tableState;
|
|
279
|
-
|
|
280
|
-
// hoveredColumns
|
|
281
|
-
var hoveredColumnsSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredColumns', {
|
|
282
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
283
|
-
});
|
|
284
|
-
var hoveredColumns = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredColumnsSelector : tableState === null || tableState === void 0 ? void 0 : tableState.hoveredColumns;
|
|
285
|
-
|
|
286
|
-
// hoveredRows
|
|
287
|
-
var hoveredRowsSelector = (0, _useInternalTablePluginStateSelector.useInternalTablePluginStateSelector)(api, 'hoveredRows', {
|
|
288
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
289
|
-
});
|
|
290
|
-
var hoveredRows = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? hoveredRowsSelector : tableState === null || tableState === void 0 ? void 0 : tableState.hoveredRows;
|
|
290
|
+
var _useSharedState = useSharedState(api),
|
|
291
|
+
hoveredColumns = _useSharedState.hoveredColumns,
|
|
292
|
+
hoveredRows = _useSharedState.hoveredRows;
|
|
291
293
|
return /*#__PURE__*/_react.default.createElement(DragHandleComponent, {
|
|
292
294
|
isDragMenuTarget: isDragMenuTarget,
|
|
293
295
|
tableLocalId: tableLocalId,
|
|
@@ -13,7 +13,6 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
|
13
13
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
14
14
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
17
16
|
var _commands = require("../../../pm-plugins/commands");
|
|
18
17
|
var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
|
|
19
18
|
var _rowControls = require("../../../pm-plugins/utils/row-controls");
|
|
@@ -34,6 +33,18 @@ var getSelectedColumns = function getSelectedColumns(selection) {
|
|
|
34
33
|
}
|
|
35
34
|
return [];
|
|
36
35
|
};
|
|
36
|
+
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
37
|
+
var selection = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection');
|
|
38
|
+
return {
|
|
39
|
+
selection: selection
|
|
40
|
+
};
|
|
41
|
+
}, function (api) {
|
|
42
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection']),
|
|
43
|
+
selectionState = _useSharedPluginState.selectionState;
|
|
44
|
+
return {
|
|
45
|
+
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
46
|
+
};
|
|
47
|
+
});
|
|
37
48
|
var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
38
49
|
var _colWidths$map$join;
|
|
39
50
|
var editorView = _ref.editorView,
|
|
@@ -52,16 +63,8 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
52
63
|
getScrollOffset = _ref.getScrollOffset,
|
|
53
64
|
api = _ref.api;
|
|
54
65
|
var columnControlsRef = (0, _react.useRef)(null);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['selection'], {
|
|
58
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
59
|
-
}),
|
|
60
|
-
selectionState = _useSharedPluginState.selectionState;
|
|
61
|
-
var selectionsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'selection.selection', {
|
|
62
|
-
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
63
|
-
});
|
|
64
|
-
var selection = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? selectionsSelector : selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection;
|
|
66
|
+
var _useSharedState = useSharedState(api),
|
|
67
|
+
selection = _useSharedState.selection;
|
|
65
68
|
var widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width) {
|
|
66
69
|
return (
|
|
67
70
|
// when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
|