@atlaskit/editor-plugin-table 13.0.5 → 13.0.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 +17 -0
- package/dist/cjs/nodeviews/TableComponent.js +5 -3
- 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/pm-plugins/drag-and-drop/plugin.js +26 -0
- package/dist/cjs/tablePlugin.js +30 -213
- package/dist/cjs/ui/DragHandle/index.js +9 -26
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -20
- package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -19
- package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -20
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -20
- package/dist/cjs/ui/global-styles.js +4 -17
- package/dist/cjs/ui/icons/SortingIconWrapper.js +2 -15
- package/dist/es2019/nodeviews/TableComponent.js +5 -3
- 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/pm-plugins/drag-and-drop/plugin.js +26 -0
- package/dist/es2019/tablePlugin.js +19 -211
- package/dist/es2019/ui/DragHandle/index.js +8 -27
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -22
- package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -22
- package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -22
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -22
- package/dist/es2019/ui/global-styles.js +6 -21
- package/dist/es2019/ui/icons/SortingIconWrapper.js +3 -18
- package/dist/esm/nodeviews/TableComponent.js +5 -3
- 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/pm-plugins/drag-and-drop/plugin.js +26 -0
- package/dist/esm/tablePlugin.js +24 -208
- package/dist/esm/ui/DragHandle/index.js +10 -27
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +8 -21
- package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -20
- package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +8 -21
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +8 -21
- package/dist/esm/ui/global-styles.js +5 -18
- package/dist/esm/ui/icons/SortingIconWrapper.js +3 -16
- package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +1 -1
- package/package.json +7 -6
|
@@ -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();
|
|
@@ -3,9 +3,11 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
3
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
5
5
|
import { getCellsInRow, getSelectedCellInfo } from '@atlaskit/editor-tables/utils';
|
|
6
|
+
import { insm } from '@atlaskit/insm';
|
|
6
7
|
import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
|
|
7
8
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
8
9
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
|
|
10
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
11
|
import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
10
12
|
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
11
13
|
import { insertColgroupFromNode } from '../table-resizing/utils/colgroup';
|
|
@@ -28,12 +30,20 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
28
30
|
return type === 'table-row';
|
|
29
31
|
},
|
|
30
32
|
onDragStart: function onDragStart() {
|
|
33
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
34
|
+
var _insm$session;
|
|
35
|
+
(_insm$session = insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('tableDragAndDrop');
|
|
36
|
+
}
|
|
31
37
|
// auto scroller doesn't work when scroll-behavior: smooth is set, this monitor temporarily removes it via inline styles
|
|
32
38
|
// Ignored via go/ees005
|
|
33
39
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
34
40
|
editorPageScrollContainer.style.setProperty('scroll-behavior', 'unset');
|
|
35
41
|
},
|
|
36
42
|
onDrop: function onDrop() {
|
|
43
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
44
|
+
var _insm$session2;
|
|
45
|
+
(_insm$session2 = insm.session) === null || _insm$session2 === void 0 || _insm$session2.endFeature('tableDragAndDrop');
|
|
46
|
+
}
|
|
37
47
|
// 'null' will remove the inline style
|
|
38
48
|
// Ignored via go/ees005
|
|
39
49
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -70,6 +80,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
70
80
|
},
|
|
71
81
|
onDragStart: function onDragStart(_ref7) {
|
|
72
82
|
var location = _ref7.location;
|
|
83
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
84
|
+
var _insm$session3;
|
|
85
|
+
(_insm$session3 = insm.session) === null || _insm$session3 === void 0 || _insm$session3.startFeature('tableDragAndDrop');
|
|
86
|
+
}
|
|
73
87
|
toggleDragMenu(false)(editorView.state, editorView.dispatch);
|
|
74
88
|
},
|
|
75
89
|
onDrag: function onDrag(event) {
|
|
@@ -118,6 +132,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
118
132
|
var _event$source, _event$source2;
|
|
119
133
|
// If we're able to determine the source type of the dropped element then we should report to analytics that
|
|
120
134
|
// the drop event was cancelled. Otherwise we will cancel silently.
|
|
135
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
136
|
+
var _insm$session4;
|
|
137
|
+
(_insm$session4 = insm.session) === null || _insm$session4 === void 0 || _insm$session4.endFeature('tableDragAndDrop');
|
|
138
|
+
}
|
|
121
139
|
if ((event === null || event === void 0 || (_event$source = event.source) === null || _event$source === void 0 || (_event$source = _event$source.data) === null || _event$source === void 0 ? void 0 : _event$source.type) === 'table-row' || (event === null || event === void 0 || (_event$source2 = event.source) === null || _event$source2 === void 0 || (_event$source2 = _event$source2.data) === null || _event$source2 === void 0 ? void 0 : _event$source2.type) === 'table-column') {
|
|
122
140
|
var _event$source$data;
|
|
123
141
|
return clearDropTargetWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.DRAG_AND_DROP, event.source.data.type, (_event$source$data = event.source.data) === null || _event$source$data === void 0 ? void 0 : _event$source$data.indexes, TABLE_STATUS.CANCELLED, tr)(editorView.state, editorView.dispatch);
|
|
@@ -144,6 +162,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
144
162
|
clearDropTargetWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.DRAG_AND_DROP, sourceType, sourceIndexes,
|
|
145
163
|
// This event is mrked as invalid because the user is attempting to drop an element in an area which has merged cells.
|
|
146
164
|
TABLE_STATUS.INVALID, tr)(editorView.state, editorView.dispatch);
|
|
165
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
166
|
+
var _insm$session5;
|
|
167
|
+
(_insm$session5 = insm.session) === null || _insm$session5 === void 0 || _insm$session5.endFeature('tableDragAndDrop');
|
|
168
|
+
}
|
|
147
169
|
return;
|
|
148
170
|
}
|
|
149
171
|
requestAnimationFrame(function () {
|
|
@@ -173,6 +195,10 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
|
|
|
173
195
|
}
|
|
174
196
|
}
|
|
175
197
|
editorView.focus();
|
|
198
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
199
|
+
var _insm$session6;
|
|
200
|
+
(_insm$session6 = insm.session) === null || _insm$session6 === void 0 || _insm$session6.endFeature('tableDragAndDrop');
|
|
201
|
+
}
|
|
176
202
|
});
|
|
177
203
|
}
|
|
178
204
|
})]));
|