@atlaskit/editor-plugin-table 10.9.5 → 10.9.7
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 +16 -0
- package/dist/cjs/nodeviews/TableComponent.js +5 -0
- package/dist/cjs/nodeviews/TableContainer.js +63 -32
- package/dist/cjs/nodeviews/TableResizer.js +18 -10
- package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -3
- package/dist/cjs/tablePlugin.js +10 -2
- package/dist/cjs/ui/DragHandle/index.js +19 -3
- package/dist/cjs/ui/global-styles.js +11 -2
- package/dist/es2019/nodeviews/TableComponent.js +5 -0
- package/dist/es2019/nodeviews/TableContainer.js +41 -13
- package/dist/es2019/nodeviews/TableResizer.js +13 -6
- package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -3
- package/dist/es2019/tablePlugin.js +10 -2
- package/dist/es2019/ui/DragHandle/index.js +19 -3
- package/dist/es2019/ui/global-styles.js +11 -2
- package/dist/esm/nodeviews/TableComponent.js +5 -0
- package/dist/esm/nodeviews/TableContainer.js +63 -32
- package/dist/esm/nodeviews/TableResizer.js +18 -10
- package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +4 -3
- package/dist/esm/tablePlugin.js +10 -2
- package/dist/esm/ui/DragHandle/index.js +19 -3
- package/dist/esm/ui/global-styles.js +11 -2
- package/package.json +5 -2
- package/src/nodeviews/TableComponent.tsx +5 -0
- package/src/nodeviews/TableContainer.tsx +76 -9
- package/src/nodeviews/TableResizer.tsx +19 -4
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +5 -3
- package/src/tablePlugin.tsx +12 -2
- package/src/ui/DragHandle/index.tsx +27 -3
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -1
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +3 -3
- package/src/ui/global-styles.tsx +14 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 10.9.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#146244](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/146244)
|
|
8
|
+
[`a87bc29b0ab36`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a87bc29b0ab36) -
|
|
9
|
+
[ED-27681] Fix a bug where resize table column and then resize table cannot be undone
|
|
10
|
+
|
|
11
|
+
## 10.9.6
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#145707](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/145707)
|
|
16
|
+
[`efae19bca16cb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/efae19bca16cb) -
|
|
17
|
+
Enable useSharedPluginStateSelector in Table
|
|
18
|
+
|
|
3
19
|
## 10.9.5
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -254,6 +254,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
254
254
|
)(state.tr);
|
|
255
255
|
if (!isUserTriggered) {
|
|
256
256
|
(0, _collab.tintDirtyTransaction)(tr);
|
|
257
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_table_resizing_undo')) {
|
|
258
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
259
|
+
// as a consequence of another action
|
|
260
|
+
tr.setMeta('addToHistory', false);
|
|
261
|
+
}
|
|
257
262
|
}
|
|
258
263
|
dispatch(tr);
|
|
259
264
|
});
|
|
@@ -13,8 +13,10 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
14
14
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
15
15
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
16
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
16
17
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
19
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
20
|
var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
|
|
19
21
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
20
22
|
var _consts = require("../pm-plugins/table-resizing/utils/consts");
|
|
@@ -49,12 +51,27 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
49
51
|
getPos = _ref2.getPos,
|
|
50
52
|
editorView = _ref2.editorView;
|
|
51
53
|
var alignment = node.attrs.layout !== _alignment.ALIGN_START ? _alignment.ALIGN_CENTER : _alignment.ALIGN_START;
|
|
52
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']
|
|
54
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table'], {
|
|
55
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
56
|
+
}),
|
|
53
57
|
tableState = _useSharedPluginState.tableState;
|
|
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;
|
|
54
70
|
(0, _react.useEffect)(function () {
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
|
|
71
|
+
if ((0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false) && !tableState) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (editorView && getPos) {
|
|
58
75
|
var state = editorView.state,
|
|
59
76
|
dispatch = editorView.dispatch;
|
|
60
77
|
if (wasFullWidthModeEnabled && isFullWidthModeEnabled !== undefined && !isFullWidthModeEnabled && alignment !== _alignment.ALIGN_CENTER && node.attrs.width > _editorSharedStyles.akEditorDefaultLayoutWidth) {
|
|
@@ -70,7 +87,7 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
70
87
|
}
|
|
71
88
|
}
|
|
72
89
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
73
|
-
}, [editorView, tableState, node]);
|
|
90
|
+
}, [editorView, tableState, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
|
|
74
91
|
var style = (0, _react.useMemo)(function () {
|
|
75
92
|
return (0, _tableContainerStyles.getAlignmentStyle)(alignment);
|
|
76
93
|
}, [alignment]);
|
|
@@ -132,10 +149,16 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
132
149
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
133
150
|
resizing = _useState2[0],
|
|
134
151
|
setIsResizing = _useState2[1];
|
|
135
|
-
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']
|
|
152
|
+
var _useSharedPluginState2 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table'], {
|
|
153
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
154
|
+
}),
|
|
136
155
|
tableState = _useSharedPluginState2.tableState;
|
|
137
|
-
|
|
138
|
-
|
|
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;
|
|
139
162
|
var updateContainerHeight = (0, _react.useCallback)(function (height) {
|
|
140
163
|
var _containerRef$current;
|
|
141
164
|
// current StickyHeader State is not stable to be fetch.
|
|
@@ -189,8 +212,16 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
189
212
|
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;
|
|
190
213
|
}, [pluginInjectionApi]);
|
|
191
214
|
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
192
|
-
var _useSharedPluginState3 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode']
|
|
215
|
+
var _useSharedPluginState3 = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode'], {
|
|
216
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
217
|
+
}),
|
|
193
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;
|
|
194
225
|
var responsiveContainerWidth = 0;
|
|
195
226
|
var resizeHandleSpacing = 12;
|
|
196
227
|
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
@@ -241,7 +272,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
241
272
|
onResizeStop: onResizeStop,
|
|
242
273
|
isCommentEditor: isCommentEditor
|
|
243
274
|
};
|
|
244
|
-
var isLivePageViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
275
|
+
var isLivePageViewMode = ((0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? mode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
245
276
|
return /*#__PURE__*/_react.default.createElement(AlignmentTableContainerWrapper, {
|
|
246
277
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
247
278
|
node: node,
|
|
@@ -286,28 +317,28 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
286
317
|
node: node
|
|
287
318
|
}, children)) : null));
|
|
288
319
|
});
|
|
289
|
-
var TableContainer = exports.TableContainer = function TableContainer(
|
|
290
|
-
var children =
|
|
291
|
-
node =
|
|
292
|
-
className =
|
|
293
|
-
|
|
294
|
-
editorWidth =
|
|
295
|
-
lineLength =
|
|
296
|
-
editorView =
|
|
297
|
-
getPos =
|
|
298
|
-
tableRef =
|
|
299
|
-
isNested =
|
|
300
|
-
tableWrapperHeight =
|
|
301
|
-
isResizing =
|
|
302
|
-
pluginInjectionApi =
|
|
303
|
-
isWholeTableInDanger =
|
|
304
|
-
isTableResizingEnabled =
|
|
305
|
-
isTableScalingEnabled =
|
|
306
|
-
isTableWithFixedColumnWidthsOptionEnabled =
|
|
307
|
-
isTableAlignmentEnabled =
|
|
308
|
-
shouldUseIncreasedScalingPercent =
|
|
309
|
-
isCommentEditor =
|
|
310
|
-
isChromelessEditor =
|
|
320
|
+
var TableContainer = exports.TableContainer = function TableContainer(_ref5) {
|
|
321
|
+
var children = _ref5.children,
|
|
322
|
+
node = _ref5.node,
|
|
323
|
+
className = _ref5.className,
|
|
324
|
+
_ref5$containerWidth = _ref5.containerWidth,
|
|
325
|
+
editorWidth = _ref5$containerWidth.width,
|
|
326
|
+
lineLength = _ref5$containerWidth.lineLength,
|
|
327
|
+
editorView = _ref5.editorView,
|
|
328
|
+
getPos = _ref5.getPos,
|
|
329
|
+
tableRef = _ref5.tableRef,
|
|
330
|
+
isNested = _ref5.isNested,
|
|
331
|
+
tableWrapperHeight = _ref5.tableWrapperHeight,
|
|
332
|
+
isResizing = _ref5.isResizing,
|
|
333
|
+
pluginInjectionApi = _ref5.pluginInjectionApi,
|
|
334
|
+
isWholeTableInDanger = _ref5.isWholeTableInDanger,
|
|
335
|
+
isTableResizingEnabled = _ref5.isTableResizingEnabled,
|
|
336
|
+
isTableScalingEnabled = _ref5.isTableScalingEnabled,
|
|
337
|
+
isTableWithFixedColumnWidthsOptionEnabled = _ref5.isTableWithFixedColumnWidthsOptionEnabled,
|
|
338
|
+
isTableAlignmentEnabled = _ref5.isTableAlignmentEnabled,
|
|
339
|
+
shouldUseIncreasedScalingPercent = _ref5.shouldUseIncreasedScalingPercent,
|
|
340
|
+
isCommentEditor = _ref5.isCommentEditor,
|
|
341
|
+
isChromelessEditor = _ref5.isChromelessEditor;
|
|
311
342
|
if (isTableResizingEnabled && !isNested) {
|
|
312
343
|
return /*#__PURE__*/_react.default.createElement(ResizableTableContainer
|
|
313
344
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -19,10 +19,12 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
19
19
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
20
20
|
var _monitoring = require("@atlaskit/editor-common/monitoring");
|
|
21
21
|
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
22
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
22
23
|
var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
23
24
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
24
25
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
25
26
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
26
28
|
var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
|
|
27
29
|
var _misc = require("../pm-plugins/commands/misc");
|
|
28
30
|
var _tableAnalytics = require("../pm-plugins/table-analytics");
|
|
@@ -135,10 +137,16 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
135
137
|
var isResizing = (0, _react.useRef)(false);
|
|
136
138
|
var areResizeMetaKeysPressed = (0, _react.useRef)(false);
|
|
137
139
|
var resizerRef = (0, _react.useRef)(null);
|
|
138
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']
|
|
140
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table'], {
|
|
141
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
142
|
+
}),
|
|
139
143
|
tableState = _useSharedPluginState.tableState;
|
|
140
|
-
|
|
141
|
-
|
|
144
|
+
|
|
145
|
+
// widthToWidest
|
|
146
|
+
var widthToWidestSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'table.widthToWidest', {
|
|
147
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
148
|
+
});
|
|
149
|
+
var widthToWidest = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? widthToWidestSelector : tableState.widthToWidest;
|
|
142
150
|
|
|
143
151
|
// used to reposition tooltip when table is resizing via keyboard
|
|
144
152
|
var updateTooltip = _react.default.useRef();
|
|
@@ -180,12 +188,12 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
180
188
|
var excludeGuidelineConfig = (0, _react.useMemo)(function () {
|
|
181
189
|
return {
|
|
182
190
|
innerGuidelines: !!isTableAlignmentEnabled,
|
|
183
|
-
breakoutPoints: !!(isTableAlignmentEnabled &&
|
|
191
|
+
breakoutPoints: !!(isTableAlignmentEnabled && isFullWidthModeEnabled)
|
|
184
192
|
};
|
|
185
|
-
}, [
|
|
186
|
-
var updateActiveGuidelines = (0, _react.useCallback)(function (
|
|
187
|
-
var gap =
|
|
188
|
-
keys =
|
|
193
|
+
}, [isFullWidthModeEnabled, isTableAlignmentEnabled]);
|
|
194
|
+
var updateActiveGuidelines = (0, _react.useCallback)(function (_ref2) {
|
|
195
|
+
var gap = _ref2.gap,
|
|
196
|
+
keys = _ref2.keys;
|
|
189
197
|
if (gap !== currentGap.current) {
|
|
190
198
|
currentGap.current = gap;
|
|
191
199
|
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() : containerWidth, excludeGuidelineConfig) : _guidelines.defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
@@ -487,8 +495,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
487
495
|
needExtendedResizeZone: !isTableSelected,
|
|
488
496
|
appearance: isTableSelected && isWholeTableInDanger ? 'danger' : undefined,
|
|
489
497
|
handleHighlight: "shadow",
|
|
490
|
-
handleTooltipContent: function handleTooltipContent(
|
|
491
|
-
var update =
|
|
498
|
+
handleTooltipContent: function handleTooltipContent(_ref3) {
|
|
499
|
+
var update = _ref3.update;
|
|
492
500
|
updateTooltip.current = update;
|
|
493
501
|
return /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
494
502
|
description: formatMessage(_messages.tableMessages.resizeTable),
|
|
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
11
11
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
var _columnWidth = require("../../transforms/column-width");
|
|
14
15
|
var _nodes = require("../../utils/nodes");
|
|
15
16
|
var _misc = require("../utils/misc");
|
|
@@ -177,9 +178,9 @@ var scaleTable = exports.scaleTable = function scaleTable(tableRef, options, dom
|
|
|
177
178
|
}
|
|
178
179
|
if (resizeState) {
|
|
179
180
|
tr = (0, _columnWidth.updateColumnWidths)(resizeState, node, start, api)(tr);
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_fix_table_resizing_undo')) {
|
|
182
|
+
tr.setMeta('addToHistory', false);
|
|
183
|
+
}
|
|
183
184
|
if (tr.docChanged) {
|
|
184
185
|
tr.setMeta('scrollIntoView', false);
|
|
185
186
|
// TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
|
package/dist/cjs/tablePlugin.js
CHANGED
|
@@ -21,6 +21,7 @@ var _nesting = require("@atlaskit/editor-common/nesting");
|
|
|
21
21
|
var _preset = require("@atlaskit/editor-common/preset");
|
|
22
22
|
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
23
23
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
24
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
24
25
|
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
25
26
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
26
27
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -686,9 +687,16 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
686
687
|
},
|
|
687
688
|
usePluginHook: function usePluginHook(_ref24) {
|
|
688
689
|
var editorView = _ref24.editorView;
|
|
689
|
-
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['editorViewMode']
|
|
690
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['editorViewMode'], {
|
|
691
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
692
|
+
}),
|
|
690
693
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
691
|
-
|
|
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;
|
|
692
700
|
(0, _react.useEffect)(function () {
|
|
693
701
|
var state = editorView.state,
|
|
694
702
|
dispatch = editorView.dispatch;
|
|
@@ -15,10 +15,12 @@ var _reactIntlNext = require("react-intl-next");
|
|
|
15
15
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
16
16
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
17
17
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
18
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
18
19
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
19
20
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
20
21
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
21
22
|
var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
|
|
23
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
22
24
|
var _pluginFactory = require("../../pm-plugins/drag-and-drop/plugin-factory");
|
|
23
25
|
var _pluginFactory2 = require("../../pm-plugins/plugin-factory");
|
|
24
26
|
var _mergedCells = require("../../pm-plugins/utils/merged-cells");
|
|
@@ -270,8 +272,22 @@ var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedS
|
|
|
270
272
|
editorView = _ref5.editorView,
|
|
271
273
|
intl = _ref5.intl,
|
|
272
274
|
api = _ref5.api;
|
|
273
|
-
var _ref6 = (0, _hooks.useSharedPluginState)(api, ['table']
|
|
275
|
+
var _ref6 = (0, _hooks.useSharedPluginState)(api, ['table'], {
|
|
276
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
277
|
+
}),
|
|
274
278
|
tableState = _ref6.tableState;
|
|
279
|
+
|
|
280
|
+
// hoveredColumns
|
|
281
|
+
var hoveredColumnsSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'table.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, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'table.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;
|
|
275
291
|
return /*#__PURE__*/_react.default.createElement(DragHandleComponent, {
|
|
276
292
|
isDragMenuTarget: isDragMenuTarget,
|
|
277
293
|
tableLocalId: tableLocalId,
|
|
@@ -288,8 +304,8 @@ var DragHandleComponentWithSharedState = function DragHandleComponentWithSharedS
|
|
|
288
304
|
onClick: onClick,
|
|
289
305
|
editorView: editorView,
|
|
290
306
|
intl: intl,
|
|
291
|
-
hoveredColumns:
|
|
292
|
-
hoveredRows:
|
|
307
|
+
hoveredColumns: hoveredColumns,
|
|
308
|
+
hoveredRows: hoveredRows
|
|
293
309
|
});
|
|
294
310
|
};
|
|
295
311
|
var DragHandle = exports.DragHandle = (0, _reactIntlNext.injectIntl)(DragHandleComponent);
|
|
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.GlobalStylesWrapper = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
9
|
+
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
10
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
9
11
|
var _commonStyles = require("./common-styles");
|
|
10
12
|
/**
|
|
11
13
|
* @jsxRuntime classic
|
|
@@ -17,9 +19,16 @@ var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWra
|
|
|
17
19
|
var featureFlags = _ref.featureFlags,
|
|
18
20
|
isDragAndDropEnabledOption = _ref.isDragAndDropEnabledOption,
|
|
19
21
|
api = _ref.api;
|
|
20
|
-
|
|
22
|
+
// mode
|
|
23
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['editorViewMode'], {
|
|
24
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
|
|
25
|
+
}),
|
|
21
26
|
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
22
|
-
var
|
|
27
|
+
var modeSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'editorViewMode.mode', {
|
|
28
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
|
|
29
|
+
});
|
|
30
|
+
var mode = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
31
|
+
var isLivePageViewMode = mode === 'view';
|
|
23
32
|
return (0, _react.jsx)(_react.Global, {
|
|
24
33
|
styles: (0, _commonStyles.tableStyles)({
|
|
25
34
|
featureFlags: featureFlags,
|
|
@@ -248,6 +248,11 @@ class TableComponent extends React.Component {
|
|
|
248
248
|
)(state.tr);
|
|
249
249
|
if (!isUserTriggered) {
|
|
250
250
|
tintDirtyTransaction(tr);
|
|
251
|
+
if (fg('platform_editor_fix_table_resizing_undo')) {
|
|
252
|
+
// Avoid adding this transaction separately to the history as these are automatic updates
|
|
253
|
+
// as a consequence of another action
|
|
254
|
+
tr.setMeta('addToHistory', false);
|
|
255
|
+
}
|
|
251
256
|
}
|
|
252
257
|
dispatch(tr);
|
|
253
258
|
});
|
|
@@ -4,8 +4,10 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
6
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
7
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
8
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
8
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
9
11
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
10
12
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
11
13
|
import { TABLE_MAX_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
|
|
@@ -42,13 +44,26 @@ const AlignmentTableContainer = ({
|
|
|
42
44
|
const alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
|
|
43
45
|
const {
|
|
44
46
|
tableState
|
|
45
|
-
} = useSharedPluginState(pluginInjectionApi, ['table']
|
|
47
|
+
} = useSharedPluginState(pluginInjectionApi, ['table'], {
|
|
48
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// isFullWidthModeEnabled
|
|
52
|
+
const isTableFullWidthModeEnabledSelector = useSharedPluginStateSelector(pluginInjectionApi, 'table.isFullWidthModeEnabled', {
|
|
53
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
54
|
+
});
|
|
55
|
+
const isFullWidthModeEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isTableFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
56
|
+
|
|
57
|
+
// wasFullWidthModeEnabled
|
|
58
|
+
const wasFullWidthModeEnabledSelector = useSharedPluginStateSelector(pluginInjectionApi, 'table.wasFullWidthModeEnabled', {
|
|
59
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
60
|
+
});
|
|
61
|
+
const wasFullWidthModeEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? wasFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled;
|
|
46
62
|
useEffect(() => {
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
} = tableState;
|
|
63
|
+
if (editorExperiment('platform_editor_usesharedpluginstateselector', false) && !tableState) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (editorView && getPos) {
|
|
52
67
|
const {
|
|
53
68
|
state,
|
|
54
69
|
dispatch
|
|
@@ -66,7 +81,7 @@ const AlignmentTableContainer = ({
|
|
|
66
81
|
}
|
|
67
82
|
}
|
|
68
83
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
|
-
}, [editorView, tableState, node]);
|
|
84
|
+
}, [editorView, tableState, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
|
|
70
85
|
const style = useMemo(() => {
|
|
71
86
|
return getAlignmentStyle(alignment);
|
|
72
87
|
}, [alignment]);
|
|
@@ -129,10 +144,15 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
129
144
|
const [resizing, setIsResizing] = useState(false);
|
|
130
145
|
const {
|
|
131
146
|
tableState
|
|
132
|
-
} = useSharedPluginState(pluginInjectionApi, ['table']
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
147
|
+
} = useSharedPluginState(pluginInjectionApi, ['table'], {
|
|
148
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// isFullWidthModeEnabled
|
|
152
|
+
const isFullWidthModeEnabledSelector = useSharedPluginStateSelector(pluginInjectionApi, 'table.isFullWidthModeEnabled', {
|
|
153
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
154
|
+
});
|
|
155
|
+
const isFullWidthModeEnabled = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? isFullWidthModeEnabledSelector : tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
136
156
|
const updateContainerHeight = useCallback(height => {
|
|
137
157
|
var _containerRef$current;
|
|
138
158
|
// current StickyHeader State is not stable to be fetch.
|
|
@@ -188,7 +208,15 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
188
208
|
const tableWidth = getTableContainerWidth(node);
|
|
189
209
|
const {
|
|
190
210
|
editorViewModeState
|
|
191
|
-
} = useSharedPluginState(pluginInjectionApi, ['editorViewMode']
|
|
211
|
+
} = useSharedPluginState(pluginInjectionApi, ['editorViewMode'], {
|
|
212
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// mode
|
|
216
|
+
const modeSelector = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode', {
|
|
217
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
218
|
+
});
|
|
219
|
+
const mode = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
192
220
|
let responsiveContainerWidth = 0;
|
|
193
221
|
const resizeHandleSpacing = 12;
|
|
194
222
|
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
@@ -239,7 +267,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
239
267
|
onResizeStop,
|
|
240
268
|
isCommentEditor
|
|
241
269
|
};
|
|
242
|
-
const isLivePageViewMode = (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
270
|
+
const isLivePageViewMode = (editorExperiment('platform_editor_usesharedpluginstateselector', true) ? mode : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view';
|
|
243
271
|
return /*#__PURE__*/React.createElement(AlignmentTableContainerWrapper, {
|
|
244
272
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
245
273
|
node: node,
|
|
@@ -9,10 +9,12 @@ import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keyma
|
|
|
9
9
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
11
11
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
12
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
12
13
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
13
14
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
14
15
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
15
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
18
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
17
19
|
import { updateWidthToWidest } from '../pm-plugins/commands/misc';
|
|
18
20
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
@@ -124,10 +126,15 @@ export const TableResizer = ({
|
|
|
124
126
|
const resizerRef = useRef(null);
|
|
125
127
|
const {
|
|
126
128
|
tableState
|
|
127
|
-
} = useSharedPluginState(pluginInjectionApi, ['table']
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
} = useSharedPluginState(pluginInjectionApi, ['table'], {
|
|
130
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// widthToWidest
|
|
134
|
+
const widthToWidestSelector = useSharedPluginStateSelector(pluginInjectionApi, 'table.widthToWidest', {
|
|
135
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
136
|
+
});
|
|
137
|
+
const widthToWidest = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? widthToWidestSelector : tableState.widthToWidest;
|
|
131
138
|
|
|
132
139
|
// used to reposition tooltip when table is resizing via keyboard
|
|
133
140
|
const updateTooltip = React.useRef();
|
|
@@ -167,8 +174,8 @@ export const TableResizer = ({
|
|
|
167
174
|
} = useMeasureFramerate();
|
|
168
175
|
const excludeGuidelineConfig = useMemo(() => ({
|
|
169
176
|
innerGuidelines: !!isTableAlignmentEnabled,
|
|
170
|
-
breakoutPoints: !!(isTableAlignmentEnabled &&
|
|
171
|
-
}), [
|
|
177
|
+
breakoutPoints: !!(isTableAlignmentEnabled && isFullWidthModeEnabled)
|
|
178
|
+
}), [isFullWidthModeEnabled, isTableAlignmentEnabled]);
|
|
172
179
|
const updateActiveGuidelines = useCallback(({
|
|
173
180
|
gap,
|
|
174
181
|
keys
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
2
2
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
import { updateColumnWidths } from '../../transforms/column-width';
|
|
5
6
|
import { getTableWidth } from '../../utils/nodes';
|
|
6
7
|
import { getLayoutSize } from '../utils/misc';
|
|
@@ -163,9 +164,9 @@ export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabl
|
|
|
163
164
|
}
|
|
164
165
|
if (resizeState) {
|
|
165
166
|
tr = updateColumnWidths(resizeState, node, start, api)(tr);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
if (!fg('platform_editor_fix_table_resizing_undo')) {
|
|
168
|
+
tr.setMeta('addToHistory', false);
|
|
169
|
+
}
|
|
169
170
|
if (tr.docChanged) {
|
|
170
171
|
tr.setMeta('scrollIntoView', false);
|
|
171
172
|
// TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
|
|
@@ -12,6 +12,7 @@ import { getParentOfTypeCount, getPositionAfterTopParentNodeOfType } from '@atla
|
|
|
12
12
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
13
13
|
import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
|
|
14
14
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
15
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
15
16
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
16
17
|
import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
17
18
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -681,8 +682,15 @@ const tablePlugin = ({
|
|
|
681
682
|
}) {
|
|
682
683
|
const {
|
|
683
684
|
editorViewModeState
|
|
684
|
-
} = useSharedPluginState(api, ['editorViewMode']
|
|
685
|
-
|
|
685
|
+
} = useSharedPluginState(api, ['editorViewMode'], {
|
|
686
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
687
|
+
});
|
|
688
|
+
|
|
689
|
+
// mode
|
|
690
|
+
const modeSelector = useSharedPluginStateSelector(api, 'editorViewMode.mode', {
|
|
691
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
692
|
+
});
|
|
693
|
+
const mode = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? modeSelector : editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
686
694
|
useEffect(() => {
|
|
687
695
|
const {
|
|
688
696
|
state,
|
|
@@ -7,10 +7,12 @@ import { injectIntl } from 'react-intl-next';
|
|
|
7
7
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
8
8
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
9
9
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
10
11
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
11
12
|
import { findTable, TableMap } from '@atlaskit/editor-tables';
|
|
12
13
|
import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
13
14
|
import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
|
|
15
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
16
|
import { getPluginState as getDnDPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
|
|
15
17
|
import { getPluginState } from '../../pm-plugins/plugin-factory';
|
|
16
18
|
import { findDuplicatePosition, hasMergedCellsInSelection } from '../../pm-plugins/utils/merged-cells';
|
|
@@ -268,7 +270,21 @@ const DragHandleComponentWithSharedState = ({
|
|
|
268
270
|
}) => {
|
|
269
271
|
const {
|
|
270
272
|
tableState
|
|
271
|
-
} = useSharedPluginState(api, ['table']
|
|
273
|
+
} = useSharedPluginState(api, ['table'], {
|
|
274
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
// hoveredColumns
|
|
278
|
+
const hoveredColumnsSelector = useSharedPluginStateSelector(api, 'table.hoveredColumns', {
|
|
279
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
280
|
+
});
|
|
281
|
+
const hoveredColumns = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? hoveredColumnsSelector : tableState === null || tableState === void 0 ? void 0 : tableState.hoveredColumns;
|
|
282
|
+
|
|
283
|
+
// hoveredRows
|
|
284
|
+
const hoveredRowsSelector = useSharedPluginStateSelector(api, 'table.hoveredRows', {
|
|
285
|
+
disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
|
|
286
|
+
});
|
|
287
|
+
const hoveredRows = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? hoveredRowsSelector : tableState === null || tableState === void 0 ? void 0 : tableState.hoveredRows;
|
|
272
288
|
return /*#__PURE__*/React.createElement(DragHandleComponent, {
|
|
273
289
|
isDragMenuTarget: isDragMenuTarget,
|
|
274
290
|
tableLocalId: tableLocalId,
|
|
@@ -285,8 +301,8 @@ const DragHandleComponentWithSharedState = ({
|
|
|
285
301
|
onClick: onClick,
|
|
286
302
|
editorView: editorView,
|
|
287
303
|
intl: intl,
|
|
288
|
-
hoveredColumns:
|
|
289
|
-
hoveredRows:
|
|
304
|
+
hoveredColumns: hoveredColumns,
|
|
305
|
+
hoveredRows: hoveredRows
|
|
290
306
|
});
|
|
291
307
|
};
|
|
292
308
|
export const DragHandle = injectIntl(DragHandleComponent);
|