@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
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { SortingIcon } from '@atlaskit/editor-common/table';
|
|
4
|
-
const
|
|
4
|
+
export const SortingIconWrapper = props => {
|
|
5
5
|
const {
|
|
6
6
|
mode
|
|
7
|
-
} = useSharedPluginStateWithSelector(api, ['editorViewMode'], states => {
|
|
7
|
+
} = useSharedPluginStateWithSelector(props.api, ['editorViewMode'], states => {
|
|
8
8
|
var _states$editorViewMod;
|
|
9
9
|
return {
|
|
10
10
|
mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
|
|
11
11
|
};
|
|
12
12
|
});
|
|
13
|
-
return {
|
|
14
|
-
mode
|
|
15
|
-
};
|
|
16
|
-
}, api => {
|
|
17
|
-
const {
|
|
18
|
-
editorViewModeState
|
|
19
|
-
} = useSharedPluginState(api, ['editorViewMode']);
|
|
20
|
-
return {
|
|
21
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
export const SortingIconWrapper = props => {
|
|
25
|
-
const {
|
|
26
|
-
mode
|
|
27
|
-
} = useSharedState(props.api);
|
|
28
13
|
if (mode === 'edit') {
|
|
29
14
|
return null;
|
|
30
15
|
}
|
|
@@ -33,7 +33,7 @@ export const InsertMarker = cssString => css`
|
|
|
33
33
|
}
|
|
34
34
|
`;
|
|
35
35
|
const Button = cssString => css`
|
|
36
|
-
border-radius: ${"var(--ds-
|
|
36
|
+
border-radius: ${"var(--ds-radius-small, 3px)"};
|
|
37
37
|
border-width: 0px;
|
|
38
38
|
display: inline-flex;
|
|
39
39
|
max-width: 100%;
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
3
3
|
import { findTable } from '@atlaskit/editor-tables';
|
|
4
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
4
|
import TableComponent from './TableComponent';
|
|
7
5
|
|
|
8
6
|
// Ignored via go/ees005
|
|
9
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
11
|
+
*/
|
|
12
|
+
export var TableComponentWithSharedState = function TableComponentWithSharedState(_ref) {
|
|
13
|
+
var view = _ref.view,
|
|
14
|
+
options = _ref.options,
|
|
15
|
+
getNode = _ref.getNode,
|
|
16
|
+
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
17
|
+
api = _ref.api,
|
|
18
|
+
getEditorFeatureFlags = _ref.getEditorFeatureFlags,
|
|
19
|
+
eventDispatcher = _ref.eventDispatcher,
|
|
20
|
+
allowColumnResizing = _ref.allowColumnResizing,
|
|
21
|
+
allowControls = _ref.allowControls,
|
|
22
|
+
getPos = _ref.getPos,
|
|
23
|
+
forwardRef = _ref.forwardRef,
|
|
24
|
+
allowTableAlignment = _ref.allowTableAlignment,
|
|
25
|
+
allowTableResizing = _ref.allowTableResizing;
|
|
12
26
|
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction'], function (states) {
|
|
13
27
|
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;
|
|
14
28
|
return {
|
|
@@ -54,97 +68,7 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
|
54
68
|
mode = _useSharedPluginState.mode,
|
|
55
69
|
selection = _useSharedPluginState.selection,
|
|
56
70
|
width = _useSharedPluginState.width;
|
|
57
|
-
return {
|
|
58
|
-
tableState: undefined,
|
|
59
|
-
widthState: undefined,
|
|
60
|
-
isTableResizing: isTableResizing,
|
|
61
|
-
isHeaderColumnEnabled: isHeaderColumnEnabled,
|
|
62
|
-
isHeaderRowEnabled: isHeaderRowEnabled,
|
|
63
|
-
ordering: ordering,
|
|
64
|
-
isResizing: isResizing,
|
|
65
|
-
isInDanger: isInDanger,
|
|
66
|
-
hoveredCell: hoveredCell,
|
|
67
|
-
hoveredRows: hoveredRows,
|
|
68
|
-
isTableHovered: isTableHovered,
|
|
69
|
-
isWholeTableInDanger: isWholeTableInDanger,
|
|
70
|
-
isFullscreen: isFullscreen,
|
|
71
|
-
selection: selection,
|
|
72
|
-
mode: mode,
|
|
73
|
-
width: width,
|
|
74
|
-
lineLength: lineLength,
|
|
75
|
-
interaction: interaction
|
|
76
|
-
};
|
|
77
|
-
}, function (api) {
|
|
78
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode', 'interaction']),
|
|
79
|
-
widthState = _useSharedPluginState2.widthState,
|
|
80
|
-
tableState = _useSharedPluginState2.tableState,
|
|
81
|
-
mediaState = _useSharedPluginState2.mediaState,
|
|
82
|
-
selectionState = _useSharedPluginState2.selectionState,
|
|
83
|
-
editorViewModeState = _useSharedPluginState2.editorViewModeState,
|
|
84
|
-
interactionState = _useSharedPluginState2.interactionState;
|
|
85
|
-
var tableStateInternal = tableState;
|
|
86
|
-
return {
|
|
87
|
-
tableState: tableState,
|
|
88
|
-
widthState: widthState,
|
|
89
|
-
isTableResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableResizing,
|
|
90
|
-
isHeaderColumnEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderColumnEnabled,
|
|
91
|
-
isHeaderRowEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderRowEnabled,
|
|
92
|
-
ordering: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.ordering,
|
|
93
|
-
isResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isResizing,
|
|
94
|
-
isInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isInDanger,
|
|
95
|
-
hoveredCell: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredCell,
|
|
96
|
-
hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows,
|
|
97
|
-
isTableHovered: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableHovered,
|
|
98
|
-
isWholeTableInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isWholeTableInDanger,
|
|
99
|
-
isFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
|
|
100
|
-
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
|
|
101
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
102
|
-
width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
|
|
103
|
-
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
|
|
104
|
-
interaction: interactionState === null || interactionState === void 0 ? void 0 : interactionState.interactionState
|
|
105
|
-
};
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
110
|
-
*/
|
|
111
|
-
export var TableComponentWithSharedState = function TableComponentWithSharedState(_ref) {
|
|
112
|
-
var view = _ref.view,
|
|
113
|
-
options = _ref.options,
|
|
114
|
-
getNode = _ref.getNode,
|
|
115
|
-
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
116
|
-
api = _ref.api,
|
|
117
|
-
getEditorFeatureFlags = _ref.getEditorFeatureFlags,
|
|
118
|
-
eventDispatcher = _ref.eventDispatcher,
|
|
119
|
-
allowColumnResizing = _ref.allowColumnResizing,
|
|
120
|
-
allowControls = _ref.allowControls,
|
|
121
|
-
getPos = _ref.getPos,
|
|
122
|
-
forwardRef = _ref.forwardRef,
|
|
123
|
-
allowTableAlignment = _ref.allowTableAlignment,
|
|
124
|
-
allowTableResizing = _ref.allowTableResizing;
|
|
125
|
-
var _useSharedState = useSharedState(api),
|
|
126
|
-
tableState = _useSharedState.tableState,
|
|
127
|
-
widthState = _useSharedState.widthState,
|
|
128
|
-
mode = _useSharedState.mode,
|
|
129
|
-
hoveredCell = _useSharedState.hoveredCell,
|
|
130
|
-
hoveredRows = _useSharedState.hoveredRows,
|
|
131
|
-
isFullscreen = _useSharedState.isFullscreen,
|
|
132
|
-
isHeaderColumnEnabled = _useSharedState.isHeaderColumnEnabled,
|
|
133
|
-
isHeaderRowEnabled = _useSharedState.isHeaderRowEnabled,
|
|
134
|
-
isInDanger = _useSharedState.isInDanger,
|
|
135
|
-
isResizing = _useSharedState.isResizing,
|
|
136
|
-
isTableHovered = _useSharedState.isTableHovered,
|
|
137
|
-
isTableResizing = _useSharedState.isTableResizing,
|
|
138
|
-
isWholeTableInDanger = _useSharedState.isWholeTableInDanger,
|
|
139
|
-
lineLength = _useSharedState.lineLength,
|
|
140
|
-
ordering = _useSharedState.ordering,
|
|
141
|
-
selection = _useSharedState.selection,
|
|
142
|
-
width = _useSharedState.width,
|
|
143
|
-
interaction = _useSharedState.interaction;
|
|
144
71
|
var isLivePageViewMode = mode === 'view';
|
|
145
|
-
if (expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false) && !tableState) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
72
|
|
|
149
73
|
/**
|
|
150
74
|
* ED-19810
|
|
@@ -178,13 +102,10 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
|
|
|
178
102
|
ordering: ordering,
|
|
179
103
|
isResizing: isResizing,
|
|
180
104
|
getNode: getNode,
|
|
181
|
-
containerWidth:
|
|
105
|
+
containerWidth: {
|
|
182
106
|
width: width !== null && width !== void 0 ? width : 0,
|
|
183
107
|
lineLength: lineLength
|
|
184
|
-
}
|
|
185
|
-
// Ignored via go/ees005
|
|
186
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
187
|
-
widthState,
|
|
108
|
+
},
|
|
188
109
|
contentDOM: forwardRef,
|
|
189
110
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
190
111
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -4,7 +4,7 @@ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState }
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
7
|
-
import {
|
|
7
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
8
8
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
9
9
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -36,7 +36,13 @@ var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
36
36
|
"data-testid": "table-container"
|
|
37
37
|
}, children);
|
|
38
38
|
});
|
|
39
|
-
var
|
|
39
|
+
var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
40
|
+
var node = _ref2.node,
|
|
41
|
+
children = _ref2.children,
|
|
42
|
+
pluginInjectionApi = _ref2.pluginInjectionApi,
|
|
43
|
+
getPos = _ref2.getPos,
|
|
44
|
+
editorView = _ref2.editorView;
|
|
45
|
+
var alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
|
|
40
46
|
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], function (states) {
|
|
41
47
|
var _states$tableState, _states$tableState2;
|
|
42
48
|
return {
|
|
@@ -46,35 +52,7 @@ var useAlignmentTableContainerSharedState = sharedPluginStateHookMigratorFactory
|
|
|
46
52
|
}),
|
|
47
53
|
isFullWidthModeEnabled = _useSharedPluginState.isFullWidthModeEnabled,
|
|
48
54
|
wasFullWidthModeEnabled = _useSharedPluginState.wasFullWidthModeEnabled;
|
|
49
|
-
return {
|
|
50
|
-
tableState: undefined,
|
|
51
|
-
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
52
|
-
wasFullWidthModeEnabled: wasFullWidthModeEnabled
|
|
53
|
-
};
|
|
54
|
-
}, function (pluginInjectionApi) {
|
|
55
|
-
var _useSharedPluginState2 = useSharedPluginState(pluginInjectionApi, ['table']),
|
|
56
|
-
tableState = _useSharedPluginState2.tableState;
|
|
57
|
-
return {
|
|
58
|
-
tableState: tableState,
|
|
59
|
-
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
60
|
-
wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
64
|
-
var node = _ref2.node,
|
|
65
|
-
children = _ref2.children,
|
|
66
|
-
pluginInjectionApi = _ref2.pluginInjectionApi,
|
|
67
|
-
getPos = _ref2.getPos,
|
|
68
|
-
editorView = _ref2.editorView;
|
|
69
|
-
var alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
|
|
70
|
-
var _useAlignmentTableCon = useAlignmentTableContainerSharedState(pluginInjectionApi),
|
|
71
|
-
tableState = _useAlignmentTableCon.tableState,
|
|
72
|
-
isFullWidthModeEnabled = _useAlignmentTableCon.isFullWidthModeEnabled,
|
|
73
|
-
wasFullWidthModeEnabled = _useAlignmentTableCon.wasFullWidthModeEnabled;
|
|
74
55
|
useEffect(function () {
|
|
75
|
-
if (!tableState && expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false)) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
56
|
if (editorView && getPos) {
|
|
79
57
|
var state = editorView.state,
|
|
80
58
|
dispatch = editorView.dispatch;
|
|
@@ -91,7 +69,7 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
|
|
|
91
69
|
}
|
|
92
70
|
}
|
|
93
71
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
|
-
}, [editorView,
|
|
72
|
+
}, [editorView, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
|
|
95
73
|
var style = useMemo(function () {
|
|
96
74
|
return getAlignmentStyle(alignment);
|
|
97
75
|
}, [alignment]);
|
|
@@ -137,23 +115,6 @@ var selector = function selector(states) {
|
|
|
137
115
|
editorViewModeState: states.editorViewModeState
|
|
138
116
|
};
|
|
139
117
|
};
|
|
140
|
-
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
141
|
-
var _useSharedPluginState3 = useSharedPluginStateWithSelector(api, ['table', 'editorViewMode'], selector),
|
|
142
|
-
tableState = _useSharedPluginState3.tableState,
|
|
143
|
-
editorViewModeState = _useSharedPluginState3.editorViewModeState;
|
|
144
|
-
return {
|
|
145
|
-
tableState: tableState,
|
|
146
|
-
editorViewModeState: editorViewModeState
|
|
147
|
-
};
|
|
148
|
-
}, function (api) {
|
|
149
|
-
var _useSharedPluginState4 = useSharedPluginState(api, ['table', 'editorViewMode']),
|
|
150
|
-
tableState = _useSharedPluginState4.tableState,
|
|
151
|
-
editorViewModeState = _useSharedPluginState4.editorViewModeState;
|
|
152
|
-
return {
|
|
153
|
-
tableState: tableState,
|
|
154
|
-
editorViewModeState: editorViewModeState
|
|
155
|
-
};
|
|
156
|
-
});
|
|
157
118
|
var getPadding = function getPadding(containerWidth) {
|
|
158
119
|
return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
159
120
|
};
|
|
@@ -181,9 +142,9 @@ var ResizableTableContainerLegacy = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
181
142
|
_useState2 = _slicedToArray(_useState, 2),
|
|
182
143
|
resizing = _useState2[0],
|
|
183
144
|
setIsResizing = _useState2[1];
|
|
184
|
-
var
|
|
185
|
-
tableState =
|
|
186
|
-
editorViewModeState =
|
|
145
|
+
var _useSharedPluginState2 = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector),
|
|
146
|
+
tableState = _useSharedPluginState2.tableState,
|
|
147
|
+
editorViewModeState = _useSharedPluginState2.editorViewModeState;
|
|
187
148
|
var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
188
149
|
var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
189
150
|
var updateContainerHeight = useCallback(function (height) {
|
|
@@ -382,9 +343,9 @@ var ResizableTableContainerNext = /*#__PURE__*/React.memo(function (_ref5) {
|
|
|
382
343
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
383
344
|
tableMaxWidthForFullPageOnLoad = _useState6[0],
|
|
384
345
|
setTableMaxWidthForFullPageOnLoad = _useState6[1];
|
|
385
|
-
var
|
|
386
|
-
tableState =
|
|
387
|
-
editorViewModeState =
|
|
346
|
+
var _useSharedPluginState3 = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector),
|
|
347
|
+
tableState = _useSharedPluginState3.tableState,
|
|
348
|
+
editorViewModeState = _useSharedPluginState3.editorViewModeState;
|
|
388
349
|
var isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
389
350
|
var mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
390
351
|
var updateContainerHeight = useCallback(function (height) {
|
|
@@ -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 {
|
|
11
|
+
import { 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';
|
|
@@ -107,19 +107,6 @@ var selector = function selector(states) {
|
|
|
107
107
|
widthToWidest: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.widthToWidest
|
|
108
108
|
};
|
|
109
109
|
};
|
|
110
|
-
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
111
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table'], selector),
|
|
112
|
-
widthToWidest = _useSharedPluginState.widthToWidest;
|
|
113
|
-
return {
|
|
114
|
-
widthToWidest: widthToWidest
|
|
115
|
-
};
|
|
116
|
-
}, function (api) {
|
|
117
|
-
var _useSharedPluginState2 = useSharedPluginState(api, ['table']),
|
|
118
|
-
tableState = _useSharedPluginState2.tableState;
|
|
119
|
-
return {
|
|
120
|
-
widthToWidest: tableState === null || tableState === void 0 ? void 0 : tableState.widthToWidest
|
|
121
|
-
};
|
|
122
|
-
});
|
|
123
110
|
export var TableResizer = function TableResizer(_ref) {
|
|
124
111
|
var _editorView$state, _pluginInjectionApi$a2;
|
|
125
112
|
var children = _ref.children,
|
|
@@ -152,8 +139,8 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
152
139
|
var areResizeMetaKeysPressed = useRef(false);
|
|
153
140
|
var resizerRef = useRef(null);
|
|
154
141
|
var interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
|
|
155
|
-
var
|
|
156
|
-
widthToWidest =
|
|
142
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], selector),
|
|
143
|
+
widthToWidest = _useSharedPluginState.widthToWidest;
|
|
157
144
|
|
|
158
145
|
// used to reposition tooltip when table is resizing via keyboard
|
|
159
146
|
var updateTooltip = React.useRef();
|
|
@@ -75,7 +75,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
75
75
|
_this.options = props.options;
|
|
76
76
|
_this.getEditorFeatureFlags = props.getEditorFeatureFlags;
|
|
77
77
|
_this.handleRef = function (node) {
|
|
78
|
-
return _this._handleTableRef(node
|
|
78
|
+
return _this._handleTableRef(node);
|
|
79
79
|
};
|
|
80
80
|
return _this;
|
|
81
81
|
}
|
|
@@ -120,7 +120,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
120
120
|
*/
|
|
121
121
|
}, {
|
|
122
122
|
key: "_handleTableRef",
|
|
123
|
-
value: function _handleTableRef(node
|
|
123
|
+
value: function _handleTableRef(node) {
|
|
124
124
|
var _this2 = this;
|
|
125
125
|
var oldIgnoreMutation;
|
|
126
126
|
var selectionBookmark;
|
|
@@ -148,8 +148,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
148
148
|
selectionBookmark = this.view.state.selection.getBookmark();
|
|
149
149
|
}
|
|
150
150
|
if (this.dom && expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
151
|
-
this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(
|
|
152
|
-
this.dom.setAttribute('data-ssr-placeholder-replace', "table-nodeview-".concat(
|
|
151
|
+
this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(this.node.attrs.localId));
|
|
152
|
+
this.dom.setAttribute('data-ssr-placeholder-replace', "table-nodeview-".concat(this.node.attrs.localId));
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
// Remove the ProseMirror table DOM structure to avoid duplication, as it's replaced with the React table node.
|