@atlaskit/editor-plugin-table 5.5.13 → 5.6.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 +5 -3
- package/dist/cjs/plugins/table/nodeviews/TableStickyScrollbar.js +2 -5
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/commands-with-analytics.js +72 -0
- package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +14 -5
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/index.js +4 -2
- package/dist/cjs/plugins/table/utils/drag-menu.js +6 -5
- package/dist/es2019/plugins/table/index.js +5 -3
- package/dist/es2019/plugins/table/nodeviews/TableStickyScrollbar.js +2 -5
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/commands-with-analytics.js +66 -0
- package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +15 -6
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/index.js +4 -2
- package/dist/es2019/plugins/table/utils/drag-menu.js +4 -3
- package/dist/esm/plugins/table/index.js +5 -3
- package/dist/esm/plugins/table/nodeviews/TableStickyScrollbar.js +2 -5
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/commands-with-analytics.js +66 -0
- package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +15 -6
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +3 -2
- package/dist/esm/plugins/table/ui/FloatingDragMenu/index.js +4 -2
- package/dist/esm/plugins/table/utils/drag-menu.js +4 -3
- package/dist/types/plugins/table/nodeviews/TableStickyScrollbar.d.ts +0 -1
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +6 -0
- package/dist/types/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +2 -1
- package/dist/types/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
- package/dist/types/plugins/table/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types/plugins/table/utils/drag-menu.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/TableStickyScrollbar.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/drag-and-drop/plugin.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/DragMenu.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/ui/FloatingDragMenu/index.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/utils/drag-menu.d.ts +2 -1
- package/package.json +2 -2
- package/src/__tests__/unit/analytics.ts +107 -3
- package/src/plugins/table/index.tsx +7 -2
- package/src/plugins/table/nodeviews/TableStickyScrollbar.ts +2 -7
- package/src/plugins/table/pm-plugins/drag-and-drop/commands-with-analytics.ts +100 -0
- package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +30 -9
- package/src/plugins/table/ui/FloatingDragMenu/DragMenu.tsx +4 -0
- package/src/plugins/table/ui/FloatingDragMenu/index.tsx +4 -0
- package/src/plugins/table/utils/drag-menu.ts +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 5.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#61294](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/61294) [`70b236bfd951`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/70b236bfd951) - remove raf from sticky scrollbar handler to fix jittery behaviour
|
|
8
|
+
|
|
9
|
+
## 5.6.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#60937](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/60937) [`fd6ea5aa5a6e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fd6ea5aa5a6e) - Added new table analytics to cover moving row/column scenarios
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 5.5.13
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -190,8 +190,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
190
190
|
name: 'tableDragAndDrop',
|
|
191
191
|
plugin: function plugin(_ref9) {
|
|
192
192
|
var dispatch = _ref9.dispatch,
|
|
193
|
-
eventDispatcher = _ref9.eventDispatcher
|
|
194
|
-
|
|
193
|
+
eventDispatcher = _ref9.eventDispatcher,
|
|
194
|
+
dispatchAnalyticsEvent = _ref9.dispatchAnalyticsEvent;
|
|
195
|
+
return options !== null && options !== void 0 && options.dragAndDropEnabled ? (0, _dragAndDrop.createPlugin)(dispatch, eventDispatcher, editorAnalyticsAPI) : undefined;
|
|
195
196
|
}
|
|
196
197
|
}, {
|
|
197
198
|
name: 'tableLocalId',
|
|
@@ -357,7 +358,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
357
358
|
index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
|
|
358
359
|
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
|
|
359
360
|
canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
|
|
360
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
361
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
362
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
361
363
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/_react.default.createElement(_FloatingDeleteButton.default, {
|
|
362
364
|
editorView: editorView,
|
|
363
365
|
selection: editorView.state.selection,
|
|
@@ -8,7 +8,6 @@ exports.TableStickyScrollbar = void 0;
|
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
12
11
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
13
12
|
var _types = require("../types");
|
|
14
13
|
var TableStickyScrollbar = exports.TableStickyScrollbar = /*#__PURE__*/function () {
|
|
@@ -22,7 +21,6 @@ var TableStickyScrollbar = exports.TableStickyScrollbar = /*#__PURE__*/function
|
|
|
22
21
|
}
|
|
23
22
|
_this.wrapper.scrollLeft = _this.stickyScrollbarContainerElement.scrollLeft;
|
|
24
23
|
});
|
|
25
|
-
(0, _defineProperty2.default)(this, "handleScrollDebounced", (0, _rafSchd.default)(this.handleScroll));
|
|
26
24
|
this.wrapper = wrapper;
|
|
27
25
|
this.view = view;
|
|
28
26
|
this.init();
|
|
@@ -31,8 +29,7 @@ var TableStickyScrollbar = exports.TableStickyScrollbar = /*#__PURE__*/function
|
|
|
31
29
|
key: "dispose",
|
|
32
30
|
value: function dispose() {
|
|
33
31
|
if (this.stickyScrollbarContainerElement) {
|
|
34
|
-
this.stickyScrollbarContainerElement.removeEventListener('scroll', this.
|
|
35
|
-
this.handleScrollDebounced.cancel();
|
|
32
|
+
this.stickyScrollbarContainerElement.removeEventListener('scroll', this.handleScroll);
|
|
36
33
|
}
|
|
37
34
|
this.deleteIntersectionObserver();
|
|
38
35
|
}
|
|
@@ -52,7 +49,7 @@ var TableStickyScrollbar = exports.TableStickyScrollbar = /*#__PURE__*/function
|
|
|
52
49
|
}
|
|
53
50
|
this.stickyScrollbarContainerElement = (_this$wrapper$parentE = this.wrapper.parentElement) === null || _this$wrapper$parentE === void 0 ? void 0 : _this$wrapper$parentE.querySelector(".".concat(_types.TableCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER));
|
|
54
51
|
if (this.stickyScrollbarContainerElement) {
|
|
55
|
-
this.stickyScrollbarContainerElement.addEventListener('scroll', this.
|
|
52
|
+
this.stickyScrollbarContainerElement.addEventListener('scroll', this.handleScroll, {
|
|
56
53
|
passive: true
|
|
57
54
|
});
|
|
58
55
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.moveSourceWithAnalytics = exports.clearDropTargetWithAnalytics = void 0;
|
|
7
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
|
+
var _utils = require("../../utils");
|
|
9
|
+
var _analytics2 = require("../../utils/analytics");
|
|
10
|
+
var _commands = require("./commands");
|
|
11
|
+
var clearDropTargetWithAnalytics = exports.clearDropTargetWithAnalytics = function clearDropTargetWithAnalytics(editorAnalyticsAPI) {
|
|
12
|
+
return function (inputMethod, sourceType, status, tr) {
|
|
13
|
+
return (0, _analytics2.withEditorAnalyticsAPI)(function (_ref) {
|
|
14
|
+
var selection = _ref.selection;
|
|
15
|
+
var _getSelectedTableInfo = (0, _utils.getSelectedTableInfo)(selection),
|
|
16
|
+
totalRowCount = _getSelectedTableInfo.totalRowCount,
|
|
17
|
+
totalColumnCount = _getSelectedTableInfo.totalColumnCount;
|
|
18
|
+
return {
|
|
19
|
+
action: sourceType === 'table-row' ? _analytics.TABLE_ACTION.MOVED_ROW : _analytics.TABLE_ACTION.MOVED_COLUMN,
|
|
20
|
+
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
21
|
+
actionSubjectId: null,
|
|
22
|
+
attributes: {
|
|
23
|
+
inputMethod: inputMethod,
|
|
24
|
+
// TODO: When multiple sources can be moved we need to update this count to be the amount of sources which are being moved.
|
|
25
|
+
count: 1,
|
|
26
|
+
distance: 0,
|
|
27
|
+
status: status,
|
|
28
|
+
totalRowCount: totalRowCount,
|
|
29
|
+
totalColumnCount: totalColumnCount
|
|
30
|
+
},
|
|
31
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
32
|
+
};
|
|
33
|
+
})(editorAnalyticsAPI)(function (state, dispatch) {
|
|
34
|
+
if (dispatch) {
|
|
35
|
+
(0, _commands.clearDropTarget)(tr)(state, dispatch);
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
var moveSourceWithAnalytics = exports.moveSourceWithAnalytics = function moveSourceWithAnalytics(editorAnalyticsAPI) {
|
|
42
|
+
return function (inputMethod, sourceType, sourceIndex, targetIndex, tr) {
|
|
43
|
+
return (0, _analytics2.withEditorAnalyticsAPI)(function (_ref2) {
|
|
44
|
+
var selection = _ref2.selection;
|
|
45
|
+
var _getSelectedTableInfo2 = (0, _utils.getSelectedTableInfo)(selection),
|
|
46
|
+
totalRowCount = _getSelectedTableInfo2.totalRowCount,
|
|
47
|
+
totalColumnCount = _getSelectedTableInfo2.totalColumnCount;
|
|
48
|
+
return {
|
|
49
|
+
action: sourceType === 'table-row' ? _analytics.TABLE_ACTION.MOVED_ROW : _analytics.TABLE_ACTION.MOVED_COLUMN,
|
|
50
|
+
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
51
|
+
actionSubjectId: null,
|
|
52
|
+
attributes: {
|
|
53
|
+
inputMethod: inputMethod,
|
|
54
|
+
// TODO: When multiple sources can be moved we need to update this count to be the amount of sources which are being moved.
|
|
55
|
+
count: 1,
|
|
56
|
+
// This identifies the total amount of row/cols the move operation covered
|
|
57
|
+
distance: targetIndex - sourceIndex,
|
|
58
|
+
// If a drop doesn't actually change anything then we're going to mark the event as cancelled.
|
|
59
|
+
status: sourceIndex === targetIndex ? _analytics.TABLE_STATUS.CANCELLED : _analytics.TABLE_STATUS.SUCCESS,
|
|
60
|
+
totalRowCount: totalRowCount,
|
|
61
|
+
totalColumnCount: totalColumnCount
|
|
62
|
+
},
|
|
63
|
+
eventType: _analytics.EVENT_TYPE.TRACK
|
|
64
|
+
};
|
|
65
|
+
})(editorAnalyticsAPI)(function (state, dispatch) {
|
|
66
|
+
if (dispatch) {
|
|
67
|
+
(0, _commands.moveSource)(sourceType, sourceIndex, targetIndex, tr)(state, dispatch);
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
};
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createPlugin = void 0;
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
11
12
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
13
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
@@ -18,13 +19,14 @@ var _pluginKey = require("../plugin-key");
|
|
|
18
19
|
var _utils3 = require("../table-resizing/utils");
|
|
19
20
|
var _actions = require("./actions");
|
|
20
21
|
var _commands = require("./commands");
|
|
22
|
+
var _commandsWithAnalytics = require("./commands-with-analytics");
|
|
21
23
|
var _consts = require("./consts");
|
|
22
24
|
var _pluginFactory2 = require("./plugin-factory");
|
|
23
25
|
var _pluginKey2 = require("./plugin-key");
|
|
24
26
|
var _monitor = require("./utils/monitor");
|
|
25
27
|
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; }
|
|
26
28
|
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) { (0, _defineProperty2.default)(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; }
|
|
27
|
-
var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventDispatcher) {
|
|
29
|
+
var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventDispatcher, editorAnalyticsAPI) {
|
|
28
30
|
return new _safePlugin.SafePlugin({
|
|
29
31
|
state: (0, _pluginFactory2.createPluginState)(dispatch, function (state) {
|
|
30
32
|
return {
|
|
@@ -165,8 +167,13 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
|
|
|
165
167
|
|
|
166
168
|
// If no data can be found then it's most like we do not want to perform any drop action
|
|
167
169
|
if (!data) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
var _event$source, _event$source2;
|
|
171
|
+
// If we're able to determine the source type of the dropped element then we should report to analytics that
|
|
172
|
+
// the drop event was cancelled. Otherwise we will cancel silently.
|
|
173
|
+
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') {
|
|
174
|
+
return (0, _commandsWithAnalytics.clearDropTargetWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.DRAG_AND_DROP, event.source.data.type, _analytics.TABLE_STATUS.CANCELLED, tr)(editorView.state, editorView.dispatch);
|
|
175
|
+
}
|
|
176
|
+
return (0, _commands.clearDropTarget)(tr)(editorView.state, editorView.dispatch);
|
|
170
177
|
}
|
|
171
178
|
var sourceType = data.sourceType,
|
|
172
179
|
sourceIndexes = data.sourceIndexes,
|
|
@@ -183,13 +190,15 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
|
|
|
183
190
|
|
|
184
191
|
// If the drop target index contains merged cells then we should not allow the drop to occur.
|
|
185
192
|
if ((0, _utils2.hasMergedCellsInBetween)([targetAdjustedIndex - 1, targetAdjustedIndex], sourceType === 'table-row' ? _consts.DropTargetType.ROW : _consts.DropTargetType.COLUMN)(editorView.state.selection)) {
|
|
186
|
-
(0,
|
|
193
|
+
(0, _commandsWithAnalytics.clearDropTargetWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.DRAG_AND_DROP, sourceType,
|
|
194
|
+
// This event is mrked as invalid because the user is attempting to drop an element in an area which has merged cells.
|
|
195
|
+
_analytics.TABLE_STATUS.INVALID, tr)(editorView.state, editorView.dispatch);
|
|
187
196
|
return;
|
|
188
197
|
}
|
|
189
198
|
var _sourceIndexes = (0, _slicedToArray2.default)(sourceIndexes, 1),
|
|
190
199
|
sourceIndex = _sourceIndexes[0];
|
|
191
200
|
requestAnimationFrame(function () {
|
|
192
|
-
(0,
|
|
201
|
+
(0, _commandsWithAnalytics.moveSourceWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.DRAG_AND_DROP, sourceType, sourceIndex, targetAdjustedIndex + (direction === -1 ? 0 : -1), tr)(editorView.state, editorView.dispatch);
|
|
193
202
|
|
|
194
203
|
// force a colgroup update here, otherwise dropped columns don't have
|
|
195
204
|
// the correct width immediately after the drop
|
|
@@ -76,7 +76,8 @@ var DragMenu = exports.DragMenu = function DragMenu(_ref) {
|
|
|
76
76
|
scrollableElement = _ref.scrollableElement,
|
|
77
77
|
targetCellPosition = _ref.targetCellPosition,
|
|
78
78
|
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
79
|
-
canDrag = _ref.canDrag
|
|
79
|
+
canDrag = _ref.canDrag,
|
|
80
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI;
|
|
80
81
|
var tableMap = tableNode ? _tableMap.TableMap.get(tableNode) : undefined;
|
|
81
82
|
var state = editorView.state,
|
|
82
83
|
dispatch = editorView.dispatch;
|
|
@@ -85,7 +86,7 @@ var DragMenu = exports.DragMenu = function DragMenu(_ref) {
|
|
|
85
86
|
var hasMergedCells = direction === 'row' ? _utils2.hasMergedCellsInRow : _utils2.hasMergedCellsInColumn;
|
|
86
87
|
var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
|
|
87
88
|
var hasMergedCellsInTable = (0, _utils2.getMergedCellsPositions)(state.tr).length > 0;
|
|
88
|
-
var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !!canDrag && !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect);
|
|
89
|
+
var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !!canDrag && !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI);
|
|
89
90
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig),
|
|
90
91
|
menuItems = _convertToDropdownIte.menuItems,
|
|
91
92
|
menuCallback = _convertToDropdownIte.menuCallback;
|
|
@@ -22,7 +22,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
22
22
|
index = _ref.index,
|
|
23
23
|
targetCellPosition = _ref.targetCellPosition,
|
|
24
24
|
getEditorContainerWidth = _ref.getEditorContainerWidth,
|
|
25
|
-
canDrag = _ref.canDrag
|
|
25
|
+
canDrag = _ref.canDrag,
|
|
26
|
+
editorAnalyticsAPI = _ref.editorAnalyticsAPI;
|
|
26
27
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
27
28
|
return null;
|
|
28
29
|
}
|
|
@@ -57,7 +58,8 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
|
|
|
57
58
|
index: index,
|
|
58
59
|
targetCellPosition: targetCellPosition,
|
|
59
60
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
60
|
-
canDrag: canDrag
|
|
61
|
+
canDrag: canDrag,
|
|
62
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
61
63
|
}));
|
|
62
64
|
};
|
|
63
65
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getDragMenuConfig = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _customSteps = require("@atlaskit/custom-steps");
|
|
10
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
11
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
11
12
|
var _arrowDown = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-down"));
|
|
12
13
|
var _arrowLeft = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-left"));
|
|
@@ -19,8 +20,8 @@ var _chevronDoubleDown = _interopRequireDefault(require("@atlaskit/icon/glyph/hi
|
|
|
19
20
|
var _chevronDoubleUp = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-double-up"));
|
|
20
21
|
var _commands = require("../commands");
|
|
21
22
|
var _delete = require("../commands/delete");
|
|
22
|
-
var
|
|
23
|
-
var
|
|
23
|
+
var _commandsWithAnalytics = require("../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
24
|
+
var _commands2 = require("../pm-plugins/table-resizing/commands");
|
|
24
25
|
var _resizeState = require("../pm-plugins/table-resizing/utils/resize-state");
|
|
25
26
|
var _toolbar = require("../toolbar");
|
|
26
27
|
var _transforms = require("../transforms");
|
|
@@ -42,7 +43,7 @@ var isDistributeColumnsEnabled = function isDistributeColumnsEnabled(state) {
|
|
|
42
43
|
}
|
|
43
44
|
return false;
|
|
44
45
|
};
|
|
45
|
-
var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect) {
|
|
46
|
+
var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI) {
|
|
46
47
|
var addOptions = direction === 'row' ? [{
|
|
47
48
|
label: 'above',
|
|
48
49
|
offset: 0,
|
|
@@ -134,7 +135,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
134
135
|
if (newResizeState) {
|
|
135
136
|
var resizeState = newResizeState.resizeState,
|
|
136
137
|
table = newResizeState.table;
|
|
137
|
-
(0,
|
|
138
|
+
(0, _commands2.distributeColumnsWidths)(resizeState, table)(state, dispatch);
|
|
138
139
|
return true;
|
|
139
140
|
}
|
|
140
141
|
return false;
|
|
@@ -176,7 +177,7 @@ var getDragMenuConfig = exports.getDragMenuConfig = function getDragMenuConfig(d
|
|
|
176
177
|
onClick: function onClick(state, dispatch) {
|
|
177
178
|
if (canMove(index)) {
|
|
178
179
|
requestAnimationFrame(function () {
|
|
179
|
-
(0,
|
|
180
|
+
(0, _commandsWithAnalytics.moveSourceWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.TABLE_CONTEXT_MENU, "table-".concat(direction), index, index + offset)(editorView.state, editorView.dispatch);
|
|
180
181
|
});
|
|
181
182
|
return true;
|
|
182
183
|
}
|
|
@@ -178,8 +178,9 @@ const tablesPlugin = ({
|
|
|
178
178
|
name: 'tableDragAndDrop',
|
|
179
179
|
plugin: ({
|
|
180
180
|
dispatch,
|
|
181
|
-
eventDispatcher
|
|
182
|
-
|
|
181
|
+
eventDispatcher,
|
|
182
|
+
dispatchAnalyticsEvent
|
|
183
|
+
}) => options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, eventDispatcher, editorAnalyticsAPI) : undefined
|
|
183
184
|
}, {
|
|
184
185
|
name: 'tableLocalId',
|
|
185
186
|
plugin: ({
|
|
@@ -351,7 +352,8 @@ const tablesPlugin = ({
|
|
|
351
352
|
index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
|
|
352
353
|
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
|
|
353
354
|
canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
|
|
354
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
355
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
356
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
355
357
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
356
358
|
editorView: editorView,
|
|
357
359
|
selection: editorView.state.selection,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import rafSchedule from 'raf-schd';
|
|
3
2
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
4
3
|
import { TableCssClassName as ClassName } from '../types';
|
|
5
4
|
export class TableStickyScrollbar {
|
|
@@ -11,15 +10,13 @@ export class TableStickyScrollbar {
|
|
|
11
10
|
}
|
|
12
11
|
this.wrapper.scrollLeft = this.stickyScrollbarContainerElement.scrollLeft;
|
|
13
12
|
});
|
|
14
|
-
_defineProperty(this, "handleScrollDebounced", rafSchedule(this.handleScroll));
|
|
15
13
|
this.wrapper = wrapper;
|
|
16
14
|
this.view = view;
|
|
17
15
|
this.init();
|
|
18
16
|
}
|
|
19
17
|
dispose() {
|
|
20
18
|
if (this.stickyScrollbarContainerElement) {
|
|
21
|
-
this.stickyScrollbarContainerElement.removeEventListener('scroll', this.
|
|
22
|
-
this.handleScrollDebounced.cancel();
|
|
19
|
+
this.stickyScrollbarContainerElement.removeEventListener('scroll', this.handleScroll);
|
|
23
20
|
}
|
|
24
21
|
this.deleteIntersectionObserver();
|
|
25
22
|
}
|
|
@@ -35,7 +32,7 @@ export class TableStickyScrollbar {
|
|
|
35
32
|
}
|
|
36
33
|
this.stickyScrollbarContainerElement = (_this$wrapper$parentE = this.wrapper.parentElement) === null || _this$wrapper$parentE === void 0 ? void 0 : _this$wrapper$parentE.querySelector(`.${ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER}`);
|
|
37
34
|
if (this.stickyScrollbarContainerElement) {
|
|
38
|
-
this.stickyScrollbarContainerElement.addEventListener('scroll', this.
|
|
35
|
+
this.stickyScrollbarContainerElement.addEventListener('scroll', this.handleScroll, {
|
|
39
36
|
passive: true
|
|
40
37
|
});
|
|
41
38
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { getSelectedTableInfo } from '../../utils';
|
|
3
|
+
import { withEditorAnalyticsAPI } from '../../utils/analytics';
|
|
4
|
+
import { clearDropTarget, moveSource } from './commands';
|
|
5
|
+
export const clearDropTargetWithAnalytics = editorAnalyticsAPI => (inputMethod, sourceType, status, tr) => {
|
|
6
|
+
return withEditorAnalyticsAPI(({
|
|
7
|
+
selection
|
|
8
|
+
}) => {
|
|
9
|
+
const {
|
|
10
|
+
totalRowCount,
|
|
11
|
+
totalColumnCount
|
|
12
|
+
} = getSelectedTableInfo(selection);
|
|
13
|
+
return {
|
|
14
|
+
action: sourceType === 'table-row' ? TABLE_ACTION.MOVED_ROW : TABLE_ACTION.MOVED_COLUMN,
|
|
15
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
16
|
+
actionSubjectId: null,
|
|
17
|
+
attributes: {
|
|
18
|
+
inputMethod,
|
|
19
|
+
// TODO: When multiple sources can be moved we need to update this count to be the amount of sources which are being moved.
|
|
20
|
+
count: 1,
|
|
21
|
+
distance: 0,
|
|
22
|
+
status,
|
|
23
|
+
totalRowCount,
|
|
24
|
+
totalColumnCount
|
|
25
|
+
},
|
|
26
|
+
eventType: EVENT_TYPE.TRACK
|
|
27
|
+
};
|
|
28
|
+
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
29
|
+
if (dispatch) {
|
|
30
|
+
clearDropTarget(tr)(state, dispatch);
|
|
31
|
+
}
|
|
32
|
+
return true;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
export const moveSourceWithAnalytics = editorAnalyticsAPI => (inputMethod, sourceType, sourceIndex, targetIndex, tr) => {
|
|
36
|
+
return withEditorAnalyticsAPI(({
|
|
37
|
+
selection
|
|
38
|
+
}) => {
|
|
39
|
+
const {
|
|
40
|
+
totalRowCount,
|
|
41
|
+
totalColumnCount
|
|
42
|
+
} = getSelectedTableInfo(selection);
|
|
43
|
+
return {
|
|
44
|
+
action: sourceType === 'table-row' ? TABLE_ACTION.MOVED_ROW : TABLE_ACTION.MOVED_COLUMN,
|
|
45
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
46
|
+
actionSubjectId: null,
|
|
47
|
+
attributes: {
|
|
48
|
+
inputMethod,
|
|
49
|
+
// TODO: When multiple sources can be moved we need to update this count to be the amount of sources which are being moved.
|
|
50
|
+
count: 1,
|
|
51
|
+
// This identifies the total amount of row/cols the move operation covered
|
|
52
|
+
distance: targetIndex - sourceIndex,
|
|
53
|
+
// If a drop doesn't actually change anything then we're going to mark the event as cancelled.
|
|
54
|
+
status: sourceIndex === targetIndex ? TABLE_STATUS.CANCELLED : TABLE_STATUS.SUCCESS,
|
|
55
|
+
totalRowCount,
|
|
56
|
+
totalColumnCount
|
|
57
|
+
},
|
|
58
|
+
eventType: EVENT_TYPE.TRACK
|
|
59
|
+
};
|
|
60
|
+
})(editorAnalyticsAPI)((state, dispatch) => {
|
|
61
|
+
if (dispatch) {
|
|
62
|
+
moveSource(sourceType, sourceIndex, targetIndex, tr)(state, dispatch);
|
|
63
|
+
}
|
|
64
|
+
return true;
|
|
65
|
+
});
|
|
66
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { INPUT_METHOD, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
3
|
import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
3
4
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
@@ -8,12 +9,13 @@ import { getPluginState as getTablePluginState } from '../plugin-factory';
|
|
|
8
9
|
import { pluginKey as tablePluginKey } from '../plugin-key';
|
|
9
10
|
import { insertColgroupFromNode } from '../table-resizing/utils';
|
|
10
11
|
import { DragAndDropActionType } from './actions';
|
|
11
|
-
import { clearDropTarget,
|
|
12
|
+
import { clearDropTarget, setDropTarget, toggleDragMenu } from './commands';
|
|
13
|
+
import { clearDropTargetWithAnalytics, moveSourceWithAnalytics } from './commands-with-analytics';
|
|
12
14
|
import { DRAGGABLE_TABLE_NODE_SIZE_LIMIT, DropTargetType } from './consts';
|
|
13
15
|
import { createPluginState, getPluginState } from './plugin-factory';
|
|
14
16
|
import { pluginKey } from './plugin-key';
|
|
15
17
|
import { getDraggableDataFromEvent } from './utils/monitor';
|
|
16
|
-
export const createPlugin = (dispatch, eventDispatcher) => {
|
|
18
|
+
export const createPlugin = (dispatch, eventDispatcher, editorAnalyticsAPI) => {
|
|
17
19
|
return new SafePlugin({
|
|
18
20
|
state: createPluginState(dispatch, state => ({
|
|
19
21
|
decorationSet: DecorationSet.empty,
|
|
@@ -165,8 +167,13 @@ export const createPlugin = (dispatch, eventDispatcher) => {
|
|
|
165
167
|
|
|
166
168
|
// If no data can be found then it's most like we do not want to perform any drop action
|
|
167
169
|
if (!data) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
var _event$source, _event$source$data, _event$source2, _event$source2$data;
|
|
171
|
+
// If we're able to determine the source type of the dropped element then we should report to analytics that
|
|
172
|
+
// the drop event was cancelled. Otherwise we will cancel silently.
|
|
173
|
+
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') {
|
|
174
|
+
return clearDropTargetWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.DRAG_AND_DROP, event.source.data.type, TABLE_STATUS.CANCELLED, tr)(editorView.state, editorView.dispatch);
|
|
175
|
+
}
|
|
176
|
+
return clearDropTarget(tr)(editorView.state, editorView.dispatch);
|
|
170
177
|
}
|
|
171
178
|
const {
|
|
172
179
|
sourceType,
|
|
@@ -185,12 +192,14 @@ export const createPlugin = (dispatch, eventDispatcher) => {
|
|
|
185
192
|
|
|
186
193
|
// If the drop target index contains merged cells then we should not allow the drop to occur.
|
|
187
194
|
if (hasMergedCellsInBetween([targetAdjustedIndex - 1, targetAdjustedIndex], sourceType === 'table-row' ? DropTargetType.ROW : DropTargetType.COLUMN)(editorView.state.selection)) {
|
|
188
|
-
|
|
195
|
+
clearDropTargetWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.DRAG_AND_DROP, sourceType,
|
|
196
|
+
// This event is mrked as invalid because the user is attempting to drop an element in an area which has merged cells.
|
|
197
|
+
TABLE_STATUS.INVALID, tr)(editorView.state, editorView.dispatch);
|
|
189
198
|
return;
|
|
190
199
|
}
|
|
191
200
|
const [sourceIndex] = sourceIndexes;
|
|
192
201
|
requestAnimationFrame(() => {
|
|
193
|
-
|
|
202
|
+
moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.DRAG_AND_DROP, sourceType, sourceIndex, targetAdjustedIndex + (direction === -1 ? 0 : -1), tr)(editorView.state, editorView.dispatch);
|
|
194
203
|
|
|
195
204
|
// force a colgroup update here, otherwise dropped columns don't have
|
|
196
205
|
// the correct width immediately after the drop
|
|
@@ -62,7 +62,8 @@ export const DragMenu = ({
|
|
|
62
62
|
scrollableElement,
|
|
63
63
|
targetCellPosition,
|
|
64
64
|
getEditorContainerWidth,
|
|
65
|
-
canDrag
|
|
65
|
+
canDrag,
|
|
66
|
+
editorAnalyticsAPI
|
|
66
67
|
}) => {
|
|
67
68
|
const tableMap = tableNode ? TableMap.get(tableNode) : undefined;
|
|
68
69
|
const {
|
|
@@ -76,7 +77,7 @@ export const DragMenu = ({
|
|
|
76
77
|
const hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
|
|
77
78
|
const shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
|
|
78
79
|
const hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
79
|
-
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !!canDrag && !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect);
|
|
80
|
+
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !!canDrag && !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI);
|
|
80
81
|
const {
|
|
81
82
|
menuItems,
|
|
82
83
|
menuCallback
|
|
@@ -15,7 +15,8 @@ const FloatingDragMenu = ({
|
|
|
15
15
|
index,
|
|
16
16
|
targetCellPosition,
|
|
17
17
|
getEditorContainerWidth,
|
|
18
|
-
canDrag
|
|
18
|
+
canDrag,
|
|
19
|
+
editorAnalyticsAPI
|
|
19
20
|
}) => {
|
|
20
21
|
if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
|
|
21
22
|
return null;
|
|
@@ -51,7 +52,8 @@ const FloatingDragMenu = ({
|
|
|
51
52
|
index: index,
|
|
52
53
|
targetCellPosition: targetCellPosition,
|
|
53
54
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
54
|
-
canDrag: canDrag
|
|
55
|
+
canDrag: canDrag,
|
|
56
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
55
57
|
}));
|
|
56
58
|
};
|
|
57
59
|
FloatingDragMenu.displayName = 'FloatingDragMenu';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
2
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
3
4
|
import ArrowDownIcon from '@atlaskit/icon/glyph/arrow-down';
|
|
4
5
|
import ArrowLeftIcon from '@atlaskit/icon/glyph/arrow-left';
|
|
@@ -11,7 +12,7 @@ import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-d
|
|
|
11
12
|
import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
|
|
12
13
|
import { clearMultipleCells, insertColumn, insertRow, sortByColumn } from '../commands';
|
|
13
14
|
import { deleteColumnsCommand } from '../commands/delete';
|
|
14
|
-
import {
|
|
15
|
+
import { moveSourceWithAnalytics } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
15
16
|
import { distributeColumnsWidths } from '../pm-plugins/table-resizing/commands';
|
|
16
17
|
import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
17
18
|
import { getClosestSelectionRect } from '../toolbar';
|
|
@@ -28,7 +29,7 @@ const isDistributeColumnsEnabled = state => {
|
|
|
28
29
|
}
|
|
29
30
|
return false;
|
|
30
31
|
};
|
|
31
|
-
export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect) => {
|
|
32
|
+
export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI) => {
|
|
32
33
|
const addOptions = direction === 'row' ? [{
|
|
33
34
|
label: 'above',
|
|
34
35
|
offset: 0,
|
|
@@ -159,7 +160,7 @@ export const getDragMenuConfig = (direction, getEditorContainerWidth, canDrag, h
|
|
|
159
160
|
onClick: (state, dispatch) => {
|
|
160
161
|
if (canMove(index)) {
|
|
161
162
|
requestAnimationFrame(() => {
|
|
162
|
-
|
|
163
|
+
moveSourceWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.TABLE_CONTEXT_MENU, `table-${direction}`, index, index + offset)(editorView.state, editorView.dispatch);
|
|
163
164
|
});
|
|
164
165
|
return true;
|
|
165
166
|
}
|
|
@@ -183,8 +183,9 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
183
183
|
name: 'tableDragAndDrop',
|
|
184
184
|
plugin: function plugin(_ref9) {
|
|
185
185
|
var dispatch = _ref9.dispatch,
|
|
186
|
-
eventDispatcher = _ref9.eventDispatcher
|
|
187
|
-
|
|
186
|
+
eventDispatcher = _ref9.eventDispatcher,
|
|
187
|
+
dispatchAnalyticsEvent = _ref9.dispatchAnalyticsEvent;
|
|
188
|
+
return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, eventDispatcher, editorAnalyticsAPI) : undefined;
|
|
188
189
|
}
|
|
189
190
|
}, {
|
|
190
191
|
name: 'tableLocalId',
|
|
@@ -350,7 +351,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
350
351
|
index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
|
|
351
352
|
isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
|
|
352
353
|
canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
|
|
353
|
-
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
354
|
+
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
355
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
354
356
|
}), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
355
357
|
editorView: editorView,
|
|
356
358
|
selection: editorView.state.selection,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
import rafSchedule from 'raf-schd';
|
|
5
4
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
6
5
|
import { TableCssClassName as ClassName } from '../types';
|
|
7
6
|
export var TableStickyScrollbar = /*#__PURE__*/function () {
|
|
@@ -15,7 +14,6 @@ export var TableStickyScrollbar = /*#__PURE__*/function () {
|
|
|
15
14
|
}
|
|
16
15
|
_this.wrapper.scrollLeft = _this.stickyScrollbarContainerElement.scrollLeft;
|
|
17
16
|
});
|
|
18
|
-
_defineProperty(this, "handleScrollDebounced", rafSchedule(this.handleScroll));
|
|
19
17
|
this.wrapper = wrapper;
|
|
20
18
|
this.view = view;
|
|
21
19
|
this.init();
|
|
@@ -24,8 +22,7 @@ export var TableStickyScrollbar = /*#__PURE__*/function () {
|
|
|
24
22
|
key: "dispose",
|
|
25
23
|
value: function dispose() {
|
|
26
24
|
if (this.stickyScrollbarContainerElement) {
|
|
27
|
-
this.stickyScrollbarContainerElement.removeEventListener('scroll', this.
|
|
28
|
-
this.handleScrollDebounced.cancel();
|
|
25
|
+
this.stickyScrollbarContainerElement.removeEventListener('scroll', this.handleScroll);
|
|
29
26
|
}
|
|
30
27
|
this.deleteIntersectionObserver();
|
|
31
28
|
}
|
|
@@ -45,7 +42,7 @@ export var TableStickyScrollbar = /*#__PURE__*/function () {
|
|
|
45
42
|
}
|
|
46
43
|
this.stickyScrollbarContainerElement = (_this$wrapper$parentE = this.wrapper.parentElement) === null || _this$wrapper$parentE === void 0 ? void 0 : _this$wrapper$parentE.querySelector(".".concat(ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER));
|
|
47
44
|
if (this.stickyScrollbarContainerElement) {
|
|
48
|
-
this.stickyScrollbarContainerElement.addEventListener('scroll', this.
|
|
45
|
+
this.stickyScrollbarContainerElement.addEventListener('scroll', this.handleScroll, {
|
|
49
46
|
passive: true
|
|
50
47
|
});
|
|
51
48
|
}
|