@atlaskit/editor-plugin-table 11.0.2 → 11.1.0
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 +21 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/nodeviews/TableComponent.js +57 -3
- package/dist/cjs/nodeviews/TableComponentWithSharedState.js +52 -38
- package/dist/cjs/nodeviews/TableContainer.js +39 -24
- package/dist/cjs/nodeviews/TableResizer.js +13 -8
- package/dist/cjs/tablePlugin.js +9 -4
- package/dist/cjs/ui/DragHandle/index.js +11 -5
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +9 -4
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +10 -5
- package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +10 -5
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +10 -5
- package/dist/cjs/ui/global-styles.js +9 -4
- package/dist/cjs/ui/icons/SortingIconWrapper.js +9 -4
- package/dist/es2019/nodeviews/TableComponent.js +52 -2
- package/dist/es2019/nodeviews/TableComponentWithSharedState.js +47 -32
- package/dist/es2019/nodeviews/TableContainer.js +33 -18
- package/dist/es2019/nodeviews/TableResizer.js +14 -8
- package/dist/es2019/tablePlugin.js +9 -3
- package/dist/es2019/ui/DragHandle/index.js +11 -4
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +9 -3
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +10 -4
- package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +10 -4
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +10 -4
- package/dist/es2019/ui/global-styles.js +9 -3
- package/dist/es2019/ui/icons/SortingIconWrapper.js +9 -3
- package/dist/esm/nodeviews/TableComponent.js +57 -2
- package/dist/esm/nodeviews/TableComponentWithSharedState.js +53 -39
- package/dist/esm/nodeviews/TableContainer.js +40 -25
- package/dist/esm/nodeviews/TableResizer.js +14 -9
- package/dist/esm/tablePlugin.js +10 -5
- package/dist/esm/ui/DragHandle/index.js +12 -6
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +10 -5
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +11 -6
- package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +11 -6
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +11 -6
- package/dist/esm/ui/global-styles.js +10 -5
- package/dist/esm/ui/icons/SortingIconWrapper.js +10 -5
- package/dist/types/nodeviews/TableComponent.d.ts +4 -0
- package/dist/types/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +4 -0
- package/dist/types-ts4.5/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
- package/package.json +6 -5
- package/src/nodeviews/TableComponent.tsx +57 -0
- package/src/nodeviews/TableComponentWithSharedState.tsx +62 -32
- package/src/nodeviews/TableContainer.tsx +40 -25
- package/src/nodeviews/TableResizer.tsx +10 -7
- package/src/tablePlugin.tsx +4 -2
- package/src/ui/DragHandle/index.tsx +9 -3
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +5 -3
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +5 -3
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +5 -3
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -3
- package/src/ui/global-styles.tsx +4 -2
- package/src/ui/icons/SortingIconWrapper.tsx +4 -2
- package/tsconfig.app.json +3 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
2
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -28,6 +29,8 @@ import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolba
|
|
|
28
29
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
29
30
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
30
31
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
32
|
+
import UFOLoadHold from '@atlaskit/react-ufo/load-hold';
|
|
33
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
31
34
|
import { autoSizeTable, clearHoverSelection } from '../pm-plugins/commands';
|
|
32
35
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils/autoscrollers';
|
|
33
36
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -67,6 +70,14 @@ var isOverflowAnalyticsEnabled = false;
|
|
|
67
70
|
// Prevent unnecessary parentWidth updates when table is nested inside of a node that is nested itself.
|
|
68
71
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MIN_THRESHOLD = 2;
|
|
69
72
|
var NESTED_TABLE_IN_NESTED_PARENT_WIDTH_DIFF_MAX_THRESHOLD = 20;
|
|
73
|
+
var _tableComponentCount = 1;
|
|
74
|
+
/**
|
|
75
|
+
* Exported for test purposes only
|
|
76
|
+
*/
|
|
77
|
+
export var _reset_tableComponentCount = function _reset_tableComponentCount() {
|
|
78
|
+
return _tableComponentCount = 0;
|
|
79
|
+
};
|
|
80
|
+
|
|
70
81
|
// Ignored via go/ees005
|
|
71
82
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
72
83
|
var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
@@ -78,6 +89,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
78
89
|
scroll: 0,
|
|
79
90
|
parentWidth: undefined
|
|
80
91
|
}, ShadowEvent.SHOW_BEFORE_SHADOW, false), ShadowEvent.SHOW_AFTER_SHADOW, false), "tableWrapperWidth", undefined), "tableWrapperHeight", undefined));
|
|
92
|
+
_defineProperty(_this, "holdCompleted", false);
|
|
93
|
+
_defineProperty(_this, "dispatchEventName", "tableResized-".concat(_tableComponentCount++));
|
|
81
94
|
_defineProperty(_this, "handleMouseOut", function (event) {
|
|
82
95
|
if (!isTableInFocus(_this.props.view)) {
|
|
83
96
|
return false;
|
|
@@ -700,6 +713,14 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
700
713
|
// Ignored via go/ees005
|
|
701
714
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
702
715
|
_this4.table, tableNode, shouldScaleOnColgroupUpdate, scalePercent);
|
|
716
|
+
if (expValEquals('cc_editor_ufo_hold_table_till_resize_complete', 'isEnabled', true)) {
|
|
717
|
+
// Mark table as updated for TableHold component (if no table exists yet, the colgroup update will not have done anything)
|
|
718
|
+
if (_this4.table && !_this4.holdCompleted) {
|
|
719
|
+
var customTableResizedEvent = new CustomEvent(_this4.dispatchEventName);
|
|
720
|
+
document.dispatchEvent(customTableResizedEvent);
|
|
721
|
+
_this4.holdCompleted = true;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
703
724
|
});
|
|
704
725
|
}
|
|
705
726
|
}
|
|
@@ -994,7 +1015,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
994
1015
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
995
1016
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
996
1017
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
997
|
-
}, /*#__PURE__*/React.createElement(
|
|
1018
|
+
}, expValEquals('cc_editor_ufo_hold_table_till_resize_complete', 'isEnabled', true) ? /*#__PURE__*/React.createElement(TableHold, {
|
|
1019
|
+
dispatchEventName: this.dispatchEventName
|
|
1020
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
|
998
1021
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
999
1022
|
className: ClassName.TABLE_STICKY_SENTINEL_TOP,
|
|
1000
1023
|
"data-testid": "sticky-sentinel-top"
|
|
@@ -1130,4 +1153,36 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1130
1153
|
}]);
|
|
1131
1154
|
}(React.Component);
|
|
1132
1155
|
_defineProperty(TableComponent, "displayName", 'TableComponent');
|
|
1133
|
-
export default injectIntl(TableComponent);
|
|
1156
|
+
export default injectIntl(TableComponent);
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* This is needed because of how currently the table is resized post client boot up with code that exists outside react
|
|
1160
|
+
*
|
|
1161
|
+
* This can be deleted once https://home.atlassian.com/o/2346a038-3c8c-498b-a79b-e7847859868d/s/a436116f-02ce-4520-8fbb-7301462a1674/project/ATLAS-97756/updates
|
|
1162
|
+
* is rolled out (and doesn't need to be used in the test arm of that change).
|
|
1163
|
+
*/
|
|
1164
|
+
var TableHold = /*#__PURE__*/React.memo(function TableHold(_ref) {
|
|
1165
|
+
var dispatchEventName = _ref.dispatchEventName;
|
|
1166
|
+
var _React$useState = React.useState(false),
|
|
1167
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
1168
|
+
tableUpdateConfirmed = _React$useState2[0],
|
|
1169
|
+
setTableUpdateConfirmed = _React$useState2[1];
|
|
1170
|
+
React.useEffect(function () {
|
|
1171
|
+
var customEventListener = function customEventListener() {
|
|
1172
|
+
setTableUpdateConfirmed(true);
|
|
1173
|
+
};
|
|
1174
|
+
|
|
1175
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
1176
|
+
document.addEventListener(dispatchEventName, customEventListener);
|
|
1177
|
+
return function () {
|
|
1178
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
1179
|
+
document.removeEventListener(dispatchEventName, customEventListener);
|
|
1180
|
+
};
|
|
1181
|
+
}, [dispatchEventName]);
|
|
1182
|
+
if (tableUpdateConfirmed === false) {
|
|
1183
|
+
return /*#__PURE__*/React.createElement(UFOLoadHold, {
|
|
1184
|
+
name: "editor_table_resize"
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
return null;
|
|
1188
|
+
});
|
|
@@ -1,44 +1,58 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
2
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { findTable } from '@atlaskit/editor-tables';
|
|
5
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
|
-
import { useInternalTablePluginStateSelector } from '../ui/hooks/useInternalTablePluginStateSelector';
|
|
7
5
|
import TableComponent from './TableComponent';
|
|
8
6
|
|
|
9
7
|
// Ignored via go/ees005
|
|
10
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
9
|
|
|
12
10
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
11
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction'], function (states) {
|
|
12
|
+
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;
|
|
13
|
+
return {
|
|
14
|
+
// tableState
|
|
15
|
+
isTableResizing: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isTableResizing,
|
|
16
|
+
isHeaderColumnEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.isHeaderColumnEnabled,
|
|
17
|
+
isHeaderRowEnabled: (_states$tableState3 = states.tableState) === null || _states$tableState3 === void 0 ? void 0 : _states$tableState3.isHeaderRowEnabled,
|
|
18
|
+
ordering: (_states$tableState4 = states.tableState) === null || _states$tableState4 === void 0 ? void 0 : _states$tableState4.ordering,
|
|
19
|
+
isResizing: (_states$tableState5 = states.tableState) === null || _states$tableState5 === void 0 ? void 0 : _states$tableState5.isResizing,
|
|
20
|
+
isInDanger: (_states$tableState6 = states.tableState) === null || _states$tableState6 === void 0 ? void 0 : _states$tableState6.isInDanger,
|
|
21
|
+
hoveredCell: (_states$tableState7 = states.tableState) === null || _states$tableState7 === void 0 ? void 0 : _states$tableState7.hoveredCell,
|
|
22
|
+
hoveredRows: (_states$tableState8 = states.tableState) === null || _states$tableState8 === void 0 ? void 0 : _states$tableState8.hoveredRows,
|
|
23
|
+
isTableHovered: (_states$tableState9 = states.tableState) === null || _states$tableState9 === void 0 ? void 0 : _states$tableState9.isTableHovered,
|
|
24
|
+
isWholeTableInDanger: (_states$tableState0 = states.tableState) === null || _states$tableState0 === void 0 ? void 0 : _states$tableState0.isWholeTableInDanger,
|
|
25
|
+
// Required so that table control re-renders
|
|
26
|
+
targetCellPosition: (_states$tableState1 = states.tableState) === null || _states$tableState1 === void 0 ? void 0 : _states$tableState1.targetCellPosition,
|
|
27
|
+
// mediaState
|
|
28
|
+
isFullscreen: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.isFullscreen,
|
|
29
|
+
// selectionState
|
|
30
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
|
|
31
|
+
// editorViewModeState
|
|
32
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
|
|
33
|
+
// widthState
|
|
34
|
+
width: (_states$widthState = states.widthState) === null || _states$widthState === void 0 ? void 0 : _states$widthState.width,
|
|
35
|
+
lineLength: (_states$widthState2 = states.widthState) === null || _states$widthState2 === void 0 ? void 0 : _states$widthState2.lineLength,
|
|
36
|
+
// interactionState
|
|
37
|
+
interaction: (_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
40
|
+
isTableResizing = _useSharedPluginState.isTableResizing,
|
|
41
|
+
isHeaderColumnEnabled = _useSharedPluginState.isHeaderColumnEnabled,
|
|
42
|
+
isHeaderRowEnabled = _useSharedPluginState.isHeaderRowEnabled,
|
|
43
|
+
ordering = _useSharedPluginState.ordering,
|
|
44
|
+
isResizing = _useSharedPluginState.isResizing,
|
|
45
|
+
isInDanger = _useSharedPluginState.isInDanger,
|
|
46
|
+
hoveredCell = _useSharedPluginState.hoveredCell,
|
|
47
|
+
hoveredRows = _useSharedPluginState.hoveredRows,
|
|
48
|
+
isTableHovered = _useSharedPluginState.isTableHovered,
|
|
49
|
+
isWholeTableInDanger = _useSharedPluginState.isWholeTableInDanger,
|
|
50
|
+
interaction = _useSharedPluginState.interaction,
|
|
51
|
+
isFullscreen = _useSharedPluginState.isFullscreen,
|
|
52
|
+
lineLength = _useSharedPluginState.lineLength,
|
|
53
|
+
mode = _useSharedPluginState.mode,
|
|
54
|
+
selection = _useSharedPluginState.selection,
|
|
55
|
+
width = _useSharedPluginState.width;
|
|
42
56
|
return {
|
|
43
57
|
tableState: undefined,
|
|
44
58
|
widthState: undefined,
|
|
@@ -60,13 +74,13 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
|
60
74
|
interaction: interaction
|
|
61
75
|
};
|
|
62
76
|
}, function (api) {
|
|
63
|
-
var
|
|
64
|
-
widthState =
|
|
65
|
-
tableState =
|
|
66
|
-
mediaState =
|
|
67
|
-
selectionState =
|
|
68
|
-
editorViewModeState =
|
|
69
|
-
interactionState =
|
|
77
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode', 'interaction']),
|
|
78
|
+
widthState = _useSharedPluginState2.widthState,
|
|
79
|
+
tableState = _useSharedPluginState2.tableState,
|
|
80
|
+
mediaState = _useSharedPluginState2.mediaState,
|
|
81
|
+
selectionState = _useSharedPluginState2.selectionState,
|
|
82
|
+
editorViewModeState = _useSharedPluginState2.editorViewModeState,
|
|
83
|
+
interactionState = _useSharedPluginState2.interactionState;
|
|
70
84
|
var tableStateInternal = tableState;
|
|
71
85
|
return {
|
|
72
86
|
tableState: tableState,
|
|
@@ -3,9 +3,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
8
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
9
8
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
10
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -34,17 +33,24 @@ var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
34
33
|
"data-testid": "table-container"
|
|
35
34
|
}, children);
|
|
36
35
|
});
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
|
|
36
|
+
var useAlignmentTableContainerSharedState = sharedPluginStateHookMigratorFactory(function (pluginInjectionApi) {
|
|
37
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], function (states) {
|
|
38
|
+
var _states$tableState, _states$tableState2;
|
|
39
|
+
return {
|
|
40
|
+
isFullWidthModeEnabled: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isFullWidthModeEnabled,
|
|
41
|
+
wasFullWidthModeEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.wasFullWidthModeEnabled
|
|
42
|
+
};
|
|
43
|
+
}),
|
|
44
|
+
isFullWidthModeEnabled = _useSharedPluginState.isFullWidthModeEnabled,
|
|
45
|
+
wasFullWidthModeEnabled = _useSharedPluginState.wasFullWidthModeEnabled;
|
|
40
46
|
return {
|
|
41
47
|
tableState: undefined,
|
|
42
48
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
43
49
|
wasFullWidthModeEnabled: wasFullWidthModeEnabled
|
|
44
50
|
};
|
|
45
51
|
}, function (pluginInjectionApi) {
|
|
46
|
-
var
|
|
47
|
-
tableState =
|
|
52
|
+
var _useSharedPluginState2 = useSharedPluginState(pluginInjectionApi, ['table']),
|
|
53
|
+
tableState = _useSharedPluginState2.tableState;
|
|
48
54
|
return {
|
|
49
55
|
tableState: tableState,
|
|
50
56
|
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
@@ -58,10 +64,10 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
58
64
|
getPos = _ref2.getPos,
|
|
59
65
|
editorView = _ref2.editorView;
|
|
60
66
|
var alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
|
|
61
|
-
var
|
|
62
|
-
tableState =
|
|
63
|
-
isFullWidthModeEnabled =
|
|
64
|
-
wasFullWidthModeEnabled =
|
|
67
|
+
var _useAlignmentTableCon = useAlignmentTableContainerSharedState(pluginInjectionApi),
|
|
68
|
+
tableState = _useAlignmentTableCon.tableState,
|
|
69
|
+
isFullWidthModeEnabled = _useAlignmentTableCon.isFullWidthModeEnabled,
|
|
70
|
+
wasFullWidthModeEnabled = _useAlignmentTableCon.wasFullWidthModeEnabled;
|
|
65
71
|
useEffect(function () {
|
|
66
72
|
if (!tableState && editorExperiment('platform_editor_usesharedpluginstateselector', false)) {
|
|
67
73
|
return;
|
|
@@ -120,20 +126,27 @@ var AlignmentTableContainerWrapper = function AlignmentTableContainerWrapper(_re
|
|
|
120
126
|
editorView: editorView
|
|
121
127
|
}, children);
|
|
122
128
|
};
|
|
123
|
-
var
|
|
124
|
-
var isFullWidthModeEnabled = useSharedPluginStateSelector(pluginInjectionApi, 'table.isFullWidthModeEnabled');
|
|
125
|
-
var mode = useSharedPluginStateSelector(pluginInjectionApi, 'editorViewMode.mode');
|
|
129
|
+
var selector = function selector(states) {
|
|
126
130
|
return {
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
tableState: states.tableState,
|
|
132
|
+
editorViewModeState: states.editorViewModeState
|
|
129
133
|
};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
};
|
|
135
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
136
|
+
var _useSharedPluginState3 = useSharedPluginStateWithSelector(api, ['table', 'editorViewMode'], selector),
|
|
137
|
+
tableState = _useSharedPluginState3.tableState,
|
|
138
|
+
editorViewModeState = _useSharedPluginState3.editorViewModeState;
|
|
134
139
|
return {
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
tableState: tableState,
|
|
141
|
+
editorViewModeState: editorViewModeState
|
|
142
|
+
};
|
|
143
|
+
}, function (api) {
|
|
144
|
+
var _useSharedPluginState4 = useSharedPluginState(api, ['table', 'editorViewMode']),
|
|
145
|
+
tableState = _useSharedPluginState4.tableState,
|
|
146
|
+
editorViewModeState = _useSharedPluginState4.editorViewModeState;
|
|
147
|
+
return {
|
|
148
|
+
tableState: tableState,
|
|
149
|
+
editorViewModeState: editorViewModeState
|
|
137
150
|
};
|
|
138
151
|
});
|
|
139
152
|
export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
@@ -160,9 +173,11 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
160
173
|
_useState2 = _slicedToArray(_useState, 2),
|
|
161
174
|
resizing = _useState2[0],
|
|
162
175
|
setIsResizing = _useState2[1];
|
|
163
|
-
var
|
|
164
|
-
|
|
165
|
-
|
|
176
|
+
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
177
|
+
tableState = _useSharedState.tableState,
|
|
178
|
+
editorViewModeState = _useSharedState.editorViewModeState;
|
|
179
|
+
var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
180
|
+
var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
166
181
|
var updateContainerHeight = useCallback(function (height) {
|
|
167
182
|
var _containerRef$current;
|
|
168
183
|
// current StickyHeader State is not stable to be fetch.
|
|
@@ -8,7 +8,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
8
8
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
9
9
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
10
10
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
11
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
11
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
12
12
|
import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
13
13
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
14
14
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
@@ -30,7 +30,6 @@ import { generateResizedPayload, generateResizeFrameRatePayloads, useMeasureFram
|
|
|
30
30
|
import { defaultGuidelines, defaultGuidelinesForPreserveTable, PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET } from '../pm-plugins/utils/guidelines';
|
|
31
31
|
import { defaultSnappingWidths, defaultTablePreserveSnappingWidths, findClosestSnap, PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET } from '../pm-plugins/utils/snapping';
|
|
32
32
|
import { TABLE_GUIDELINE_VISIBLE_ADJUSTMENT, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
|
|
33
|
-
import { useInternalTablePluginStateSelector } from '../ui/hooks/useInternalTablePluginStateSelector';
|
|
34
33
|
var RESIZE_STEP_VALUE = 10;
|
|
35
34
|
var handles = {
|
|
36
35
|
right: true
|
|
@@ -96,17 +95,23 @@ var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWi
|
|
|
96
95
|
return guideline.position && guideline.position.x !== undefined && typeof guideline.position.x === 'number' && Math.abs(guideline.position.x * 2) < width + guidelineVisibleAdjustment;
|
|
97
96
|
});
|
|
98
97
|
};
|
|
99
|
-
var
|
|
100
|
-
var
|
|
98
|
+
var selector = function selector(states) {
|
|
99
|
+
var _states$tableState;
|
|
100
|
+
return {
|
|
101
|
+
widthToWidest: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.widthToWidest
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
105
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table'], selector),
|
|
106
|
+
widthToWidest = _useSharedPluginState.widthToWidest;
|
|
101
107
|
return {
|
|
102
108
|
widthToWidest: widthToWidest
|
|
103
109
|
};
|
|
104
|
-
}, function (
|
|
105
|
-
var
|
|
106
|
-
tableState =
|
|
107
|
-
var tableStateInternal = tableState;
|
|
110
|
+
}, function (api) {
|
|
111
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['table']),
|
|
112
|
+
tableState = _useSharedPluginState2.tableState;
|
|
108
113
|
return {
|
|
109
|
-
widthToWidest:
|
|
114
|
+
widthToWidest: tableState === null || tableState === void 0 ? void 0 : tableState.widthToWidest
|
|
110
115
|
};
|
|
111
116
|
});
|
|
112
117
|
export var TableResizer = function TableResizer(_ref) {
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -7,7 +7,7 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TA
|
|
|
7
7
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
8
8
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
9
9
|
import { getDomRefFromSelection } from '@atlaskit/editor-common/get-dom-ref-from-selection';
|
|
10
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { IconTable } from '@atlaskit/editor-common/icons';
|
|
12
12
|
import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
13
13
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
@@ -15,7 +15,6 @@ import { getParentOfTypeCount, getPositionAfterTopParentNodeOfType } from '@atla
|
|
|
15
15
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
16
16
|
import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
|
|
17
17
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
18
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
19
18
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
20
19
|
import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
21
20
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -66,13 +65,19 @@ var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
|
66
65
|
return {};
|
|
67
66
|
};
|
|
68
67
|
var useTableSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
69
|
-
var
|
|
68
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorViewMode'], function (states) {
|
|
69
|
+
var _states$editorViewMod;
|
|
70
|
+
return {
|
|
71
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
72
|
+
};
|
|
73
|
+
}),
|
|
74
|
+
mode = _useSharedPluginState.mode;
|
|
70
75
|
return {
|
|
71
76
|
mode: mode
|
|
72
77
|
};
|
|
73
78
|
}, function (api) {
|
|
74
|
-
var
|
|
75
|
-
editorViewModeState =
|
|
79
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['editorViewMode']),
|
|
80
|
+
editorViewModeState = _useSharedPluginState2.editorViewModeState;
|
|
76
81
|
return {
|
|
77
82
|
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
78
83
|
};
|
|
@@ -7,7 +7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
import ReactDOM from 'react-dom';
|
|
8
8
|
import { injectIntl } from 'react-intl-next';
|
|
9
9
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
10
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
10
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
11
11
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
12
12
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
13
13
|
import { findTable, TableMap } from '@atlaskit/editor-tables';
|
|
@@ -19,7 +19,6 @@ import { findDuplicatePosition, hasMergedCellsInSelection } from '../../pm-plugi
|
|
|
19
19
|
import { TableCssClassName as ClassName } from '../../types';
|
|
20
20
|
import { dragTableInsertColumnButtonSize } from '../consts';
|
|
21
21
|
import { DragPreview } from '../DragPreview';
|
|
22
|
-
import { useInternalTablePluginStateSelector } from '../hooks/useInternalTablePluginStateSelector';
|
|
23
22
|
import { HandleIconComponent } from './HandleIconComponent';
|
|
24
23
|
var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
25
24
|
var isDragMenuTarget = _ref.isDragMenuTarget,
|
|
@@ -245,15 +244,22 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
245
244
|
}), previewContainer));
|
|
246
245
|
};
|
|
247
246
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
248
|
-
var
|
|
249
|
-
|
|
247
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table'], function (states) {
|
|
248
|
+
var _states$tableState, _states$tableState2;
|
|
249
|
+
return {
|
|
250
|
+
hoveredColumns: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.hoveredColumns,
|
|
251
|
+
hoveredRows: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.hoveredRows
|
|
252
|
+
};
|
|
253
|
+
}),
|
|
254
|
+
hoveredColumns = _useSharedPluginState.hoveredColumns,
|
|
255
|
+
hoveredRows = _useSharedPluginState.hoveredRows;
|
|
250
256
|
return {
|
|
251
257
|
hoveredColumns: hoveredColumns,
|
|
252
258
|
hoveredRows: hoveredRows
|
|
253
259
|
};
|
|
254
260
|
}, function (api) {
|
|
255
|
-
var
|
|
256
|
-
tableState =
|
|
261
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['table']),
|
|
262
|
+
tableState = _useSharedPluginState2.tableState;
|
|
257
263
|
var tableStateInternal = tableState;
|
|
258
264
|
return {
|
|
259
265
|
hoveredColumns: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredColumns,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
4
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
6
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
6
|
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
8
7
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
9
8
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
@@ -25,13 +24,19 @@ var getSelectedColumns = function getSelectedColumns(selection) {
|
|
|
25
24
|
return [];
|
|
26
25
|
};
|
|
27
26
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
28
|
-
var
|
|
27
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
28
|
+
var _states$selectionStat;
|
|
29
|
+
return {
|
|
30
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
31
|
+
};
|
|
32
|
+
}),
|
|
33
|
+
selection = _useSharedPluginState.selection;
|
|
29
34
|
return {
|
|
30
35
|
selection: selection
|
|
31
36
|
};
|
|
32
37
|
}, function (api) {
|
|
33
|
-
var
|
|
34
|
-
selectionState =
|
|
38
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['selection']),
|
|
39
|
+
selectionState = _useSharedPluginState2.selectionState;
|
|
35
40
|
return {
|
|
36
41
|
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
37
42
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { injectIntl } from 'react-intl-next';
|
|
4
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
4
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
5
5
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
6
|
import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
|
|
8
7
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
9
8
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -51,13 +50,19 @@ var DragCornerControlsComponent = function DragCornerControlsComponent(_ref) {
|
|
|
51
50
|
}));
|
|
52
51
|
};
|
|
53
52
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
54
|
-
var
|
|
53
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
54
|
+
var _states$selectionStat;
|
|
55
|
+
return {
|
|
56
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
57
|
+
};
|
|
58
|
+
}),
|
|
59
|
+
selection = _useSharedPluginState.selection;
|
|
55
60
|
return {
|
|
56
|
-
selection:
|
|
61
|
+
selection: selection
|
|
57
62
|
};
|
|
58
63
|
}, function (api) {
|
|
59
|
-
var
|
|
60
|
-
selectionState =
|
|
64
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['selection']),
|
|
65
|
+
selectionState = _useSharedPluginState2.selectionState;
|
|
61
66
|
return {
|
|
62
67
|
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
63
68
|
};
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
2
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { CornerControls } from './CornerControls/ClassicCornerControls';
|
|
5
4
|
import { RowControls } from './RowControls/ClassicControls';
|
|
6
5
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
7
|
-
var
|
|
6
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
7
|
+
var _states$selectionStat;
|
|
8
|
+
return {
|
|
9
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
10
|
+
};
|
|
11
|
+
}),
|
|
12
|
+
selection = _useSharedPluginState.selection;
|
|
8
13
|
return {
|
|
9
|
-
selection:
|
|
14
|
+
selection: selection
|
|
10
15
|
};
|
|
11
16
|
}, function (api) {
|
|
12
|
-
var
|
|
13
|
-
selectionState =
|
|
17
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['selection']),
|
|
18
|
+
selectionState = _useSharedPluginState2.selectionState;
|
|
14
19
|
return {
|
|
15
20
|
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
16
21
|
};
|
|
@@ -2,8 +2,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
2
2
|
/* eslint-disable @atlaskit/design-system/prefer-primitives */
|
|
3
3
|
|
|
4
4
|
import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
|
|
5
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
6
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
5
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
6
|
import { CellSelection } from '@atlaskit/editor-tables';
|
|
8
7
|
import { getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
9
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -279,13 +278,19 @@ export var DragControls = function DragControls(_ref) {
|
|
|
279
278
|
);
|
|
280
279
|
};
|
|
281
280
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
282
|
-
var
|
|
281
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['selection'], function (states) {
|
|
282
|
+
var _states$selectionStat;
|
|
283
|
+
return {
|
|
284
|
+
selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
|
|
285
|
+
};
|
|
286
|
+
}),
|
|
287
|
+
selection = _useSharedPluginState.selection;
|
|
283
288
|
return {
|
|
284
|
-
selection:
|
|
289
|
+
selection: selection
|
|
285
290
|
};
|
|
286
291
|
}, function (api) {
|
|
287
|
-
var
|
|
288
|
-
selectionState =
|
|
292
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['selection']),
|
|
293
|
+
selectionState = _useSharedPluginState2.selectionState;
|
|
289
294
|
return {
|
|
290
295
|
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
|
|
291
296
|
};
|
|
@@ -4,17 +4,22 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { Global, jsx } from '@emotion/react';
|
|
7
|
-
import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
8
|
-
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
|
+
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
9
8
|
import { tableStyles } from './common-styles';
|
|
10
9
|
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
11
|
-
var
|
|
10
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['editorViewMode'], function (states) {
|
|
11
|
+
var _states$editorViewMod;
|
|
12
|
+
return {
|
|
13
|
+
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
14
|
+
};
|
|
15
|
+
}),
|
|
16
|
+
mode = _useSharedPluginState.mode;
|
|
12
17
|
return {
|
|
13
18
|
mode: mode
|
|
14
19
|
};
|
|
15
20
|
}, function (api) {
|
|
16
|
-
var
|
|
17
|
-
editorViewModeState =
|
|
21
|
+
var _useSharedPluginState2 = useSharedPluginState(api, ['editorViewMode']),
|
|
22
|
+
editorViewModeState = _useSharedPluginState2.editorViewModeState;
|
|
18
23
|
return {
|
|
19
24
|
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
20
25
|
};
|