@atlaskit/editor-plugin-table 13.0.4 → 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 +15 -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/nodeviews/table.js +4 -4
- package/dist/cjs/tablePlugin.js +30 -213
- package/dist/cjs/ui/DragHandle/index.js +9 -26
- package/dist/cjs/ui/DragPreview/index.js +1 -1
- package/dist/cjs/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
- package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -1
- 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/TableFullWidthLabel/index.js +1 -1
- package/dist/cjs/ui/global-styles.js +4 -17
- package/dist/cjs/ui/icons/SortingIconWrapper.js +2 -15
- package/dist/cjs/ui/ui-styles.js +1 -1
- 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/nodeviews/table.js +4 -4
- package/dist/es2019/tablePlugin.js +19 -211
- package/dist/es2019/ui/DragHandle/index.js +8 -27
- package/dist/es2019/ui/DragPreview/index.js +1 -1
- package/dist/es2019/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/es2019/ui/FloatingContextualMenu/styles.js +3 -3
- package/dist/es2019/ui/FloatingDragMenu/styles.js +2 -2
- 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/TableFullWidthLabel/index.js +1 -1
- package/dist/es2019/ui/global-styles.js +6 -21
- package/dist/es2019/ui/icons/SortingIconWrapper.js +3 -18
- package/dist/es2019/ui/ui-styles.js +1 -1
- 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/nodeviews/table.js +4 -4
- package/dist/esm/tablePlugin.js +24 -208
- package/dist/esm/ui/DragHandle/index.js +10 -27
- package/dist/esm/ui/DragPreview/index.js +1 -1
- package/dist/esm/ui/FloatingContextualButton/styles.js +1 -1
- package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
- package/dist/esm/ui/FloatingDragMenu/styles.js +1 -1
- 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/TableFullWidthLabel/index.js +1 -1
- package/dist/esm/ui/global-styles.js +5 -18
- package/dist/esm/ui/icons/SortingIconWrapper.js +3 -16
- package/dist/esm/ui/ui-styles.js +1 -1
- package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
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
|
+
|
|
10
|
+
## 13.0.5
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [`255837cfba315`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/255837cfba315) -
|
|
15
|
+
Internal changes to how border radius is applied.
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 13.0.4
|
|
4
19
|
|
|
5
20
|
### 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();
|
|
@@ -82,7 +82,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
82
82
|
_this.options = props.options;
|
|
83
83
|
_this.getEditorFeatureFlags = props.getEditorFeatureFlags;
|
|
84
84
|
_this.handleRef = function (node) {
|
|
85
|
-
return _this._handleTableRef(node
|
|
85
|
+
return _this._handleTableRef(node);
|
|
86
86
|
};
|
|
87
87
|
return _this;
|
|
88
88
|
}
|
|
@@ -127,7 +127,7 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
127
127
|
*/
|
|
128
128
|
}, {
|
|
129
129
|
key: "_handleTableRef",
|
|
130
|
-
value: function _handleTableRef(node
|
|
130
|
+
value: function _handleTableRef(node) {
|
|
131
131
|
var _this2 = this;
|
|
132
132
|
var oldIgnoreMutation;
|
|
133
133
|
var selectionBookmark;
|
|
@@ -155,8 +155,8 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
155
155
|
selectionBookmark = this.view.state.selection.getBookmark();
|
|
156
156
|
}
|
|
157
157
|
if (this.dom && (0, _expValEquals.expValEquals)('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
158
|
-
this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(
|
|
159
|
-
this.dom.setAttribute('data-ssr-placeholder-replace', "table-nodeview-".concat(
|
|
158
|
+
this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(this.node.attrs.localId));
|
|
159
|
+
this.dom.setAttribute('data-ssr-placeholder-replace', "table-nodeview-".concat(this.node.attrs.localId));
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
// Remove the ProseMirror table DOM structure to avoid duplication, as it's replaced with the React table node.
|