@atlaskit/editor-plugin-table 13.0.5 → 13.0.6
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 +7 -0
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +19 -98
- package/dist/cjs/nodeviews/TableContainer.js +14 -53
- package/dist/cjs/nodeviews/TableResizer.js +2 -15
- package/dist/cjs/tablePlugin.js +30 -213
- package/dist/cjs/ui/DragHandle/index.js +9 -26
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -20
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -19
- package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -20
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -20
- package/dist/cjs/ui/global-styles.js +4 -17
- package/dist/cjs/ui/icons/SortingIconWrapper.js +2 -15
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +21 -102
- package/dist/es2019/nodeviews/TableContainer.js +11 -54
- package/dist/es2019/nodeviews/TableResizer.js +2 -17
- package/dist/es2019/tablePlugin.js +19 -211
- package/dist/es2019/ui/DragHandle/index.js +8 -27
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -22
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -22
- package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -22
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -22
- package/dist/es2019/ui/global-styles.js +6 -21
- package/dist/es2019/ui/icons/SortingIconWrapper.js +3 -18
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +20 -99
- package/dist/esm/nodeviews/TableContainer.js +15 -54
- package/dist/esm/nodeviews/TableResizer.js +3 -16
- package/dist/esm/tablePlugin.js +24 -208
- package/dist/esm/ui/DragHandle/index.js +10 -27
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +8 -21
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -20
- package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +8 -21
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +8 -21
- package/dist/esm/ui/global-styles.js +5 -18
- package/dist/esm/ui/icons/SortingIconWrapper.js +3 -16
- package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 13.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f3ccf5a62c62f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f3ccf5a62c62f) -
|
|
8
|
+
PR to cleanup platform_editor_usesharedpluginstatewithselector for table
|
|
9
|
+
|
|
3
10
|
## 13.0.5
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -8,13 +8,27 @@ exports.TableComponentWithSharedState = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
10
10
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
11
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
|
-
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
11
|
var _TableComponent = _interopRequireDefault(require("./TableComponent"));
|
|
14
12
|
// Ignored via go/ees005
|
|
15
13
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
17
|
+
*/
|
|
18
|
+
var TableComponentWithSharedState = exports.TableComponentWithSharedState = function TableComponentWithSharedState(_ref) {
|
|
19
|
+
var view = _ref.view,
|
|
20
|
+
options = _ref.options,
|
|
21
|
+
getNode = _ref.getNode,
|
|
22
|
+
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
23
|
+
api = _ref.api,
|
|
24
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags,
|
|
25
|
+
eventDispatcher = _ref.eventDispatcher,
|
|
26
|
+
allowColumnResizing = _ref.allowColumnResizing,
|
|
27
|
+
allowControls = _ref.allowControls,
|
|
28
|
+
getPos = _ref.getPos,
|
|
29
|
+
forwardRef = _ref.forwardRef,
|
|
30
|
+
allowTableAlignment = _ref.allowTableAlignment,
|
|
31
|
+
allowTableResizing = _ref.allowTableResizing;
|
|
18
32
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction'], function (states) {
|
|
19
33
|
var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt;
|
|
20
34
|
return {
|
|
@@ -60,97 +74,7 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
|
|
|
60
74
|
mode = _useSharedPluginState.mode,
|
|
61
75
|
selection = _useSharedPluginState.selection,
|
|
62
76
|
width = _useSharedPluginState.width;
|
|
63
|
-
return {
|
|
64
|
-
tableState: undefined,
|
|
65
|
-
widthState: undefined,
|
|
66
|
-
isTableResizing: isTableResizing,
|
|
67
|
-
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
68
|
-
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
69
|
-
ordering: ordering,
|
|
70
|
-
isResizing: isResizing,
|
|
71
|
-
isInDanger: isInDanger,
|
|
72
|
-
hoveredCell: hoveredCell,
|
|
73
|
-
hoveredRows: hoveredRows,
|
|
74
|
-
isTableHovered: isTableHovered,
|
|
75
|
-
isWholeTableInDanger: isWholeTableInDanger,
|
|
76
|
-
isFullscreen: isFullscreen,
|
|
77
|
-
selection: selection,
|
|
78
|
-
mode: mode,
|
|
79
|
-
width: width,
|
|
80
|
-
lineLength: lineLength,
|
|
81
|
-
interaction: interaction
|
|
82
|
-
};
|
|
83
|
-
}, function (api) {
|
|
84
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['width', 'table', 'media', 'selection', 'editorViewMode', 'interaction']),
|
|
85
|
-
widthState = _useSharedPluginState2.widthState,
|
|
86
|
-
tableState = _useSharedPluginState2.tableState,
|
|
87
|
-
mediaState = _useSharedPluginState2.mediaState,
|
|
88
|
-
selectionState = _useSharedPluginState2.selectionState,
|
|
89
|
-
editorViewModeState = _useSharedPluginState2.editorViewModeState,
|
|
90
|
-
interactionState = _useSharedPluginState2.interactionState;
|
|
91
|
-
var tableStateInternal = tableState;
|
|
92
|
-
return {
|
|
93
|
-
tableState: tableState,
|
|
94
|
-
widthState: widthState,
|
|
95
|
-
isTableResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableResizing,
|
|
96
|
-
isHeaderColumnEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderColumnEnabled,
|
|
97
|
-
isHeaderRowEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderRowEnabled,
|
|
98
|
-
ordering: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.ordering,
|
|
99
|
-
isResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isResizing,
|
|
100
|
-
isInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isInDanger,
|
|
101
|
-
hoveredCell: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredCell,
|
|
102
|
-
hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows,
|
|
103
|
-
isTableHovered: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableHovered,
|
|
104
|
-
isWholeTableInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isWholeTableInDanger,
|
|
105
|
-
isFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
|
|
106
|
-
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
|
|
107
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
108
|
-
width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
|
|
109
|
-
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
|
|
110
|
-
interaction: interactionState === null || interactionState === void 0 ? void 0 : interactionState.interactionState
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
116
|
-
*/
|
|
117
|
-
var TableComponentWithSharedState = exports.TableComponentWithSharedState = function TableComponentWithSharedState(_ref) {
|
|
118
|
-
var view = _ref.view,
|
|
119
|
-
options = _ref.options,
|
|
120
|
-
getNode = _ref.getNode,
|
|
121
|
-
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
122
|
-
api = _ref.api,
|
|
123
|
-
getEditorFeatureFlags = _ref.getEditorFeatureFlags,
|
|
124
|
-
eventDispatcher = _ref.eventDispatcher,
|
|
125
|
-
allowColumnResizing = _ref.allowColumnResizing,
|
|
126
|
-
allowControls = _ref.allowControls,
|
|
127
|
-
getPos = _ref.getPos,
|
|
128
|
-
forwardRef = _ref.forwardRef,
|
|
129
|
-
allowTableAlignment = _ref.allowTableAlignment,
|
|
130
|
-
allowTableResizing = _ref.allowTableResizing;
|
|
131
|
-
var _useSharedState = useSharedState(api),
|
|
132
|
-
tableState = _useSharedState.tableState,
|
|
133
|
-
widthState = _useSharedState.widthState,
|
|
134
|
-
mode = _useSharedState.mode,
|
|
135
|
-
hoveredCell = _useSharedState.hoveredCell,
|
|
136
|
-
hoveredRows = _useSharedState.hoveredRows,
|
|
137
|
-
isFullscreen = _useSharedState.isFullscreen,
|
|
138
|
-
isHeaderColumnEnabled = _useSharedState.isHeaderColumnEnabled,
|
|
139
|
-
isHeaderRowEnabled = _useSharedState.isHeaderRowEnabled,
|
|
140
|
-
isInDanger = _useSharedState.isInDanger,
|
|
141
|
-
isResizing = _useSharedState.isResizing,
|
|
142
|
-
isTableHovered = _useSharedState.isTableHovered,
|
|
143
|
-
isTableResizing = _useSharedState.isTableResizing,
|
|
144
|
-
isWholeTableInDanger = _useSharedState.isWholeTableInDanger,
|
|
145
|
-
lineLength = _useSharedState.lineLength,
|
|
146
|
-
ordering = _useSharedState.ordering,
|
|
147
|
-
selection = _useSharedState.selection,
|
|
148
|
-
width = _useSharedState.width,
|
|
149
|
-
interaction = _useSharedState.interaction;
|
|
150
77
|
var isLivePageViewMode = mode === 'view';
|
|
151
|
-
if ((0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false) && !tableState) {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
78
|
|
|
155
79
|
/**
|
|
156
80
|
* ED-19810
|
|
@@ -184,13 +108,10 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
|
|
|
184
108
|
ordering: ordering,
|
|
185
109
|
isResizing: isResizing,
|
|
186
110
|
getNode: getNode,
|
|
187
|
-
containerWidth:
|
|
111
|
+
containerWidth: {
|
|
188
112
|
width: width !== null && width !== void 0 ? width : 0,
|
|
189
113
|
lineLength: lineLength
|
|
190
|
-
}
|
|
191
|
-
// Ignored via go/ees005
|
|
192
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
193
|
-
widthState,
|
|
114
|
+
},
|
|
194
115
|
contentDOM: forwardRef,
|
|
195
116
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
196
117
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -45,7 +45,13 @@ var InnerContainer = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
45
45
|
"data-testid": "table-container"
|
|
46
46
|
}, children);
|
|
47
47
|
});
|
|
48
|
-
var
|
|
48
|
+
var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
49
|
+
var node = _ref2.node,
|
|
50
|
+
children = _ref2.children,
|
|
51
|
+
pluginInjectionApi = _ref2.pluginInjectionApi,
|
|
52
|
+
getPos = _ref2.getPos,
|
|
53
|
+
editorView = _ref2.editorView;
|
|
54
|
+
var alignment = node.attrs.layout !== _alignment.ALIGN_START ? _alignment.ALIGN_CENTER : _alignment.ALIGN_START;
|
|
49
55
|
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table'], function (states) {
|
|
50
56
|
var _states$tableState, _states$tableState2;
|
|
51
57
|
return {
|
|
@@ -55,35 +61,7 @@ var useAlignmentTableContainerSharedState = (0, _hooks.sharedPluginStateHookMigr
|
|
|
55
61
|
}),
|
|
56
62
|
isFullWidthModeEnabled = _useSharedPluginState.isFullWidthModeEnabled,
|
|
57
63
|
wasFullWidthModeEnabled = _useSharedPluginState.wasFullWidthModeEnabled;
|
|
58
|
-
return {
|
|
59
|
-
tableState: undefined,
|
|
60
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
61
|
-
wasFullWidthModeEnabled: wasFullWidthModeEnabled
|
|
62
|
-
};
|
|
63
|
-
}, function (pluginInjectionApi) {
|
|
64
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
|
|
65
|
-
tableState = _useSharedPluginState2.tableState;
|
|
66
|
-
return {
|
|
67
|
-
tableState: tableState,
|
|
68
|
-
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
69
|
-
wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled
|
|
70
|
-
};
|
|
71
|
-
});
|
|
72
|
-
var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
73
|
-
var node = _ref2.node,
|
|
74
|
-
children = _ref2.children,
|
|
75
|
-
pluginInjectionApi = _ref2.pluginInjectionApi,
|
|
76
|
-
getPos = _ref2.getPos,
|
|
77
|
-
editorView = _ref2.editorView;
|
|
78
|
-
var alignment = node.attrs.layout !== _alignment.ALIGN_START ? _alignment.ALIGN_CENTER : _alignment.ALIGN_START;
|
|
79
|
-
var _useAlignmentTableCon = useAlignmentTableContainerSharedState(pluginInjectionApi),
|
|
80
|
-
tableState = _useAlignmentTableCon.tableState,
|
|
81
|
-
isFullWidthModeEnabled = _useAlignmentTableCon.isFullWidthModeEnabled,
|
|
82
|
-
wasFullWidthModeEnabled = _useAlignmentTableCon.wasFullWidthModeEnabled;
|
|
83
64
|
(0, _react.useEffect)(function () {
|
|
84
|
-
if (!tableState && (0, _expValEquals.expValEquals)('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false)) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
65
|
if (editorView && getPos) {
|
|
88
66
|
var state = editorView.state,
|
|
89
67
|
dispatch = editorView.dispatch;
|
|
@@ -100,7 +78,7 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
100
78
|
}
|
|
101
79
|
}
|
|
102
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
103
|
-
}, [editorView,
|
|
81
|
+
}, [editorView, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
|
|
104
82
|
var style = (0, _react.useMemo)(function () {
|
|
105
83
|
return (0, _tableContainerStyles.getAlignmentStyle)(alignment);
|
|
106
84
|
}, [alignment]);
|
|
@@ -146,23 +124,6 @@ var selector = function selector(states) {
|
|
|
146
124
|
editorViewModeState: states.editorViewModeState
|
|
147
125
|
};
|
|
148
126
|
};
|
|
149
|
-
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
150
|
-
var _useSharedPluginState3 = (0, _hooks.useSharedPluginStateWithSelector)(api, ['table', 'editorViewMode'], selector),
|
|
151
|
-
tableState = _useSharedPluginState3.tableState,
|
|
152
|
-
editorViewModeState = _useSharedPluginState3.editorViewModeState;
|
|
153
|
-
return {
|
|
154
|
-
tableState: tableState,
|
|
155
|
-
editorViewModeState: editorViewModeState
|
|
156
|
-
};
|
|
157
|
-
}, function (api) {
|
|
158
|
-
var _useSharedPluginState4 = (0, _hooks.useSharedPluginState)(api, ['table', 'editorViewMode']),
|
|
159
|
-
tableState = _useSharedPluginState4.tableState,
|
|
160
|
-
editorViewModeState = _useSharedPluginState4.editorViewModeState;
|
|
161
|
-
return {
|
|
162
|
-
tableState: tableState,
|
|
163
|
-
editorViewModeState: editorViewModeState
|
|
164
|
-
};
|
|
165
|
-
});
|
|
166
127
|
var getPadding = function getPadding(containerWidth) {
|
|
167
128
|
return containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
|
|
168
129
|
};
|
|
@@ -190,9 +151,9 @@ var ResizableTableContainerLegacy = /*#__PURE__*/_react.default.memo(function (_
|
|
|
190
151
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
191
152
|
resizing = _useState2[0],
|
|
192
153
|
setIsResizing = _useState2[1];
|
|
193
|
-
var
|
|
194
|
-
tableState =
|
|
195
|
-
editorViewModeState =
|
|
154
|
+
var _useSharedPluginState2 = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table', 'editorViewMode'], selector),
|
|
155
|
+
tableState = _useSharedPluginState2.tableState,
|
|
156
|
+
editorViewModeState = _useSharedPluginState2.editorViewModeState;
|
|
196
157
|
var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
197
158
|
var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
198
159
|
var updateContainerHeight = (0, _react.useCallback)(function (height) {
|
|
@@ -391,9 +352,9 @@ var ResizableTableContainerNext = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
391
352
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
392
353
|
tableMaxWidthForFullPageOnLoad = _useState6[0],
|
|
393
354
|
setTableMaxWidthForFullPageOnLoad = _useState6[1];
|
|
394
|
-
var
|
|
395
|
-
tableState =
|
|
396
|
-
editorViewModeState =
|
|
355
|
+
var _useSharedPluginState3 = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table', 'editorViewMode'], selector),
|
|
356
|
+
tableState = _useSharedPluginState3.tableState,
|
|
357
|
+
editorViewModeState = _useSharedPluginState3.editorViewModeState;
|
|
397
358
|
var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
398
359
|
var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
399
360
|
var updateContainerHeight = (0, _react.useCallback)(function (height) {
|
|
@@ -116,19 +116,6 @@ var selector = function selector(states) {
|
|
|
116
116
|
widthToWidest: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.widthToWidest
|
|
117
117
|
};
|
|
118
118
|
};
|
|
119
|
-
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
120
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['table'], selector),
|
|
121
|
-
widthToWidest = _useSharedPluginState.widthToWidest;
|
|
122
|
-
return {
|
|
123
|
-
widthToWidest: widthToWidest
|
|
124
|
-
};
|
|
125
|
-
}, function (api) {
|
|
126
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['table']),
|
|
127
|
-
tableState = _useSharedPluginState2.tableState;
|
|
128
|
-
return {
|
|
129
|
-
widthToWidest: tableState === null || tableState === void 0 ? void 0 : tableState.widthToWidest
|
|
130
|
-
};
|
|
131
|
-
});
|
|
132
119
|
var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
133
120
|
var _editorView$state, _pluginInjectionApi$a2;
|
|
134
121
|
var children = _ref.children,
|
|
@@ -161,8 +148,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
161
148
|
var areResizeMetaKeysPressed = (0, _react.useRef)(false);
|
|
162
149
|
var resizerRef = (0, _react.useRef)(null);
|
|
163
150
|
var interactionState = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'interaction.interactionState');
|
|
164
|
-
var
|
|
165
|
-
widthToWidest =
|
|
151
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(pluginInjectionApi, ['table'], selector),
|
|
152
|
+
widthToWidest = _useSharedPluginState.widthToWidest;
|
|
166
153
|
|
|
167
154
|
// used to reposition tooltip when table is resizing via keyboard
|
|
168
155
|
var updateTooltip = _react.default.useRef();
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -11,43 +11,35 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
12
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
13
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
14
|
-
var _errorBoundary = require("@atlaskit/editor-common/error-boundary");
|
|
15
|
-
var _getDomRefFromSelection = require("@atlaskit/editor-common/get-dom-ref-from-selection");
|
|
16
14
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
17
15
|
var _icons = require("@atlaskit/editor-common/icons");
|
|
18
16
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
19
17
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
20
18
|
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
21
19
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
22
|
-
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
23
20
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
24
|
-
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
25
21
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
26
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
27
22
|
var _pmPlugins = require("@atlaskit/editor-tables/pm-plugins");
|
|
28
23
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
29
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
30
24
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
31
25
|
var _toDOM = require("./nodeviews/toDOM");
|
|
32
26
|
var _plugin = require("./pm-plugins/analytics/plugin");
|
|
33
|
-
var _pluginKey = require("./pm-plugins/analytics/plugin-key");
|
|
34
27
|
var _insert = require("./pm-plugins/commands/insert");
|
|
35
28
|
var _createPluginConfig = require("./pm-plugins/create-plugin-config");
|
|
36
29
|
var _plugin2 = require("./pm-plugins/decorations/plugin");
|
|
37
30
|
var _plugin3 = require("./pm-plugins/drag-and-drop/plugin");
|
|
38
|
-
var
|
|
31
|
+
var _pluginKey = require("./pm-plugins/drag-and-drop/plugin-key");
|
|
39
32
|
var _keymap = require("./pm-plugins/keymap");
|
|
40
33
|
var _main = require("./pm-plugins/main");
|
|
41
|
-
var
|
|
34
|
+
var _pluginKey2 = require("./pm-plugins/plugin-key");
|
|
42
35
|
var _safariDeleteCompositionTextIssueWorkaround = require("./pm-plugins/safari-delete-composition-text-issue-workaround");
|
|
43
36
|
var _plugin4 = require("./pm-plugins/sticky-headers/plugin");
|
|
44
|
-
var
|
|
37
|
+
var _pluginKey3 = require("./pm-plugins/sticky-headers/plugin-key");
|
|
45
38
|
var _util = require("./pm-plugins/sticky-headers/util");
|
|
46
39
|
var _tableAnalytics = require("./pm-plugins/table-analytics");
|
|
47
40
|
var _tableLocalId = require("./pm-plugins/table-local-id");
|
|
48
41
|
var _plugin5 = require("./pm-plugins/table-resizing/plugin");
|
|
49
42
|
var _pluginFactory = require("./pm-plugins/table-resizing/plugin-factory");
|
|
50
|
-
var _pluginKey5 = require("./pm-plugins/table-resizing/plugin-key");
|
|
51
43
|
var _tableSelectionKeymap = require("./pm-plugins/table-selection-keymap");
|
|
52
44
|
var _tableSizeSelector = require("./pm-plugins/table-size-selector");
|
|
53
45
|
var _tableWidth = require("./pm-plugins/table-width");
|
|
@@ -55,48 +47,20 @@ var _tableWidthInCommentFix = require("./pm-plugins/table-width-in-comment-fix")
|
|
|
55
47
|
var _create = require("./pm-plugins/utils/create");
|
|
56
48
|
var _viewModeSort = require("./pm-plugins/view-mode-sort");
|
|
57
49
|
var _ContentComponent = require("./ui/ContentComponent");
|
|
58
|
-
var _FloatingContextualButton = _interopRequireDefault(require("./ui/FloatingContextualButton"));
|
|
59
|
-
var _FloatingContextualMenu = _interopRequireDefault(require("./ui/FloatingContextualMenu"));
|
|
60
|
-
var _FloatingDeleteButton = _interopRequireDefault(require("./ui/FloatingDeleteButton"));
|
|
61
|
-
var _FloatingDragMenu = _interopRequireDefault(require("./ui/FloatingDragMenu"));
|
|
62
|
-
var _FloatingInsertButton = _interopRequireDefault(require("./ui/FloatingInsertButton"));
|
|
63
|
-
var _FloatingToolbarLabel = require("./ui/FloatingToolbarLabel/FloatingToolbarLabel");
|
|
64
|
-
var _globalStyles = require("./ui/global-styles");
|
|
65
|
-
var _SizeSelector = require("./ui/SizeSelector");
|
|
66
|
-
var _TableFullWidthLabel = require("./ui/TableFullWidthLabel");
|
|
67
50
|
var _toolbar = require("./ui/toolbar");
|
|
68
51
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
69
52
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
70
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
71
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
53
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
72
54
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
73
55
|
return {};
|
|
74
56
|
};
|
|
75
|
-
var useTableSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
76
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['editorViewMode'], function (states) {
|
|
77
|
-
var _states$editorViewMod;
|
|
78
|
-
return {
|
|
79
|
-
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
80
|
-
};
|
|
81
|
-
}),
|
|
82
|
-
mode = _useSharedPluginState.mode;
|
|
83
|
-
return {
|
|
84
|
-
mode: mode
|
|
85
|
-
};
|
|
86
|
-
}, function (api) {
|
|
87
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']),
|
|
88
|
-
editorViewModeState = _useSharedPluginState2.editorViewModeState;
|
|
89
|
-
return {
|
|
90
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
57
|
|
|
94
58
|
/**
|
|
95
59
|
* Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
96
60
|
* from `@atlaskit/editor-core`.
|
|
97
61
|
*/
|
|
98
62
|
var tablePlugin = function tablePlugin(_ref) {
|
|
99
|
-
var _api$analytics,
|
|
63
|
+
var _api$analytics, _options$getEditorFea, _options$getEditorFea2, _api$analytics2;
|
|
100
64
|
var options = _ref.config,
|
|
101
65
|
api = _ref.api;
|
|
102
66
|
var editorViewRef = {
|
|
@@ -109,7 +73,6 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
109
73
|
};
|
|
110
74
|
};
|
|
111
75
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
112
|
-
var ariaNotifyPlugin = api === null || api === void 0 || (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify;
|
|
113
76
|
var isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 || (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
114
77
|
var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
115
78
|
options === null || options === void 0 ? void 0 : options.isCommentEditor));
|
|
@@ -127,12 +90,12 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
127
90
|
}
|
|
128
91
|
|
|
129
92
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
130
|
-
var tablePluginState =
|
|
93
|
+
var tablePluginState = _pluginKey2.pluginKey.getState(editorState);
|
|
131
94
|
var tableResizingPluginState = (0, _pluginFactory.getPluginState)(editorState);
|
|
132
95
|
var tableWidthResizingPluginState = _tableWidth.pluginKey.getState(editorState);
|
|
133
|
-
var stickyHeadersState =
|
|
96
|
+
var stickyHeadersState = _pluginKey3.pluginKey.getState(editorState);
|
|
134
97
|
var stickyHeader = stickyHeadersState ? (0, _util.findStickyHeaderForTable)(stickyHeadersState, tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.tablePos) : undefined;
|
|
135
|
-
var dragAndDropState =
|
|
98
|
+
var dragAndDropState = _pluginKey.pluginKey.getState(editorState);
|
|
136
99
|
var sizeSelectorPluginState = _tableSizeSelector.pluginKey.getState(editorState);
|
|
137
100
|
var sharedStateInternal = {
|
|
138
101
|
isFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.fullWidthEnabled),
|
|
@@ -480,178 +443,27 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
480
443
|
return plugins;
|
|
481
444
|
},
|
|
482
445
|
contentComponent: function contentComponent(_ref18) {
|
|
483
|
-
var _api$featureFlags;
|
|
484
446
|
var editorView = _ref18.editorView,
|
|
485
447
|
popupsMountPoint = _ref18.popupsMountPoint,
|
|
486
448
|
popupsBoundariesElement = _ref18.popupsBoundariesElement,
|
|
487
449
|
popupsScrollableElement = _ref18.popupsScrollableElement,
|
|
488
450
|
dispatchAnalyticsEvent = _ref18.dispatchAnalyticsEvent;
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
editorView: editorView,
|
|
493
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
494
|
-
options: options,
|
|
495
|
-
popupsMountPoint: popupsMountPoint,
|
|
496
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
497
|
-
popupsScrollableElement: popupsScrollableElement,
|
|
498
|
-
defaultGetEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
499
|
-
defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags,
|
|
500
|
-
isTableSelectorEnabled: isTableSelectorEnabled
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
504
|
-
component: _analytics.ACTION_SUBJECT.TABLES_PLUGIN,
|
|
451
|
+
return /*#__PURE__*/_react.default.createElement(_ContentComponent.ContentComponent, {
|
|
452
|
+
api: api,
|
|
453
|
+
editorView: editorView,
|
|
505
454
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
tablePluginState: _pluginKey3.pluginKey,
|
|
515
|
-
tableWidthPluginState: _tableWidth.pluginKey,
|
|
516
|
-
tableResizingPluginState: _pluginKey5.pluginKey,
|
|
517
|
-
stickyHeadersState: _pluginKey4.pluginKey,
|
|
518
|
-
dragAndDropState: _pluginKey2.pluginKey,
|
|
519
|
-
sizeSelectorPluginState: _tableSizeSelector.pluginKey
|
|
520
|
-
},
|
|
521
|
-
render: function render(_ref19) {
|
|
522
|
-
var _sizeSelectorPluginSt, _api$analytics3;
|
|
523
|
-
var resizingPluginState = _ref19.tableResizingPluginState,
|
|
524
|
-
stickyHeadersState = _ref19.stickyHeadersState,
|
|
525
|
-
tablePluginState = _ref19.tablePluginState,
|
|
526
|
-
tableWidthPluginState = _ref19.tableWidthPluginState,
|
|
527
|
-
dragAndDropState = _ref19.dragAndDropState,
|
|
528
|
-
sizeSelectorPluginState = _ref19.sizeSelectorPluginState;
|
|
529
|
-
// Any changes made inside `<WithPluginState>` need to be reflected in the
|
|
530
|
-
// `<ContentComponent>` as well.
|
|
531
|
-
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
532
|
-
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
533
|
-
var resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
|
|
534
|
-
var resizingTableRef = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableRef;
|
|
535
|
-
var isResizing = isColumnResizing || isTableResizing;
|
|
536
|
-
var widthToWidest = tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.widthToWidest;
|
|
537
|
-
var isSizeSelectorOpen = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.isSelectorOpen;
|
|
538
|
-
var _ref20 = tablePluginState,
|
|
539
|
-
tableNode = _ref20.tableNode,
|
|
540
|
-
tablePos = _ref20.tablePos,
|
|
541
|
-
targetCellPosition = _ref20.targetCellPosition,
|
|
542
|
-
isContextualMenuOpen = _ref20.isContextualMenuOpen,
|
|
543
|
-
tableRef = _ref20.tableRef,
|
|
544
|
-
pluginConfig = _ref20.pluginConfig,
|
|
545
|
-
insertColumnButtonIndex = _ref20.insertColumnButtonIndex,
|
|
546
|
-
insertRowButtonIndex = _ref20.insertRowButtonIndex,
|
|
547
|
-
isHeaderColumnEnabled = _ref20.isHeaderColumnEnabled,
|
|
548
|
-
isHeaderRowEnabled = _ref20.isHeaderRowEnabled,
|
|
549
|
-
isDragAndDropEnabled = _ref20.isDragAndDropEnabled,
|
|
550
|
-
tableWrapperTarget = _ref20.tableWrapperTarget,
|
|
551
|
-
isCellMenuOpenByKeyboard = _ref20.isCellMenuOpenByKeyboard;
|
|
552
|
-
var allowControls = pluginConfig.allowControls;
|
|
553
|
-
var stickyHeader = stickyHeadersState ? (0, _util.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
|
|
554
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
|
|
555
|
-
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
556
|
-
editorView: editorView,
|
|
557
|
-
tableNode: tableNode,
|
|
558
|
-
mountPoint: popupsMountPoint,
|
|
559
|
-
targetCellPosition: targetCellPosition,
|
|
560
|
-
scrollableElement: popupsScrollableElement,
|
|
561
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
562
|
-
isContextualMenuOpen: isContextualMenuOpen,
|
|
563
|
-
stickyHeader: stickyHeader,
|
|
564
|
-
tableWrapper: tableWrapperTarget,
|
|
565
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
|
|
566
|
-
}), allowControls && /*#__PURE__*/_react.default.createElement(_FloatingInsertButton.default, {
|
|
567
|
-
tableNode: tableNode,
|
|
568
|
-
tableRef: tableRef,
|
|
569
|
-
insertColumnButtonIndex: insertColumnButtonIndex,
|
|
570
|
-
insertRowButtonIndex: insertRowButtonIndex,
|
|
571
|
-
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
572
|
-
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
573
|
-
isDragAndDropEnabled: isDragAndDropEnabled,
|
|
574
|
-
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
575
|
-
editorView: editorView,
|
|
576
|
-
mountPoint: popupsMountPoint,
|
|
577
|
-
boundariesElement: popupsBoundariesElement,
|
|
578
|
-
scrollableElement: popupsScrollableElement,
|
|
579
|
-
hasStickyHeaders: stickyHeader && stickyHeader.sticky,
|
|
580
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
581
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
582
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
583
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
584
|
-
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
585
|
-
api: api,
|
|
586
|
-
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
587
|
-
}), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/_react.default.createElement(_FloatingContextualMenu.default, {
|
|
588
|
-
editorView: editorView,
|
|
589
|
-
mountPoint: popupsMountPoint,
|
|
590
|
-
boundariesElement: popupsBoundariesElement,
|
|
591
|
-
targetCellPosition: targetCellPosition,
|
|
592
|
-
isOpen: Boolean(isContextualMenuOpen) && !isResizing,
|
|
593
|
-
pluginConfig: pluginConfig,
|
|
594
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
595
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
596
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
597
|
-
isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
|
|
598
|
-
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
599
|
-
api: api
|
|
600
|
-
}), isDragAndDropEnabled && /*#__PURE__*/_react.default.createElement(_FloatingDragMenu.default, {
|
|
601
|
-
editorView: editorView,
|
|
602
|
-
mountPoint: popupsMountPoint,
|
|
603
|
-
boundariesElement: popupsBoundariesElement,
|
|
604
|
-
tableRef: tableRef,
|
|
605
|
-
tableNode: tableNode,
|
|
606
|
-
targetCellPosition: targetCellPosition,
|
|
607
|
-
direction: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
|
|
608
|
-
index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
|
|
609
|
-
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
|
|
610
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
611
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
612
|
-
stickyHeaders: stickyHeader,
|
|
613
|
-
pluginConfig: pluginConfig,
|
|
614
|
-
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
615
|
-
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
|
|
616
|
-
ariaNotifyPlugin: ariaNotifyPlugin,
|
|
617
|
-
api: api,
|
|
618
|
-
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
|
|
619
|
-
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/_react.default.createElement(_FloatingDeleteButton.default, {
|
|
620
|
-
editorView: editorView,
|
|
621
|
-
selection: editorView.state.selection,
|
|
622
|
-
tableRef: tableRef,
|
|
623
|
-
mountPoint: popupsMountPoint,
|
|
624
|
-
boundariesElement: popupsBoundariesElement,
|
|
625
|
-
scrollableElement: popupsScrollableElement,
|
|
626
|
-
stickyHeaders: stickyHeader,
|
|
627
|
-
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
628
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
629
|
-
api: api
|
|
630
|
-
}), ((options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || (options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) && options.isCommentEditor) && isTableResizing && widthToWidest && resizingTableLocalId && resizingTableRef && widthToWidest[resizingTableLocalId] && /*#__PURE__*/_react.default.createElement(_FloatingToolbarLabel.FloatingToolbarLabel, {
|
|
631
|
-
target: resizingTableRef,
|
|
632
|
-
content: (0, _experiments.editorExperiment)('single_column_layouts', true) ? /*#__PURE__*/_react.default.createElement(_resizer.ResizerBreakoutModeLabel, {
|
|
633
|
-
layout: "full-width"
|
|
634
|
-
}) : /*#__PURE__*/_react.default.createElement(_TableFullWidthLabel.FullWidthDisplay, null),
|
|
635
|
-
alignX: 'center',
|
|
636
|
-
alignY: 'bottom',
|
|
637
|
-
stick: true,
|
|
638
|
-
forcePlacement: true,
|
|
639
|
-
zIndex: _editorSharedStyles.akEditorFloatingPanelZIndex,
|
|
640
|
-
offset: [0, 10]
|
|
641
|
-
}), isTableSelectorEnabled && isSizeSelectorOpen && /*#__PURE__*/_react.default.createElement(_SizeSelector.SizeSelector, {
|
|
642
|
-
api: api,
|
|
643
|
-
isOpenedByKeyboard: false,
|
|
644
|
-
popupsMountPoint: popupsMountPoint,
|
|
645
|
-
target: (_sizeSelectorPluginSt = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef) !== null && _sizeSelectorPluginSt !== void 0 ? _sizeSelectorPluginSt : (0, _getDomRefFromSelection.getDomRefFromSelection)(editorView, _analytics.ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
|
|
646
|
-
popupsBoundariesElement: popupsBoundariesElement,
|
|
647
|
-
popupsScrollableElement: popupsScrollableElement
|
|
648
|
-
}));
|
|
649
|
-
}
|
|
650
|
-
}));
|
|
455
|
+
options: options,
|
|
456
|
+
popupsMountPoint: popupsMountPoint,
|
|
457
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
458
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
459
|
+
defaultGetEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
460
|
+
defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags,
|
|
461
|
+
isTableSelectorEnabled: isTableSelectorEnabled
|
|
462
|
+
});
|
|
651
463
|
},
|
|
652
464
|
pluginsOptions: {
|
|
653
|
-
quickInsert: function quickInsert(
|
|
654
|
-
var formatMessage =
|
|
465
|
+
quickInsert: function quickInsert(_ref19) {
|
|
466
|
+
var formatMessage = _ref19.formatMessage;
|
|
655
467
|
return [{
|
|
656
468
|
id: 'table',
|
|
657
469
|
title: formatMessage(_messages.toolbarInsertBlockMessages.table),
|
|
@@ -722,10 +534,15 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
722
534
|
return editorViewRef.current;
|
|
723
535
|
}, options, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)((0, _createPluginConfig.pluginConfig)(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
724
536
|
},
|
|
725
|
-
usePluginHook: function usePluginHook(
|
|
726
|
-
var editorView =
|
|
727
|
-
var
|
|
728
|
-
|
|
537
|
+
usePluginHook: function usePluginHook(_ref20) {
|
|
538
|
+
var editorView = _ref20.editorView;
|
|
539
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['editorViewMode'], function (states) {
|
|
540
|
+
var _states$editorViewMod;
|
|
541
|
+
return {
|
|
542
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
543
|
+
};
|
|
544
|
+
}),
|
|
545
|
+
mode = _useSharedPluginState.mode;
|
|
729
546
|
(0, _react.useEffect)(function () {
|
|
730
547
|
var state = editorView.state,
|
|
731
548
|
dispatch = editorView.dispatch;
|