@atlaskit/editor-plugin-table 2.12.6 → 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/plugins/table/index.js +2 -0
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +6 -1
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +23 -5
- package/dist/es2019/plugins/table/index.js +3 -0
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +6 -1
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +24 -6
- package/dist/esm/plugins/table/index.js +3 -0
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +6 -1
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +24 -6
- package/dist/types/plugins/table/index.d.ts +9 -2
- package/dist/types/plugins/table/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/index.d.ts +9 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +2 -1
- package/package.json +2 -2
- package/report.api.md +14 -0
- package/src/__tests__/integration/floating-toolbar.ts +5 -5
- package/src/__tests__/unit/analytics.ts +2 -0
- package/src/__tests__/unit/collab.ts +2 -0
- package/src/__tests__/unit/commands/go-to-next-cell.ts +2 -0
- package/src/__tests__/unit/commands/insert.ts +2 -0
- package/src/__tests__/unit/commands/misc.ts +2 -0
- package/src/__tests__/unit/commands/sort.ts +4 -0
- package/src/__tests__/unit/commands.ts +2 -0
- package/src/__tests__/unit/copy-paste.ts +2 -0
- package/src/__tests__/unit/event-handlers/index.ts +3 -0
- package/src/__tests__/unit/event-handlers.ts +3 -0
- package/src/__tests__/unit/fix-tables.ts +2 -0
- package/src/__tests__/unit/get-toolbar-config.ts +2 -0
- package/src/__tests__/unit/handlers.ts +2 -0
- package/src/__tests__/unit/hover-selection.ts +2 -0
- package/src/__tests__/unit/index.ts +2 -0
- package/src/__tests__/unit/layout.ts +2 -0
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +58 -0
- package/src/__tests__/unit/nodeviews/cell.ts +2 -0
- package/src/__tests__/unit/nodeviews/table.ts +2 -0
- package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +2 -0
- package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +3 -0
- package/src/__tests__/unit/pm-plugins/main.ts +2 -0
- package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +2 -0
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +3 -0
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +2 -0
- package/src/__tests__/unit/pm-plugins/table-width.ts +99 -0
- package/src/__tests__/unit/sort-column.ts +2 -0
- package/src/__tests__/unit/toolbar.ts +2 -0
- package/src/__tests__/unit/transforms/delete-columns.ts +2 -0
- package/src/__tests__/unit/transforms/delete-rows.ts +2 -0
- package/src/__tests__/unit/transforms/merging.ts +2 -0
- package/src/__tests__/unit/ui/ContextualMenu.tsx +2 -0
- package/src/__tests__/unit/ui/CornerControls.tsx +2 -0
- package/src/__tests__/unit/ui/FloatingContextualButton.tsx +2 -0
- package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +4 -2
- package/src/__tests__/unit/ui/RowControls.tsx +2 -0
- package/src/__tests__/unit/ui/TableFloatingControls.tsx +2 -0
- package/src/__tests__/unit/undo-redo.ts +2 -0
- package/src/__tests__/unit/utils/collapse.ts +2 -0
- package/src/__tests__/unit/utils/nodes.ts +2 -0
- package/src/__tests__/unit/utils/row-controls.ts +2 -0
- package/src/__tests__/unit/utils.ts +2 -0
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-should-remove-the-table-column-on-click-1-snap.png +2 -2
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +2 -2
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-should-remove-the-table-row-on-click-1-snap.png +2 -2
- package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +2 -2
- package/src/plugins/table/index.tsx +13 -0
- package/src/plugins/table/nodeviews/TableContainer.tsx +12 -0
- package/src/plugins/table/nodeviews/TableResizer.tsx +36 -5
- package/src/plugins/table/nodeviews/table.tsx +0 -1
- package/tmp/api-report-tmp.d.ts +12 -1
- package/tsconfig.app.json +0 -3
- package/tsconfig.dev.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 2.13.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`dca155209d9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/dca155209d9) - ED-15094 Feature flag clean up for copy button
|
|
8
|
+
|
|
9
|
+
## 2.13.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`a5f5786f39b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a5f5786f39b) - Use selection plugin to hide gap cursor when table is resized
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 2.12.6
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -35,6 +35,8 @@ var _FloatingDeleteButton = _interopRequireDefault(require("./ui/FloatingDeleteB
|
|
|
35
35
|
var _FloatingInsertButton = _interopRequireDefault(require("./ui/FloatingInsertButton"));
|
|
36
36
|
var _LayoutButton = _interopRequireDefault(require("./ui/LayoutButton"));
|
|
37
37
|
var _utils3 = require("./utils");
|
|
38
|
+
// TODO: duplicated SelectionPlugin type as it's still in editor-core, doing this avoid
|
|
39
|
+
// circular dependencies
|
|
38
40
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
39
41
|
return {};
|
|
40
42
|
};
|
|
@@ -85,6 +85,10 @@ var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
85
85
|
var _pluginInjectionApi$a;
|
|
86
86
|
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent(payload);
|
|
87
87
|
}, [pluginInjectionApi]);
|
|
88
|
+
var displayGapCursor = (0, _react.useCallback)(function (toggle) {
|
|
89
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
90
|
+
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
91
|
+
}, [pluginInjectionApi]);
|
|
88
92
|
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
89
93
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
90
94
|
var responsiveContainerWidth = containerWidth - 76;
|
|
@@ -111,7 +115,8 @@ var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
111
115
|
node: node,
|
|
112
116
|
tableRef: tableRef,
|
|
113
117
|
displayGuideline: displayGuideline,
|
|
114
|
-
attachAnalyticsEvent: attachAnalyticsEvent
|
|
118
|
+
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
119
|
+
displayGapCursor: displayGapCursor
|
|
115
120
|
}, /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
116
121
|
className: className,
|
|
117
122
|
node: node
|
|
@@ -90,8 +90,11 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
90
90
|
node = _ref.node,
|
|
91
91
|
tableRef = _ref.tableRef,
|
|
92
92
|
displayGuideline = _ref.displayGuideline,
|
|
93
|
-
attachAnalyticsEvent = _ref.attachAnalyticsEvent
|
|
93
|
+
attachAnalyticsEvent = _ref.attachAnalyticsEvent,
|
|
94
|
+
displayGapCursor = _ref.displayGapCursor;
|
|
94
95
|
var currentGap = (0, _react.useRef)(0);
|
|
96
|
+
// track resizing state - use ref over state to avoid re-render
|
|
97
|
+
var isResizing = (0, _react.useRef)(false);
|
|
95
98
|
var _useState = (0, _react.useState)(false),
|
|
96
99
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
97
100
|
snappingEnabled = _useState2[0],
|
|
@@ -120,16 +123,29 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
120
123
|
x: _snapping.defaultSnappingWidths
|
|
121
124
|
} : undefined;
|
|
122
125
|
}, [snappingEnabled]);
|
|
126
|
+
(0, _react.useEffect)(function () {
|
|
127
|
+
return function () {
|
|
128
|
+
// only bring back the cursor if this table was deleted - i.e. if a user was resizing, then another
|
|
129
|
+
// deleted this table
|
|
130
|
+
if (isResizing.current) {
|
|
131
|
+
displayGapCursor(true);
|
|
132
|
+
displayGuideline([]);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}, [displayGuideline, displayGapCursor]);
|
|
123
136
|
var handleResizeStart = (0, _react.useCallback)(function () {
|
|
124
137
|
startMeasure();
|
|
138
|
+
isResizing.current = true;
|
|
125
139
|
var dispatch = editorView.dispatch,
|
|
126
140
|
tr = editorView.state.tr;
|
|
127
|
-
|
|
141
|
+
tr.setMeta(_tableWidth.pluginKey, {
|
|
128
142
|
resizing: true
|
|
129
|
-
})
|
|
143
|
+
});
|
|
144
|
+
displayGapCursor(false);
|
|
145
|
+
dispatch(tr);
|
|
130
146
|
var visibleGuidelines = getVisibleGuidelines(_guidelines.defaultGuidelines, containerWidth);
|
|
131
147
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
132
|
-
}, [displayGuideline, editorView, startMeasure, containerWidth]);
|
|
148
|
+
}, [displayGapCursor, displayGuideline, editorView, startMeasure, containerWidth]);
|
|
133
149
|
var handleResize = (0, _react.useCallback)(function (originalState, delta) {
|
|
134
150
|
countFrames();
|
|
135
151
|
var newWidth = originalState.width + delta.width;
|
|
@@ -151,6 +167,7 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
151
167
|
return (0, _rafSchd.default)(handleResize);
|
|
152
168
|
}, [handleResize]);
|
|
153
169
|
var handleResizeStop = (0, _react.useCallback)(function (originalState, delta) {
|
|
170
|
+
isResizing.current = false;
|
|
154
171
|
var newWidth = originalState.width + delta.width;
|
|
155
172
|
var state = editorView.state,
|
|
156
173
|
dispatch = editorView.dispatch;
|
|
@@ -188,6 +205,7 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
188
205
|
resizedNode: scaledNode
|
|
189
206
|
}))) === null || _attachAnalyticsEvent2 === void 0 ? void 0 : _attachAnalyticsEvent2(tr);
|
|
190
207
|
}
|
|
208
|
+
displayGapCursor(true);
|
|
191
209
|
dispatch(tr);
|
|
192
210
|
|
|
193
211
|
// Hide guidelines when resizing stops
|
|
@@ -195,7 +213,7 @@ var TableResizer = function TableResizer(_ref) {
|
|
|
195
213
|
updateWidth(newWidth);
|
|
196
214
|
scheduleResize.cancel();
|
|
197
215
|
return newWidth;
|
|
198
|
-
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
216
|
+
}, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
199
217
|
var isTableSelected = ((_findTable = (0, _utils.findTable)((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos();
|
|
200
218
|
return /*#__PURE__*/_react.default.createElement(_resizer.ResizerNext, {
|
|
201
219
|
enable: handles,
|
|
@@ -28,6 +28,9 @@ import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
|
28
28
|
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
29
29
|
import LayoutButton from './ui/LayoutButton';
|
|
30
30
|
import { isLayoutSupported } from './utils';
|
|
31
|
+
|
|
32
|
+
// TODO: duplicated SelectionPlugin type as it's still in editor-core, doing this avoid
|
|
33
|
+
// circular dependencies
|
|
31
34
|
const defaultGetEditorFeatureFlags = () => ({});
|
|
32
35
|
/**
|
|
33
36
|
* Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
@@ -76,6 +76,10 @@ export const ResizableTableContainer = ({
|
|
|
76
76
|
var _pluginInjectionApi$a;
|
|
77
77
|
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent(payload);
|
|
78
78
|
}, [pluginInjectionApi]);
|
|
79
|
+
const displayGapCursor = useCallback(toggle => {
|
|
80
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
81
|
+
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
82
|
+
}, [pluginInjectionApi]);
|
|
79
83
|
const tableWidth = getTableContainerWidth(node);
|
|
80
84
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
81
85
|
const responsiveContainerWidth = containerWidth - 76;
|
|
@@ -102,7 +106,8 @@ export const ResizableTableContainer = ({
|
|
|
102
106
|
node: node,
|
|
103
107
|
tableRef: tableRef,
|
|
104
108
|
displayGuideline: displayGuideline,
|
|
105
|
-
attachAnalyticsEvent: attachAnalyticsEvent
|
|
109
|
+
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
110
|
+
displayGapCursor: displayGapCursor
|
|
106
111
|
}, /*#__PURE__*/React.createElement(InnerContainer, {
|
|
107
112
|
className: className,
|
|
108
113
|
node: node
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
2
|
import rafSchd from 'raf-schd';
|
|
3
3
|
import { defineMessages, useIntl } from 'react-intl-next';
|
|
4
4
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
@@ -75,10 +75,13 @@ export const TableResizer = ({
|
|
|
75
75
|
node,
|
|
76
76
|
tableRef,
|
|
77
77
|
displayGuideline,
|
|
78
|
-
attachAnalyticsEvent
|
|
78
|
+
attachAnalyticsEvent,
|
|
79
|
+
displayGapCursor
|
|
79
80
|
}) => {
|
|
80
81
|
var _findTable, _editorView$state;
|
|
81
82
|
const currentGap = useRef(0);
|
|
83
|
+
// track resizing state - use ref over state to avoid re-render
|
|
84
|
+
const isResizing = useRef(false);
|
|
82
85
|
const [snappingEnabled, setSnappingEnabled] = useState(false);
|
|
83
86
|
const {
|
|
84
87
|
formatMessage
|
|
@@ -106,20 +109,33 @@ export const TableResizer = ({
|
|
|
106
109
|
const guidelineSnaps = useMemo(() => snappingEnabled ? {
|
|
107
110
|
x: defaultSnappingWidths
|
|
108
111
|
} : undefined, [snappingEnabled]);
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
return () => {
|
|
114
|
+
// only bring back the cursor if this table was deleted - i.e. if a user was resizing, then another
|
|
115
|
+
// deleted this table
|
|
116
|
+
if (isResizing.current) {
|
|
117
|
+
displayGapCursor(true);
|
|
118
|
+
displayGuideline([]);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}, [displayGuideline, displayGapCursor]);
|
|
109
122
|
const handleResizeStart = useCallback(() => {
|
|
110
123
|
startMeasure();
|
|
124
|
+
isResizing.current = true;
|
|
111
125
|
const {
|
|
112
126
|
dispatch,
|
|
113
127
|
state: {
|
|
114
128
|
tr
|
|
115
129
|
}
|
|
116
130
|
} = editorView;
|
|
117
|
-
|
|
131
|
+
tr.setMeta(tableWidthPluginKey, {
|
|
118
132
|
resizing: true
|
|
119
|
-
})
|
|
133
|
+
});
|
|
134
|
+
displayGapCursor(false);
|
|
135
|
+
dispatch(tr);
|
|
120
136
|
const visibleGuidelines = getVisibleGuidelines(defaultGuidelines, containerWidth);
|
|
121
137
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
122
|
-
}, [displayGuideline, editorView, startMeasure, containerWidth]);
|
|
138
|
+
}, [displayGapCursor, displayGuideline, editorView, startMeasure, containerWidth]);
|
|
123
139
|
const handleResize = useCallback((originalState, delta) => {
|
|
124
140
|
countFrames();
|
|
125
141
|
const newWidth = originalState.width + delta.width;
|
|
@@ -139,6 +155,7 @@ export const TableResizer = ({
|
|
|
139
155
|
}, [editorView, getPos, node, tableRef, updateWidth, updateActiveGuidelines, countFrames]);
|
|
140
156
|
const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
|
|
141
157
|
const handleResizeStop = useCallback((originalState, delta) => {
|
|
158
|
+
isResizing.current = false;
|
|
142
159
|
const newWidth = originalState.width + delta.width;
|
|
143
160
|
const {
|
|
144
161
|
state,
|
|
@@ -179,6 +196,7 @@ export const TableResizer = ({
|
|
|
179
196
|
resizedNode: scaledNode
|
|
180
197
|
}))) === null || _attachAnalyticsEvent2 === void 0 ? void 0 : _attachAnalyticsEvent2(tr);
|
|
181
198
|
}
|
|
199
|
+
displayGapCursor(true);
|
|
182
200
|
dispatch(tr);
|
|
183
201
|
|
|
184
202
|
// Hide guidelines when resizing stops
|
|
@@ -186,7 +204,7 @@ export const TableResizer = ({
|
|
|
186
204
|
updateWidth(newWidth);
|
|
187
205
|
scheduleResize.cancel();
|
|
188
206
|
return newWidth;
|
|
189
|
-
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
207
|
+
}, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
190
208
|
const isTableSelected = ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos();
|
|
191
209
|
return /*#__PURE__*/React.createElement(ResizerNext, {
|
|
192
210
|
enable: handles,
|
|
@@ -28,6 +28,9 @@ import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
|
28
28
|
import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
29
29
|
import LayoutButton from './ui/LayoutButton';
|
|
30
30
|
import { isLayoutSupported } from './utils';
|
|
31
|
+
|
|
32
|
+
// TODO: duplicated SelectionPlugin type as it's still in editor-core, doing this avoid
|
|
33
|
+
// circular dependencies
|
|
31
34
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
32
35
|
return {};
|
|
33
36
|
};
|
|
@@ -74,6 +74,10 @@ export var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
74
74
|
var _pluginInjectionApi$a;
|
|
75
75
|
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent(payload);
|
|
76
76
|
}, [pluginInjectionApi]);
|
|
77
|
+
var displayGapCursor = useCallback(function (toggle) {
|
|
78
|
+
var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
|
|
79
|
+
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
80
|
+
}, [pluginInjectionApi]);
|
|
77
81
|
var tableWidth = getTableContainerWidth(node);
|
|
78
82
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
79
83
|
var responsiveContainerWidth = containerWidth - 76;
|
|
@@ -100,7 +104,8 @@ export var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
100
104
|
node: node,
|
|
101
105
|
tableRef: tableRef,
|
|
102
106
|
displayGuideline: displayGuideline,
|
|
103
|
-
attachAnalyticsEvent: attachAnalyticsEvent
|
|
107
|
+
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
108
|
+
displayGapCursor: displayGapCursor
|
|
104
109
|
}, /*#__PURE__*/React.createElement(InnerContainer, {
|
|
105
110
|
className: className,
|
|
106
111
|
node: node
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
-
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import rafSchd from 'raf-schd';
|
|
7
7
|
import { defineMessages, useIntl } from 'react-intl-next';
|
|
8
8
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
@@ -80,8 +80,11 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
80
80
|
node = _ref.node,
|
|
81
81
|
tableRef = _ref.tableRef,
|
|
82
82
|
displayGuideline = _ref.displayGuideline,
|
|
83
|
-
attachAnalyticsEvent = _ref.attachAnalyticsEvent
|
|
83
|
+
attachAnalyticsEvent = _ref.attachAnalyticsEvent,
|
|
84
|
+
displayGapCursor = _ref.displayGapCursor;
|
|
84
85
|
var currentGap = useRef(0);
|
|
86
|
+
// track resizing state - use ref over state to avoid re-render
|
|
87
|
+
var isResizing = useRef(false);
|
|
85
88
|
var _useState = useState(false),
|
|
86
89
|
_useState2 = _slicedToArray(_useState, 2),
|
|
87
90
|
snappingEnabled = _useState2[0],
|
|
@@ -110,16 +113,29 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
110
113
|
x: defaultSnappingWidths
|
|
111
114
|
} : undefined;
|
|
112
115
|
}, [snappingEnabled]);
|
|
116
|
+
useEffect(function () {
|
|
117
|
+
return function () {
|
|
118
|
+
// only bring back the cursor if this table was deleted - i.e. if a user was resizing, then another
|
|
119
|
+
// deleted this table
|
|
120
|
+
if (isResizing.current) {
|
|
121
|
+
displayGapCursor(true);
|
|
122
|
+
displayGuideline([]);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}, [displayGuideline, displayGapCursor]);
|
|
113
126
|
var handleResizeStart = useCallback(function () {
|
|
114
127
|
startMeasure();
|
|
128
|
+
isResizing.current = true;
|
|
115
129
|
var dispatch = editorView.dispatch,
|
|
116
130
|
tr = editorView.state.tr;
|
|
117
|
-
|
|
131
|
+
tr.setMeta(tableWidthPluginKey, {
|
|
118
132
|
resizing: true
|
|
119
|
-
})
|
|
133
|
+
});
|
|
134
|
+
displayGapCursor(false);
|
|
135
|
+
dispatch(tr);
|
|
120
136
|
var visibleGuidelines = getVisibleGuidelines(defaultGuidelines, containerWidth);
|
|
121
137
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
122
|
-
}, [displayGuideline, editorView, startMeasure, containerWidth]);
|
|
138
|
+
}, [displayGapCursor, displayGuideline, editorView, startMeasure, containerWidth]);
|
|
123
139
|
var handleResize = useCallback(function (originalState, delta) {
|
|
124
140
|
countFrames();
|
|
125
141
|
var newWidth = originalState.width + delta.width;
|
|
@@ -141,6 +157,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
141
157
|
return rafSchd(handleResize);
|
|
142
158
|
}, [handleResize]);
|
|
143
159
|
var handleResizeStop = useCallback(function (originalState, delta) {
|
|
160
|
+
isResizing.current = false;
|
|
144
161
|
var newWidth = originalState.width + delta.width;
|
|
145
162
|
var state = editorView.state,
|
|
146
163
|
dispatch = editorView.dispatch;
|
|
@@ -178,6 +195,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
178
195
|
resizedNode: scaledNode
|
|
179
196
|
}))) === null || _attachAnalyticsEvent2 === void 0 ? void 0 : _attachAnalyticsEvent2(tr);
|
|
180
197
|
}
|
|
198
|
+
displayGapCursor(true);
|
|
181
199
|
dispatch(tr);
|
|
182
200
|
|
|
183
201
|
// Hide guidelines when resizing stops
|
|
@@ -185,7 +203,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
185
203
|
updateWidth(newWidth);
|
|
186
204
|
scheduleResize.cancel();
|
|
187
205
|
return newWidth;
|
|
188
|
-
}, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
206
|
+
}, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
|
|
189
207
|
var isTableSelected = ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos();
|
|
190
208
|
return /*#__PURE__*/React.createElement(ResizerNext, {
|
|
191
209
|
enable: handles,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
3
|
-
import type { Command, GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Command, EditorCommand, GetEditorFeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
5
|
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
6
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
@@ -17,6 +17,12 @@ interface TablePluginOptions {
|
|
|
17
17
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
18
18
|
}
|
|
19
19
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
20
|
+
type SelectionPlugin = NextEditorPlugin<'selection', {
|
|
21
|
+
pluginConfiguration: unknown;
|
|
22
|
+
commands: {
|
|
23
|
+
displayGapCursor: (toggle: boolean) => EditorCommand;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
20
26
|
export type TablePlugin = NextEditorPlugin<'table', {
|
|
21
27
|
pluginConfiguration: TablePluginOptions | undefined;
|
|
22
28
|
actions: {
|
|
@@ -26,7 +32,8 @@ export type TablePlugin = NextEditorPlugin<'table', {
|
|
|
26
32
|
AnalyticsPlugin,
|
|
27
33
|
ContentInsertionPlugin,
|
|
28
34
|
WidthPlugin,
|
|
29
|
-
GuidelinePlugin
|
|
35
|
+
GuidelinePlugin,
|
|
36
|
+
OptionalPlugin<SelectionPlugin>
|
|
30
37
|
];
|
|
31
38
|
}>;
|
|
32
39
|
/**
|
|
@@ -15,6 +15,7 @@ interface TableResizerProps {
|
|
|
15
15
|
tableRef: HTMLTableElement;
|
|
16
16
|
displayGuideline: (guideline: GuidelineConfig[]) => boolean;
|
|
17
17
|
attachAnalyticsEvent: (payload: TableEventPayload) => ((tr: Transaction) => boolean) | undefined;
|
|
18
|
+
displayGapCursor: (toggle: boolean) => boolean;
|
|
18
19
|
}
|
|
19
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
20
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
20
21
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
3
|
-
import type { Command, GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { Command, EditorCommand, GetEditorFeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
5
|
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
6
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
@@ -17,6 +17,12 @@ interface TablePluginOptions {
|
|
|
17
17
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
18
18
|
}
|
|
19
19
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
20
|
+
type SelectionPlugin = NextEditorPlugin<'selection', {
|
|
21
|
+
pluginConfiguration: unknown;
|
|
22
|
+
commands: {
|
|
23
|
+
displayGapCursor: (toggle: boolean) => EditorCommand;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
20
26
|
export type TablePlugin = NextEditorPlugin<'table', {
|
|
21
27
|
pluginConfiguration: TablePluginOptions | undefined;
|
|
22
28
|
actions: {
|
|
@@ -26,7 +32,8 @@ export type TablePlugin = NextEditorPlugin<'table', {
|
|
|
26
32
|
AnalyticsPlugin,
|
|
27
33
|
ContentInsertionPlugin,
|
|
28
34
|
WidthPlugin,
|
|
29
|
-
GuidelinePlugin
|
|
35
|
+
GuidelinePlugin,
|
|
36
|
+
OptionalPlugin<SelectionPlugin>
|
|
30
37
|
];
|
|
31
38
|
}>;
|
|
32
39
|
/**
|
|
@@ -15,6 +15,7 @@ interface TableResizerProps {
|
|
|
15
15
|
tableRef: HTMLTableElement;
|
|
16
16
|
displayGuideline: (guideline: GuidelineConfig[]) => boolean;
|
|
17
17
|
attachAnalyticsEvent: (payload: TableEventPayload) => ((tr: Transaction) => boolean) | undefined;
|
|
18
|
+
displayGapCursor: (toggle: boolean) => boolean;
|
|
18
19
|
}
|
|
19
|
-
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
20
|
+
export declare const TableResizer: ({ children, width, maxWidth, containerWidth, updateWidth, editorView, getPos, node, tableRef, displayGuideline, attachAnalyticsEvent, displayGapCursor, }: PropsWithChildren<TableResizerProps>) => JSX.Element;
|
|
20
21
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.1",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/icon": "^21.12.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
40
40
|
"@atlaskit/theme": "^12.6.0",
|
|
41
|
-
"@atlaskit/tokens": "^1.
|
|
41
|
+
"@atlaskit/tokens": "^1.21.0",
|
|
42
42
|
"@atlaskit/tooltip": "^17.8.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@emotion/react": "^11.7.1",
|
package/report.api.md
CHANGED
|
@@ -19,10 +19,12 @@ import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
|
19
19
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
20
20
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
21
21
|
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
22
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
22
23
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
23
24
|
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
24
25
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
25
26
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
27
|
+
import type { OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
26
28
|
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
27
29
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
28
30
|
|
|
@@ -80,6 +82,17 @@ interface PluginConfig {
|
|
|
80
82
|
tableRenderOptimization?: boolean;
|
|
81
83
|
}
|
|
82
84
|
|
|
85
|
+
// @public (undocumented)
|
|
86
|
+
type SelectionPlugin = NextEditorPlugin<
|
|
87
|
+
'selection',
|
|
88
|
+
{
|
|
89
|
+
pluginConfiguration: unknown;
|
|
90
|
+
commands: {
|
|
91
|
+
displayGapCursor: (toggle: boolean) => EditorCommand;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
>;
|
|
95
|
+
|
|
83
96
|
// @public (undocumented)
|
|
84
97
|
export type TablePlugin = NextEditorPlugin<
|
|
85
98
|
'table',
|
|
@@ -93,6 +106,7 @@ export type TablePlugin = NextEditorPlugin<
|
|
|
93
106
|
ContentInsertionPlugin,
|
|
94
107
|
WidthPlugin,
|
|
95
108
|
GuidelinePlugin,
|
|
109
|
+
OptionalPlugin<SelectionPlugin>,
|
|
96
110
|
];
|
|
97
111
|
}
|
|
98
112
|
>;
|
|
@@ -78,7 +78,7 @@ BrowserTestCase(
|
|
|
78
78
|
|
|
79
79
|
BrowserTestCase(
|
|
80
80
|
'should show hover indicators on delete columns menu option',
|
|
81
|
-
{ skip: ['
|
|
81
|
+
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
82
82
|
async (client: any, testName: string) => {
|
|
83
83
|
const page = await goToEditorTestingWDExample(
|
|
84
84
|
client,
|
|
@@ -125,7 +125,7 @@ BrowserTestCase(
|
|
|
125
125
|
|
|
126
126
|
BrowserTestCase(
|
|
127
127
|
'should show hover indicators on delete rows menu option',
|
|
128
|
-
{ skip: ['
|
|
128
|
+
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
129
129
|
async (client: any, testName: string) => {
|
|
130
130
|
const page = await goToEditorTestingWDExample(
|
|
131
131
|
client,
|
|
@@ -171,7 +171,7 @@ BrowserTestCase(
|
|
|
171
171
|
|
|
172
172
|
BrowserTestCase(
|
|
173
173
|
'should show tooltip on hover on disabled sort button then remove it on mouse out',
|
|
174
|
-
{ skip: ['
|
|
174
|
+
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
175
175
|
async (client: any, testName: string) => {
|
|
176
176
|
const page = await goToEditorTestingWDExample(
|
|
177
177
|
client,
|
|
@@ -232,7 +232,7 @@ BrowserTestCase(
|
|
|
232
232
|
|
|
233
233
|
BrowserTestCase(
|
|
234
234
|
'should show yellow highlight on the megred rows when hover disabled sort column ASC menu option',
|
|
235
|
-
{ skip: ['
|
|
235
|
+
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
236
236
|
async (client: any, testName: string) => {
|
|
237
237
|
const page = await goToEditorTestingWDExample(
|
|
238
238
|
client,
|
|
@@ -279,7 +279,7 @@ BrowserTestCase(
|
|
|
279
279
|
|
|
280
280
|
BrowserTestCase(
|
|
281
281
|
'should show yellow highlight on the megred rows when hover disabled sort column DESC menu option',
|
|
282
|
-
{ skip: ['
|
|
282
|
+
{ skip: ['*'] }, // The test does not pass on CI but works on physical browser
|
|
283
283
|
async (client: any, testName: string) => {
|
|
284
284
|
const page = await goToEditorTestingWDExample(
|
|
285
285
|
client,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
3
4
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
5
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
5
6
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
@@ -99,6 +100,7 @@ describe('Table analytic events', () => {
|
|
|
99
100
|
.add(contentInsertionPlugin)
|
|
100
101
|
.add(widthPlugin)
|
|
101
102
|
.add(guidelinePlugin)
|
|
103
|
+
.add(selectionPlugin)
|
|
102
104
|
.add([tablePlugin, { tableOptions }]),
|
|
103
105
|
pluginKey,
|
|
104
106
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
1
2
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
2
3
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
3
4
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
@@ -45,6 +46,7 @@ describe('Tables with Collab editing', () => {
|
|
|
45
46
|
.add(contentInsertionPlugin)
|
|
46
47
|
.add(widthPlugin)
|
|
47
48
|
.add(guidelinePlugin)
|
|
49
|
+
.add(selectionPlugin)
|
|
48
50
|
.add([tablePlugin, { tableOptions }]),
|
|
49
51
|
pluginKey: tablePluginKey,
|
|
50
52
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
2
3
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
4
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
4
5
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
@@ -41,6 +42,7 @@ describe('table plugin: goToNextCell', () => {
|
|
|
41
42
|
.add(contentInsertionPlugin)
|
|
42
43
|
.add(widthPlugin)
|
|
43
44
|
.add(guidelinePlugin)
|
|
45
|
+
.add(selectionPlugin)
|
|
44
46
|
.add(tablePlugin);
|
|
45
47
|
const editor = (doc: DocBuilder) =>
|
|
46
48
|
createEditor<TablePluginState, PluginKey, typeof preset>({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
2
|
+
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
2
3
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
4
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
4
5
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
@@ -46,6 +47,7 @@ describe('table plugin: insert', () => {
|
|
|
46
47
|
.add(contentInsertionPlugin)
|
|
47
48
|
.add(widthPlugin)
|
|
48
49
|
.add(guidelinePlugin)
|
|
50
|
+
.add(selectionPlugin)
|
|
49
51
|
.add([
|
|
50
52
|
tablePlugin,
|
|
51
53
|
{
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
1
2
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
2
3
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
3
4
|
import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
@@ -41,6 +42,7 @@ describe('table plugin: commands', () => {
|
|
|
41
42
|
.add(contentInsertionPlugin)
|
|
42
43
|
.add(widthPlugin)
|
|
43
44
|
.add(guidelinePlugin)
|
|
45
|
+
.add(selectionPlugin)
|
|
44
46
|
.add([
|
|
45
47
|
tablePlugin,
|
|
46
48
|
{
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { uuid } from '@atlaskit/adf-schema';
|
|
2
2
|
import { TableSortOrder as SortOrder } from '@atlaskit/adf-schema/steps';
|
|
3
|
+
import selectionPlugin from '@atlaskit/editor-core/src/plugins/selection';
|
|
3
4
|
import { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
5
|
import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
5
6
|
import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
@@ -42,6 +43,7 @@ describe('Sort Table', () => {
|
|
|
42
43
|
.add(contentInsertionPlugin)
|
|
43
44
|
.add(widthPlugin)
|
|
44
45
|
.add(guidelinePlugin)
|
|
46
|
+
.add(selectionPlugin)
|
|
45
47
|
.add([tablePlugin, { tableOptions: { allowHeaderRow: true } }]),
|
|
46
48
|
doc: doc(
|
|
47
49
|
table()(
|
|
@@ -74,6 +76,7 @@ describe('Sort Table', () => {
|
|
|
74
76
|
.add(contentInsertionPlugin)
|
|
75
77
|
.add(widthPlugin)
|
|
76
78
|
.add(guidelinePlugin)
|
|
79
|
+
.add(selectionPlugin)
|
|
77
80
|
.add([tablePlugin, { tableOptions: { allowHeaderRow: true } }]),
|
|
78
81
|
doc: doc(
|
|
79
82
|
table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
|
|
@@ -100,6 +103,7 @@ describe('Sort Table', () => {
|
|
|
100
103
|
.add(contentInsertionPlugin)
|
|
101
104
|
.add(widthPlugin)
|
|
102
105
|
.add(guidelinePlugin)
|
|
106
|
+
.add(selectionPlugin)
|
|
103
107
|
.add([tablePlugin, { tableOptions: { allowHeaderRow: true } }]),
|
|
104
108
|
doc: doc(
|
|
105
109
|
table()(tr(td({})(p('2{<>}'))), tr(td({})(p('5'))), tr(td({})(p('4')))),
|