@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,29 @@
|
|
|
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 const TableComponentWithSharedState = ({
|
|
13
|
+
view,
|
|
14
|
+
options,
|
|
15
|
+
getNode,
|
|
16
|
+
dispatchAnalyticsEvent,
|
|
17
|
+
api,
|
|
18
|
+
getEditorFeatureFlags,
|
|
19
|
+
eventDispatcher,
|
|
20
|
+
allowColumnResizing,
|
|
21
|
+
allowControls,
|
|
22
|
+
getPos,
|
|
23
|
+
forwardRef,
|
|
24
|
+
allowTableAlignment,
|
|
25
|
+
allowTableResizing
|
|
26
|
+
}) => {
|
|
12
27
|
const {
|
|
13
28
|
isTableResizing,
|
|
14
29
|
isHeaderColumnEnabled,
|
|
@@ -55,100 +70,7 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
|
55
70
|
interaction: (_states$interactionSt = states.interactionState) === null || _states$interactionSt === void 0 ? void 0 : _states$interactionSt.interactionState
|
|
56
71
|
};
|
|
57
72
|
});
|
|
58
|
-
return {
|
|
59
|
-
tableState: undefined,
|
|
60
|
-
widthState: undefined,
|
|
61
|
-
isTableResizing,
|
|
62
|
-
isHeaderColumnEnabled,
|
|
63
|
-
isHeaderRowEnabled,
|
|
64
|
-
ordering,
|
|
65
|
-
isResizing,
|
|
66
|
-
isInDanger,
|
|
67
|
-
hoveredCell,
|
|
68
|
-
hoveredRows,
|
|
69
|
-
isTableHovered,
|
|
70
|
-
isWholeTableInDanger,
|
|
71
|
-
isFullscreen,
|
|
72
|
-
selection,
|
|
73
|
-
mode,
|
|
74
|
-
width,
|
|
75
|
-
lineLength,
|
|
76
|
-
interaction
|
|
77
|
-
};
|
|
78
|
-
}, api => {
|
|
79
|
-
const {
|
|
80
|
-
widthState,
|
|
81
|
-
tableState,
|
|
82
|
-
mediaState,
|
|
83
|
-
selectionState,
|
|
84
|
-
editorViewModeState,
|
|
85
|
-
interactionState
|
|
86
|
-
} = useSharedPluginState(api, ['width', 'table', 'media', 'selection', 'editorViewMode', 'interaction']);
|
|
87
|
-
const tableStateInternal = tableState;
|
|
88
|
-
return {
|
|
89
|
-
tableState,
|
|
90
|
-
widthState,
|
|
91
|
-
isTableResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableResizing,
|
|
92
|
-
isHeaderColumnEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderColumnEnabled,
|
|
93
|
-
isHeaderRowEnabled: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isHeaderRowEnabled,
|
|
94
|
-
ordering: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.ordering,
|
|
95
|
-
isResizing: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isResizing,
|
|
96
|
-
isInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isInDanger,
|
|
97
|
-
hoveredCell: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredCell,
|
|
98
|
-
hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows,
|
|
99
|
-
isTableHovered: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isTableHovered,
|
|
100
|
-
isWholeTableInDanger: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.isWholeTableInDanger,
|
|
101
|
-
isFullscreen: mediaState === null || mediaState === void 0 ? void 0 : mediaState.isFullscreen,
|
|
102
|
-
selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection,
|
|
103
|
-
mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode,
|
|
104
|
-
width: widthState === null || widthState === void 0 ? void 0 : widthState.width,
|
|
105
|
-
lineLength: widthState === null || widthState === void 0 ? void 0 : widthState.lineLength,
|
|
106
|
-
interaction: interactionState === null || interactionState === void 0 ? void 0 : interactionState.interactionState
|
|
107
|
-
};
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Use useSharedPluginState to control re-renders from plugin dependencies
|
|
112
|
-
*/
|
|
113
|
-
export const TableComponentWithSharedState = ({
|
|
114
|
-
view,
|
|
115
|
-
options,
|
|
116
|
-
getNode,
|
|
117
|
-
dispatchAnalyticsEvent,
|
|
118
|
-
api,
|
|
119
|
-
getEditorFeatureFlags,
|
|
120
|
-
eventDispatcher,
|
|
121
|
-
allowColumnResizing,
|
|
122
|
-
allowControls,
|
|
123
|
-
getPos,
|
|
124
|
-
forwardRef,
|
|
125
|
-
allowTableAlignment,
|
|
126
|
-
allowTableResizing
|
|
127
|
-
}) => {
|
|
128
|
-
const {
|
|
129
|
-
tableState,
|
|
130
|
-
widthState,
|
|
131
|
-
mode,
|
|
132
|
-
hoveredCell,
|
|
133
|
-
hoveredRows,
|
|
134
|
-
isFullscreen,
|
|
135
|
-
isHeaderColumnEnabled,
|
|
136
|
-
isHeaderRowEnabled,
|
|
137
|
-
isInDanger,
|
|
138
|
-
isResizing,
|
|
139
|
-
isTableHovered,
|
|
140
|
-
isTableResizing,
|
|
141
|
-
isWholeTableInDanger,
|
|
142
|
-
lineLength,
|
|
143
|
-
ordering,
|
|
144
|
-
selection,
|
|
145
|
-
width,
|
|
146
|
-
interaction
|
|
147
|
-
} = useSharedState(api);
|
|
148
73
|
const isLivePageViewMode = mode === 'view';
|
|
149
|
-
if (expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false) && !tableState) {
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
74
|
|
|
153
75
|
/**
|
|
154
76
|
* ED-19810
|
|
@@ -182,13 +104,10 @@ export const TableComponentWithSharedState = ({
|
|
|
182
104
|
ordering: ordering,
|
|
183
105
|
isResizing: isResizing,
|
|
184
106
|
getNode: getNode,
|
|
185
|
-
containerWidth:
|
|
107
|
+
containerWidth: {
|
|
186
108
|
width: width !== null && width !== void 0 ? width : 0,
|
|
187
109
|
lineLength
|
|
188
|
-
}
|
|
189
|
-
// Ignored via go/ees005
|
|
190
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
191
|
-
widthState,
|
|
110
|
+
},
|
|
192
111
|
contentDOM: forwardRef,
|
|
193
112
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
194
113
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -3,7 +3,7 @@ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState }
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
6
|
-
import {
|
|
6
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
8
8
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -36,32 +36,6 @@ const InnerContainer = /*#__PURE__*/forwardRef(({
|
|
|
36
36
|
"data-testid": "table-container"
|
|
37
37
|
}, children);
|
|
38
38
|
});
|
|
39
|
-
const useAlignmentTableContainerSharedState = sharedPluginStateHookMigratorFactory(pluginInjectionApi => {
|
|
40
|
-
const {
|
|
41
|
-
isFullWidthModeEnabled,
|
|
42
|
-
wasFullWidthModeEnabled
|
|
43
|
-
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], states => {
|
|
44
|
-
var _states$tableState, _states$tableState2;
|
|
45
|
-
return {
|
|
46
|
-
isFullWidthModeEnabled: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isFullWidthModeEnabled,
|
|
47
|
-
wasFullWidthModeEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.wasFullWidthModeEnabled
|
|
48
|
-
};
|
|
49
|
-
});
|
|
50
|
-
return {
|
|
51
|
-
tableState: undefined,
|
|
52
|
-
isFullWidthModeEnabled,
|
|
53
|
-
wasFullWidthModeEnabled
|
|
54
|
-
};
|
|
55
|
-
}, pluginInjectionApi => {
|
|
56
|
-
const {
|
|
57
|
-
tableState
|
|
58
|
-
} = useSharedPluginState(pluginInjectionApi, ['table']);
|
|
59
|
-
return {
|
|
60
|
-
tableState,
|
|
61
|
-
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
62
|
-
wasFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.wasFullWidthModeEnabled
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
39
|
const AlignmentTableContainer = ({
|
|
66
40
|
node,
|
|
67
41
|
children,
|
|
@@ -71,14 +45,16 @@ const AlignmentTableContainer = ({
|
|
|
71
45
|
}) => {
|
|
72
46
|
const alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
|
|
73
47
|
const {
|
|
74
|
-
tableState,
|
|
75
48
|
isFullWidthModeEnabled,
|
|
76
49
|
wasFullWidthModeEnabled
|
|
77
|
-
} =
|
|
50
|
+
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], states => {
|
|
51
|
+
var _states$tableState, _states$tableState2;
|
|
52
|
+
return {
|
|
53
|
+
isFullWidthModeEnabled: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isFullWidthModeEnabled,
|
|
54
|
+
wasFullWidthModeEnabled: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.wasFullWidthModeEnabled
|
|
55
|
+
};
|
|
56
|
+
});
|
|
78
57
|
useEffect(() => {
|
|
79
|
-
if (!tableState && expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', false)) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
58
|
if (editorView && getPos) {
|
|
83
59
|
const {
|
|
84
60
|
state,
|
|
@@ -97,7 +73,7 @@ const AlignmentTableContainer = ({
|
|
|
97
73
|
}
|
|
98
74
|
}
|
|
99
75
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
100
|
-
}, [editorView,
|
|
76
|
+
}, [editorView, isFullWidthModeEnabled, wasFullWidthModeEnabled, node]);
|
|
101
77
|
const style = useMemo(() => {
|
|
102
78
|
return getAlignmentStyle(alignment);
|
|
103
79
|
}, [alignment]);
|
|
@@ -142,25 +118,6 @@ const selector = states => ({
|
|
|
142
118
|
tableState: states.tableState,
|
|
143
119
|
editorViewModeState: states.editorViewModeState
|
|
144
120
|
});
|
|
145
|
-
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
146
|
-
const {
|
|
147
|
-
tableState,
|
|
148
|
-
editorViewModeState
|
|
149
|
-
} = useSharedPluginStateWithSelector(api, ['table', 'editorViewMode'], selector);
|
|
150
|
-
return {
|
|
151
|
-
tableState,
|
|
152
|
-
editorViewModeState
|
|
153
|
-
};
|
|
154
|
-
}, api => {
|
|
155
|
-
const {
|
|
156
|
-
tableState,
|
|
157
|
-
editorViewModeState
|
|
158
|
-
} = useSharedPluginState(api, ['table', 'editorViewMode']);
|
|
159
|
-
return {
|
|
160
|
-
tableState,
|
|
161
|
-
editorViewModeState
|
|
162
|
-
};
|
|
163
|
-
});
|
|
164
121
|
const getPadding = containerWidth => {
|
|
165
122
|
return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
166
123
|
};
|
|
@@ -189,7 +146,7 @@ const ResizableTableContainerLegacy = /*#__PURE__*/React.memo(({
|
|
|
189
146
|
const {
|
|
190
147
|
tableState,
|
|
191
148
|
editorViewModeState
|
|
192
|
-
} =
|
|
149
|
+
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector);
|
|
193
150
|
const isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
194
151
|
const mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
195
152
|
const updateContainerHeight = useCallback(height => {
|
|
@@ -386,7 +343,7 @@ const ResizableTableContainerNext = /*#__PURE__*/React.memo(({
|
|
|
386
343
|
const {
|
|
387
344
|
tableState,
|
|
388
345
|
editorViewModeState
|
|
389
|
-
} =
|
|
346
|
+
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['table', 'editorViewMode'], selector);
|
|
390
347
|
const isFullWidthModeEnabled = tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled;
|
|
391
348
|
const mode = editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode;
|
|
392
349
|
const updateContainerHeight = useCallback(height => {
|
|
@@ -4,7 +4,7 @@ import { useIntl } from 'react-intl-next';
|
|
|
4
4
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { browser } from '@atlaskit/editor-common/browser';
|
|
6
6
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
7
|
-
import {
|
|
7
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
8
8
|
import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
9
9
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
10
10
|
import { logException } from '@atlaskit/editor-common/monitoring';
|
|
@@ -103,21 +103,6 @@ const selector = states => {
|
|
|
103
103
|
widthToWidest: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.widthToWidest
|
|
104
104
|
};
|
|
105
105
|
};
|
|
106
|
-
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
107
|
-
const {
|
|
108
|
-
widthToWidest
|
|
109
|
-
} = useSharedPluginStateWithSelector(api, ['table'], selector);
|
|
110
|
-
return {
|
|
111
|
-
widthToWidest
|
|
112
|
-
};
|
|
113
|
-
}, api => {
|
|
114
|
-
const {
|
|
115
|
-
tableState
|
|
116
|
-
} = useSharedPluginState(api, ['table']);
|
|
117
|
-
return {
|
|
118
|
-
widthToWidest: tableState === null || tableState === void 0 ? void 0 : tableState.widthToWidest
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
106
|
export const TableResizer = ({
|
|
122
107
|
children,
|
|
123
108
|
width,
|
|
@@ -153,7 +138,7 @@ export const TableResizer = ({
|
|
|
153
138
|
const interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
|
|
154
139
|
const {
|
|
155
140
|
widthToWidest
|
|
156
|
-
} =
|
|
141
|
+
} = useSharedPluginStateWithSelector(pluginInjectionApi, ['table'], selector);
|
|
157
142
|
|
|
158
143
|
// used to reposition tooltip when table is resizing via keyboard
|
|
159
144
|
const 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';
|
|
@@ -30,12 +32,20 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
30
32
|
return type === 'table-row';
|
|
31
33
|
},
|
|
32
34
|
onDragStart() {
|
|
35
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
36
|
+
var _insm$session;
|
|
37
|
+
(_insm$session = insm.session) === null || _insm$session === void 0 ? void 0 : _insm$session.startFeature('tableDragAndDrop');
|
|
38
|
+
}
|
|
33
39
|
// auto scroller doesn't work when scroll-behavior: smooth is set, this monitor temporarily removes it via inline styles
|
|
34
40
|
// Ignored via go/ees005
|
|
35
41
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
36
42
|
editorPageScrollContainer.style.setProperty('scroll-behavior', 'unset');
|
|
37
43
|
},
|
|
38
44
|
onDrop() {
|
|
45
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
46
|
+
var _insm$session2;
|
|
47
|
+
(_insm$session2 = insm.session) === null || _insm$session2 === void 0 ? void 0 : _insm$session2.endFeature('tableDragAndDrop');
|
|
48
|
+
}
|
|
39
49
|
// 'null' will remove the inline style
|
|
40
50
|
// Ignored via go/ees005
|
|
41
51
|
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
@@ -78,6 +88,10 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
78
88
|
onDragStart: ({
|
|
79
89
|
location
|
|
80
90
|
}) => {
|
|
91
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
92
|
+
var _insm$session3;
|
|
93
|
+
(_insm$session3 = insm.session) === null || _insm$session3 === void 0 ? void 0 : _insm$session3.startFeature('tableDragAndDrop');
|
|
94
|
+
}
|
|
81
95
|
toggleDragMenu(false)(editorView.state, editorView.dispatch);
|
|
82
96
|
},
|
|
83
97
|
onDrag(event) {
|
|
@@ -129,6 +143,10 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
129
143
|
var _event$source, _event$source$data, _event$source2, _event$source2$data;
|
|
130
144
|
// If we're able to determine the source type of the dropped element then we should report to analytics that
|
|
131
145
|
// the drop event was cancelled. Otherwise we will cancel silently.
|
|
146
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
147
|
+
var _insm$session4;
|
|
148
|
+
(_insm$session4 = insm.session) === null || _insm$session4 === void 0 ? void 0 : _insm$session4.endFeature('tableDragAndDrop');
|
|
149
|
+
}
|
|
132
150
|
if ((event === null || event === void 0 ? void 0 : (_event$source = event.source) === null || _event$source === void 0 ? void 0 : (_event$source$data = _event$source.data) === null || _event$source$data === void 0 ? void 0 : _event$source$data.type) === 'table-row' || (event === null || event === void 0 ? void 0 : (_event$source2 = event.source) === null || _event$source2 === void 0 ? void 0 : (_event$source2$data = _event$source2.data) === null || _event$source2$data === void 0 ? void 0 : _event$source2$data.type) === 'table-column') {
|
|
133
151
|
var _event$source$data2;
|
|
134
152
|
return clearDropTargetWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.DRAG_AND_DROP, event.source.data.type, (_event$source$data2 = event.source.data) === null || _event$source$data2 === void 0 ? void 0 : _event$source$data2.indexes, TABLE_STATUS.CANCELLED, tr)(editorView.state, editorView.dispatch);
|
|
@@ -157,6 +175,10 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
157
175
|
clearDropTargetWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.DRAG_AND_DROP, sourceType, sourceIndexes,
|
|
158
176
|
// This event is mrked as invalid because the user is attempting to drop an element in an area which has merged cells.
|
|
159
177
|
TABLE_STATUS.INVALID, tr)(editorView.state, editorView.dispatch);
|
|
178
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
179
|
+
var _insm$session5;
|
|
180
|
+
(_insm$session5 = insm.session) === null || _insm$session5 === void 0 ? void 0 : _insm$session5.endFeature('tableDragAndDrop');
|
|
181
|
+
}
|
|
160
182
|
return;
|
|
161
183
|
}
|
|
162
184
|
requestAnimationFrame(() => {
|
|
@@ -187,6 +209,10 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
|
|
|
187
209
|
}
|
|
188
210
|
}
|
|
189
211
|
editorView.focus();
|
|
212
|
+
if (expValEquals('cc_editor_interactivity_monitoring', 'isEnabled', true)) {
|
|
213
|
+
var _insm$session6;
|
|
214
|
+
(_insm$session6 = insm.session) === null || _insm$session6 === void 0 ? void 0 : _insm$session6.endFeature('tableDragAndDrop');
|
|
215
|
+
}
|
|
190
216
|
});
|
|
191
217
|
}
|
|
192
218
|
}));
|