@atlaskit/editor-plugin-table 17.3.4 → 17.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/nodeviews/table.js +39 -7
  3. package/dist/cjs/pm-plugins/drag-and-drop/commands-with-analytics.js +49 -1
  4. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +5 -4
  5. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +5 -4
  6. package/dist/es2019/nodeviews/table.js +41 -7
  7. package/dist/es2019/pm-plugins/drag-and-drop/commands-with-analytics.js +47 -1
  8. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +5 -4
  9. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +5 -4
  10. package/dist/esm/nodeviews/table.js +39 -7
  11. package/dist/esm/pm-plugins/drag-and-drop/commands-with-analytics.js +49 -1
  12. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +5 -4
  13. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +5 -4
  14. package/dist/types/pm-plugins/commands/toggle.d.ts +1 -1
  15. package/dist/types/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +3 -1
  16. package/dist/types/ui/FloatingContextualButton/styles.d.ts +2 -2
  17. package/dist/types/ui/FloatingContextualMenu/styles.d.ts +2 -2
  18. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -4
  19. package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -4
  20. package/dist/types/ui/common-styles.d.ts +4 -4
  21. package/dist/types/ui/ui-styles.d.ts +20 -20
  22. package/dist/types-ts4.5/pm-plugins/commands/toggle.d.ts +1 -1
  23. package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +3 -1
  24. package/dist/types-ts4.5/ui/FloatingContextualButton/styles.d.ts +2 -2
  25. package/dist/types-ts4.5/ui/FloatingContextualMenu/styles.d.ts +2 -2
  26. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -4
  27. package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -4
  28. package/dist/types-ts4.5/ui/common-styles.d.ts +4 -4
  29. package/dist/types-ts4.5/ui/ui-styles.d.ts +20 -20
  30. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 17.3.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`d3b00bd311c9d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d3b00bd311c9d) -
8
+ Improves an edge case where users may face unexpected cursor jumps collaboratively
9
+ - Updated dependencies
10
+
11
+ ## 17.3.5
12
+
13
+ ### Patch Changes
14
+
15
+ - [`7f6ca0d7b6afc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7f6ca0d7b6afc) -
16
+ Updated the table drag menu to fire a track analytic event when the menu is opened
17
+ - Updated dependencies
18
+
3
19
  ## 17.3.4
4
20
 
5
21
  ### Patch Changes
@@ -17,9 +17,11 @@ var _react = _interopRequireDefault(require("react"));
17
17
  var _nodeWidth = require("@atlaskit/editor-common/node-width");
18
18
  var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
19
19
  var _model = require("@atlaskit/editor-prosemirror/model");
20
+ var _state = require("@atlaskit/editor-prosemirror/state");
20
21
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
21
22
  var _tableMap = require("@atlaskit/editor-tables/table-map");
22
23
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
23
25
  var _createPluginConfig = require("../pm-plugins/create-plugin-config");
24
26
  var _pluginFactory = require("../pm-plugins/plugin-factory");
25
27
  var _tableWidth = require("../pm-plugins/table-width");
@@ -146,8 +148,16 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
146
148
 
147
149
  // Store the current selection state if there is a visible selection
148
150
  // This lets us restore it after DOM changes
149
- if (this.view.state.selection.visible) {
150
- selectionBookmark = this.view.state.selection.getBookmark();
151
+ if ((0, _expValEquals.expValEquals)('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
152
+ var selection = this.view.state.selection;
153
+ var tablePos = this.getPos();
154
+ if (selection.empty && tablePos && _state.TextSelection.near(this.view.state.doc.resolve(tablePos)).from === selection.from) {
155
+ selectionBookmark = this.view.state.selection.getBookmark();
156
+ }
157
+ } else {
158
+ if (this.view.state.selection.visible) {
159
+ selectionBookmark = this.view.state.selection.getBookmark();
160
+ }
151
161
  }
152
162
  if (this.dom) {
153
163
  this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(this.node.attrs.localId));
@@ -172,11 +182,33 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
172
182
  // - The bookmarked selection is different from the current selection.
173
183
  if (selectionBookmark && mutationsIgnored) {
174
184
  var resolvedSelection = selectionBookmark.resolve(_this2.view.state.tr.doc);
175
- // Don't set the selection if it's the same as the current selection.
176
- if (!resolvedSelection.eq(_this2.view.state.selection)) {
177
- var tr = _this2.view.state.tr.setSelection(resolvedSelection);
178
- tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
179
- _this2.view.dispatch(tr);
185
+ if ((0, _expValEquals.expValEquals)('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
186
+ var _TextSelection$findFr;
187
+ /**
188
+ * This handles a very specific case only -> insertion by the user of a new
189
+ * table
190
+ * Since it's behind a RAF it's possible the user has clicked elsewhere or
191
+ * it affects collaborative users (which selection changes shouldn't ever)
192
+ *
193
+ * This ensures that the selectionBookmark *before* is inside the first
194
+ * position in the table and that after it is the text position directly
195
+ * before the table
196
+ * Ideally we want to remove this RAF entirely but that would require removing
197
+ * the DOM manipulation and is a more complex effort
198
+ */
199
+ if (!resolvedSelection.eq(_this2.view.state.selection) && resolvedSelection.empty && // Ensure that the *next* valid text position matches the first position
200
+ // in the table
201
+ (_TextSelection$findFr = _state.TextSelection.findFrom(_this2.view.state.doc.resolve(_this2.view.state.selection.from + 1), 1, true)) !== null && _TextSelection$findFr !== void 0 && _TextSelection$findFr.eq(resolvedSelection)) {
202
+ var tr = _this2.view.state.tr.setSelection(resolvedSelection);
203
+ tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
204
+ _this2.view.dispatch(tr);
205
+ }
206
+ } else {
207
+ if (!resolvedSelection.eq(_this2.view.state.selection)) {
208
+ var _tr = _this2.view.state.tr.setSelection(resolvedSelection);
209
+ _tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
210
+ _this2.view.dispatch(_tr);
211
+ }
180
212
  }
181
213
  }
182
214
  });
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.moveSourceWithAnalyticsViaShortcut = exports.moveSourceWithAnalytics = exports.cloneSourceWithAnalytics = exports.clearDropTargetWithAnalytics = void 0;
7
+ exports.toggleDragMenuWithAnalytics = exports.moveSourceWithAnalyticsViaShortcut = exports.moveSourceWithAnalytics = exports.cloneSourceWithAnalytics = exports.clearDropTargetWithAnalytics = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _messages = require("@atlaskit/editor-common/messages");
@@ -14,6 +14,7 @@ var _analytics2 = require("../utils/analytics");
14
14
  var _dragMenu = require("../utils/drag-menu");
15
15
  var _selection = require("../utils/selection");
16
16
  var _commands = require("./commands");
17
+ var _pluginFactory = require("./plugin-factory");
17
18
  var clearDropTargetWithAnalytics = exports.clearDropTargetWithAnalytics = function clearDropTargetWithAnalytics(editorAnalyticsAPI) {
18
19
  return function (inputMethod, sourceType, sourceIndexes, status, tr) {
19
20
  return (0, _analytics2.withEditorAnalyticsAPI)(function (_ref) {
@@ -151,4 +152,51 @@ var cloneSourceWithAnalytics = exports.cloneSourceWithAnalytics = function clone
151
152
  return true;
152
153
  });
153
154
  };
155
+ };
156
+ var toggleDragMenuWithAnalytics = exports.toggleDragMenuWithAnalytics = function toggleDragMenuWithAnalytics(editorAnalyticsAPI) {
157
+ return function (isDragMenuOpen, direction, index) {
158
+ var trigger = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'mouse';
159
+ return (0, _analytics2.withEditorAnalyticsAPI)(function (state) {
160
+ var _getPluginState = (0, _pluginFactory.getPluginState)(state),
161
+ previousOpenState = _getPluginState.isDragMenuOpen,
162
+ previousDragMenuDirection = _getPluginState.dragMenuDirection,
163
+ previousDragMenuIndex = _getPluginState.dragMenuIndex;
164
+ if (previousOpenState === isDragMenuOpen && previousDragMenuDirection === direction && previousDragMenuIndex === index) {
165
+ return undefined;
166
+ }
167
+ var updatedMenuOpenState;
168
+ if (isDragMenuOpen !== undefined) {
169
+ updatedMenuOpenState = isDragMenuOpen;
170
+ } else {
171
+ // menu open but menu direction changed, means user clicked on drag handle of different row/column
172
+ // menu open menu direction not changed, but index changed, means user clicked on drag handle of same row/column, different cells.
173
+ // 2 scenarios above , menu should remain open.
174
+ if (previousOpenState === true && previousDragMenuDirection !== direction || previousOpenState === true && previousDragMenuDirection === direction && previousDragMenuIndex !== index) {
175
+ updatedMenuOpenState = true;
176
+ } else {
177
+ updatedMenuOpenState = !previousOpenState;
178
+ }
179
+ }
180
+ if (updatedMenuOpenState) {
181
+ var _ref4;
182
+ // We only want to fire analytics when the menu is opened
183
+ return {
184
+ action: _analytics.TABLE_ACTION.DRAG_MENU_OPENED,
185
+ actionSubject: _analytics.ACTION_SUBJECT.TABLE,
186
+ actionSubjectId: null,
187
+ eventType: _analytics.EVENT_TYPE.TRACK,
188
+ attributes: {
189
+ inputMethod: trigger === 'keyboard' ? _analytics.INPUT_METHOD.KEYBOARD : _analytics.INPUT_METHOD.MOUSE,
190
+ direction: (_ref4 = direction !== null && direction !== void 0 ? direction : previousDragMenuDirection) !== null && _ref4 !== void 0 ? _ref4 : 'column'
191
+ }
192
+ };
193
+ }
194
+ return undefined;
195
+ })(editorAnalyticsAPI)(function (state, dispatch) {
196
+ if (dispatch) {
197
+ (0, _commands.toggleDragMenu)(isDragMenuOpen, direction, index, trigger)(state, dispatch);
198
+ }
199
+ return true;
200
+ });
201
+ };
154
202
  };
@@ -12,7 +12,7 @@ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _editorTables = require("@atlaskit/editor-tables");
13
13
  var _utils = require("@atlaskit/editor-tables/utils");
14
14
  var _commands = require("../../../pm-plugins/commands");
15
- var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
15
+ var _commandsWithAnalytics = require("../../../pm-plugins/drag-and-drop/commands-with-analytics");
16
16
  var _rowControls = require("../../../pm-plugins/utils/row-controls");
17
17
  var _selection = require("../../../pm-plugins/utils/selection");
18
18
  var _types = require("../../../types");
@@ -31,7 +31,7 @@ var getSelectedColumns = function getSelectedColumns(selection) {
31
31
  return [];
32
32
  };
33
33
  var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
34
- var _colWidths$map$join;
34
+ var _colWidths$map$join, _api$analytics2;
35
35
  var editorView = _ref.editorView,
36
36
  tableActive = _ref.tableActive,
37
37
  tableRef = _ref.tableRef,
@@ -124,13 +124,14 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
124
124
  }
125
125
  }, [editorView, tableActive]);
126
126
  var toggleDragMenuHandler = (0, _react.useCallback)(function (trigger, event) {
127
+ var _api$analytics;
127
128
  var state = editorView.state,
128
129
  dispatch = editorView.dispatch;
129
130
  if (event !== null && event !== void 0 && event.shiftKey) {
130
131
  return;
131
132
  }
132
- (0, _commands2.toggleDragMenu)(undefined, 'column', colIndex, trigger)(state, dispatch);
133
- }, [editorView, colIndex]);
133
+ (0, _commandsWithAnalytics.toggleDragMenuWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(undefined, 'column', colIndex, trigger)(state, dispatch);
134
+ }, [editorView, colIndex, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions]);
134
135
  var colIndexes = (0, _react.useMemo)(function () {
135
136
  // Ignored via go/ees005
136
137
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -14,7 +14,7 @@ var _utils = require("@atlaskit/editor-tables/utils");
14
14
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
15
15
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
16
16
  var _commands = require("../../../pm-plugins/commands");
17
- var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
17
+ var _commandsWithAnalytics = require("../../../pm-plugins/drag-and-drop/commands-with-analytics");
18
18
  var _pluginFactory = require("../../../pm-plugins/plugin-factory");
19
19
  var _rowControls = require("../../../pm-plugins/utils/row-controls");
20
20
  var _selection = require("../../../pm-plugins/utils/selection");
@@ -36,7 +36,7 @@ var getSelectedRows = function getSelectedRows(selection) {
36
36
  return [];
37
37
  };
38
38
  var DragControls = exports.DragControls = function DragControls(_ref) {
39
- var _tableNode$attrs$loca, _tableNode$attrs;
39
+ var _tableNode$attrs$loca, _tableNode$attrs, _api$analytics2;
40
40
  var tableRef = _ref.tableRef,
41
41
  tableNode = _ref.tableNode,
42
42
  tableWidth = _ref.tableWidth,
@@ -89,11 +89,12 @@ var DragControls = exports.DragControls = function DragControls(_ref) {
89
89
  });
90
90
  }, [editorView]);
91
91
  var toggleDragMenuHandler = (0, _react.useCallback)(function (trigger, event) {
92
+ var _api$analytics;
92
93
  if (event !== null && event !== void 0 && event.shiftKey) {
93
94
  return;
94
95
  }
95
- (0, _commands2.toggleDragMenu)(undefined, 'row', hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, trigger)(editorView.state, editorView.dispatch);
96
- }, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex]);
96
+ (0, _commandsWithAnalytics.toggleDragMenuWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(undefined, 'row', hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, trigger)(editorView.state, editorView.dispatch);
97
+ }, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions]);
97
98
  var rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
98
99
  var handleMouseOut = (0, _react.useCallback)(function () {
99
100
  if (tableActive) {
@@ -3,9 +3,11 @@ import React from 'react';
3
3
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
4
4
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
5
5
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
6
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
6
7
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
7
8
  import { TableMap } from '@atlaskit/editor-tables/table-map';
8
9
  import { fg } from '@atlaskit/platform-feature-flags';
10
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
11
  import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
10
12
  import { getPluginState } from '../pm-plugins/plugin-factory';
11
13
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
@@ -118,8 +120,18 @@ export default class TableView extends ReactNodeView {
118
120
 
119
121
  // Store the current selection state if there is a visible selection
120
122
  // This lets us restore it after DOM changes
121
- if (this.view.state.selection.visible) {
122
- selectionBookmark = this.view.state.selection.getBookmark();
123
+ if (expValEquals('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
124
+ const {
125
+ selection
126
+ } = this.view.state;
127
+ const tablePos = this.getPos();
128
+ if (selection.empty && tablePos && TextSelection.near(this.view.state.doc.resolve(tablePos)).from === selection.from) {
129
+ selectionBookmark = this.view.state.selection.getBookmark();
130
+ }
131
+ } else {
132
+ if (this.view.state.selection.visible) {
133
+ selectionBookmark = this.view.state.selection.getBookmark();
134
+ }
123
135
  }
124
136
  if (this.dom) {
125
137
  this.dom.setAttribute('data-ssr-placeholder', `table-nodeview-${this.node.attrs.localId}`);
@@ -144,11 +156,33 @@ export default class TableView extends ReactNodeView {
144
156
  // - The bookmarked selection is different from the current selection.
145
157
  if (selectionBookmark && mutationsIgnored) {
146
158
  const resolvedSelection = selectionBookmark.resolve(this.view.state.tr.doc);
147
- // Don't set the selection if it's the same as the current selection.
148
- if (!resolvedSelection.eq(this.view.state.selection)) {
149
- const tr = this.view.state.tr.setSelection(resolvedSelection);
150
- tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
151
- this.view.dispatch(tr);
159
+ if (expValEquals('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
160
+ var _TextSelection$findFr;
161
+ /**
162
+ * This handles a very specific case only -> insertion by the user of a new
163
+ * table
164
+ * Since it's behind a RAF it's possible the user has clicked elsewhere or
165
+ * it affects collaborative users (which selection changes shouldn't ever)
166
+ *
167
+ * This ensures that the selectionBookmark *before* is inside the first
168
+ * position in the table and that after it is the text position directly
169
+ * before the table
170
+ * Ideally we want to remove this RAF entirely but that would require removing
171
+ * the DOM manipulation and is a more complex effort
172
+ */
173
+ if (!resolvedSelection.eq(this.view.state.selection) && resolvedSelection.empty && // Ensure that the *next* valid text position matches the first position
174
+ // in the table
175
+ (_TextSelection$findFr = TextSelection.findFrom(this.view.state.doc.resolve(this.view.state.selection.from + 1), 1, true)) !== null && _TextSelection$findFr !== void 0 && _TextSelection$findFr.eq(resolvedSelection)) {
176
+ const tr = this.view.state.tr.setSelection(resolvedSelection);
177
+ tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
178
+ this.view.dispatch(tr);
179
+ }
180
+ } else {
181
+ if (!resolvedSelection.eq(this.view.state.selection)) {
182
+ const tr = this.view.state.tr.setSelection(resolvedSelection);
183
+ tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
184
+ this.view.dispatch(tr);
185
+ }
152
186
  }
153
187
  }
154
188
  });
@@ -5,7 +5,8 @@ import { findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tab
5
5
  import { getSelectedTableInfo, withEditorAnalyticsAPI } from '../utils/analytics';
6
6
  import { canMove, getTargetIndex } from '../utils/drag-menu';
7
7
  import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../utils/selection';
8
- import { clearDropTarget, cloneSource, moveSource } from './commands';
8
+ import { clearDropTarget, cloneSource, moveSource, toggleDragMenu } from './commands';
9
+ import { getPluginState } from './plugin-factory';
9
10
  export const clearDropTargetWithAnalytics = editorAnalyticsAPI => (inputMethod, sourceType, sourceIndexes, status, tr) => {
10
11
  return withEditorAnalyticsAPI(({
11
12
  selection
@@ -139,4 +140,49 @@ export const cloneSourceWithAnalytics = editorAnalyticsAPI => (inputMethod, sour
139
140
  }
140
141
  return true;
141
142
  });
143
+ };
144
+ export const toggleDragMenuWithAnalytics = editorAnalyticsAPI => (isDragMenuOpen, direction, index, trigger = 'mouse') => {
145
+ return withEditorAnalyticsAPI(state => {
146
+ const {
147
+ isDragMenuOpen: previousOpenState,
148
+ dragMenuDirection: previousDragMenuDirection,
149
+ dragMenuIndex: previousDragMenuIndex
150
+ } = getPluginState(state);
151
+ if (previousOpenState === isDragMenuOpen && previousDragMenuDirection === direction && previousDragMenuIndex === index) {
152
+ return undefined;
153
+ }
154
+ let updatedMenuOpenState;
155
+ if (isDragMenuOpen !== undefined) {
156
+ updatedMenuOpenState = isDragMenuOpen;
157
+ } else {
158
+ // menu open but menu direction changed, means user clicked on drag handle of different row/column
159
+ // menu open menu direction not changed, but index changed, means user clicked on drag handle of same row/column, different cells.
160
+ // 2 scenarios above , menu should remain open.
161
+ if (previousOpenState === true && previousDragMenuDirection !== direction || previousOpenState === true && previousDragMenuDirection === direction && previousDragMenuIndex !== index) {
162
+ updatedMenuOpenState = true;
163
+ } else {
164
+ updatedMenuOpenState = !previousOpenState;
165
+ }
166
+ }
167
+ if (updatedMenuOpenState) {
168
+ var _ref;
169
+ // We only want to fire analytics when the menu is opened
170
+ return {
171
+ action: TABLE_ACTION.DRAG_MENU_OPENED,
172
+ actionSubject: ACTION_SUBJECT.TABLE,
173
+ actionSubjectId: null,
174
+ eventType: EVENT_TYPE.TRACK,
175
+ attributes: {
176
+ inputMethod: trigger === 'keyboard' ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE,
177
+ direction: (_ref = direction !== null && direction !== void 0 ? direction : previousDragMenuDirection) !== null && _ref !== void 0 ? _ref : 'column'
178
+ }
179
+ };
180
+ }
181
+ return undefined;
182
+ })(editorAnalyticsAPI)((state, dispatch) => {
183
+ if (dispatch) {
184
+ toggleDragMenu(isDragMenuOpen, direction, index, trigger)(state, dispatch);
185
+ }
186
+ return true;
187
+ });
142
188
  };
@@ -7,7 +7,7 @@ import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
7
7
  import { CellSelection } from '@atlaskit/editor-tables';
8
8
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
9
9
  import { clearHoverSelection, hoverCell, hoverColumns, selectColumn, selectColumns } from '../../../pm-plugins/commands';
10
- import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
10
+ import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
11
11
  import { getRowsParams } from '../../../pm-plugins/utils/row-controls';
12
12
  import { getSelectedColumnIndexes } from '../../../pm-plugins/utils/selection';
13
13
  import { TableCssClassName as ClassName } from '../../../types';
@@ -39,7 +39,7 @@ export const ColumnControls = ({
39
39
  getScrollOffset,
40
40
  api
41
41
  }) => {
42
- var _colWidths$map$join;
42
+ var _colWidths$map$join, _api$analytics2;
43
43
  const columnControlsRef = useRef(null);
44
44
  const {
45
45
  selection
@@ -123,6 +123,7 @@ export const ColumnControls = ({
123
123
  }
124
124
  }, [editorView, tableActive]);
125
125
  const toggleDragMenuHandler = useCallback((trigger, event) => {
126
+ var _api$analytics;
126
127
  const {
127
128
  state,
128
129
  dispatch
@@ -130,8 +131,8 @@ export const ColumnControls = ({
130
131
  if (event !== null && event !== void 0 && event.shiftKey) {
131
132
  return;
132
133
  }
133
- toggleDragMenu(undefined, 'column', colIndex, trigger)(state, dispatch);
134
- }, [editorView, colIndex]);
134
+ toggleDragMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(undefined, 'column', colIndex, trigger)(state, dispatch);
135
+ }, [editorView, colIndex, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions]);
135
136
  const colIndexes = useMemo(() => {
136
137
  // Ignored via go/ees005
137
138
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -7,7 +7,7 @@ import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
7
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
8
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
9
  import { clearHoverSelection } from '../../../pm-plugins/commands';
10
- import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
10
+ import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
11
11
  import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
12
12
  import { getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
13
13
  import { getSelectedRowIndexes } from '../../../pm-plugins/utils/selection';
@@ -42,7 +42,7 @@ export const DragControls = ({
42
42
  api,
43
43
  selection
44
44
  }) => {
45
- var _tableNode$attrs$loca, _tableNode$attrs;
45
+ var _tableNode$attrs$loca, _tableNode$attrs, _api$analytics2;
46
46
  const [isDragging, setIsDragging] = useState(false);
47
47
  const rowHeights = getRowHeights(tableRef);
48
48
  const rowsParams = getRowsParams(rowHeights);
@@ -78,11 +78,12 @@ export const DragControls = ({
78
78
  });
79
79
  }, [editorView]);
80
80
  const toggleDragMenuHandler = useCallback((trigger, event) => {
81
+ var _api$analytics;
81
82
  if (event !== null && event !== void 0 && event.shiftKey) {
82
83
  return;
83
84
  }
84
- toggleDragMenu(undefined, 'row', hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, trigger)(editorView.state, editorView.dispatch);
85
- }, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex]);
85
+ toggleDragMenuWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(undefined, 'row', hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, trigger)(editorView.state, editorView.dispatch);
86
+ }, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions]);
86
87
  const rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
87
88
  const handleMouseOut = useCallback(() => {
88
89
  if (tableActive) {
@@ -13,9 +13,11 @@ import React from 'react';
13
13
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
14
14
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
15
15
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
16
+ import { TextSelection } from '@atlaskit/editor-prosemirror/state';
16
17
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
17
18
  import { TableMap } from '@atlaskit/editor-tables/table-map';
18
19
  import { fg } from '@atlaskit/platform-feature-flags';
20
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
19
21
  import { pluginConfig as getPluginConfig } from '../pm-plugins/create-plugin-config';
20
22
  import { getPluginState } from '../pm-plugins/plugin-factory';
21
23
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
@@ -139,8 +141,16 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
139
141
 
140
142
  // Store the current selection state if there is a visible selection
141
143
  // This lets us restore it after DOM changes
142
- if (this.view.state.selection.visible) {
143
- selectionBookmark = this.view.state.selection.getBookmark();
144
+ if (expValEquals('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
145
+ var selection = this.view.state.selection;
146
+ var tablePos = this.getPos();
147
+ if (selection.empty && tablePos && TextSelection.near(this.view.state.doc.resolve(tablePos)).from === selection.from) {
148
+ selectionBookmark = this.view.state.selection.getBookmark();
149
+ }
150
+ } else {
151
+ if (this.view.state.selection.visible) {
152
+ selectionBookmark = this.view.state.selection.getBookmark();
153
+ }
144
154
  }
145
155
  if (this.dom) {
146
156
  this.dom.setAttribute('data-ssr-placeholder', "table-nodeview-".concat(this.node.attrs.localId));
@@ -165,11 +175,33 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
165
175
  // - The bookmarked selection is different from the current selection.
166
176
  if (selectionBookmark && mutationsIgnored) {
167
177
  var resolvedSelection = selectionBookmark.resolve(_this2.view.state.tr.doc);
168
- // Don't set the selection if it's the same as the current selection.
169
- if (!resolvedSelection.eq(_this2.view.state.selection)) {
170
- var tr = _this2.view.state.tr.setSelection(resolvedSelection);
171
- tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
172
- _this2.view.dispatch(tr);
178
+ if (expValEquals('platform_editor_fix_cursor_flickering', 'isEnabled', true)) {
179
+ var _TextSelection$findFr;
180
+ /**
181
+ * This handles a very specific case only -> insertion by the user of a new
182
+ * table
183
+ * Since it's behind a RAF it's possible the user has clicked elsewhere or
184
+ * it affects collaborative users (which selection changes shouldn't ever)
185
+ *
186
+ * This ensures that the selectionBookmark *before* is inside the first
187
+ * position in the table and that after it is the text position directly
188
+ * before the table
189
+ * Ideally we want to remove this RAF entirely but that would require removing
190
+ * the DOM manipulation and is a more complex effort
191
+ */
192
+ if (!resolvedSelection.eq(_this2.view.state.selection) && resolvedSelection.empty && // Ensure that the *next* valid text position matches the first position
193
+ // in the table
194
+ (_TextSelection$findFr = TextSelection.findFrom(_this2.view.state.doc.resolve(_this2.view.state.selection.from + 1), 1, true)) !== null && _TextSelection$findFr !== void 0 && _TextSelection$findFr.eq(resolvedSelection)) {
195
+ var tr = _this2.view.state.tr.setSelection(resolvedSelection);
196
+ tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
197
+ _this2.view.dispatch(tr);
198
+ }
199
+ } else {
200
+ if (!resolvedSelection.eq(_this2.view.state.selection)) {
201
+ var _tr = _this2.view.state.tr.setSelection(resolvedSelection);
202
+ _tr.setMeta('source', 'TableNodeView:_handleTableRef:selection-resync');
203
+ _this2.view.dispatch(_tr);
204
+ }
173
205
  }
174
206
  }
175
207
  });
@@ -6,7 +6,8 @@ import { findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tab
6
6
  import { getSelectedTableInfo, withEditorAnalyticsAPI } from '../utils/analytics';
7
7
  import { canMove, getTargetIndex } from '../utils/drag-menu';
8
8
  import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../utils/selection';
9
- import { clearDropTarget, cloneSource, moveSource } from './commands';
9
+ import { clearDropTarget, cloneSource, moveSource, toggleDragMenu } from './commands';
10
+ import { getPluginState } from './plugin-factory';
10
11
  export var clearDropTargetWithAnalytics = function clearDropTargetWithAnalytics(editorAnalyticsAPI) {
11
12
  return function (inputMethod, sourceType, sourceIndexes, status, tr) {
12
13
  return withEditorAnalyticsAPI(function (_ref) {
@@ -144,4 +145,51 @@ export var cloneSourceWithAnalytics = function cloneSourceWithAnalytics(editorAn
144
145
  return true;
145
146
  });
146
147
  };
148
+ };
149
+ export var toggleDragMenuWithAnalytics = function toggleDragMenuWithAnalytics(editorAnalyticsAPI) {
150
+ return function (isDragMenuOpen, direction, index) {
151
+ var trigger = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'mouse';
152
+ return withEditorAnalyticsAPI(function (state) {
153
+ var _getPluginState = getPluginState(state),
154
+ previousOpenState = _getPluginState.isDragMenuOpen,
155
+ previousDragMenuDirection = _getPluginState.dragMenuDirection,
156
+ previousDragMenuIndex = _getPluginState.dragMenuIndex;
157
+ if (previousOpenState === isDragMenuOpen && previousDragMenuDirection === direction && previousDragMenuIndex === index) {
158
+ return undefined;
159
+ }
160
+ var updatedMenuOpenState;
161
+ if (isDragMenuOpen !== undefined) {
162
+ updatedMenuOpenState = isDragMenuOpen;
163
+ } else {
164
+ // menu open but menu direction changed, means user clicked on drag handle of different row/column
165
+ // menu open menu direction not changed, but index changed, means user clicked on drag handle of same row/column, different cells.
166
+ // 2 scenarios above , menu should remain open.
167
+ if (previousOpenState === true && previousDragMenuDirection !== direction || previousOpenState === true && previousDragMenuDirection === direction && previousDragMenuIndex !== index) {
168
+ updatedMenuOpenState = true;
169
+ } else {
170
+ updatedMenuOpenState = !previousOpenState;
171
+ }
172
+ }
173
+ if (updatedMenuOpenState) {
174
+ var _ref4;
175
+ // We only want to fire analytics when the menu is opened
176
+ return {
177
+ action: TABLE_ACTION.DRAG_MENU_OPENED,
178
+ actionSubject: ACTION_SUBJECT.TABLE,
179
+ actionSubjectId: null,
180
+ eventType: EVENT_TYPE.TRACK,
181
+ attributes: {
182
+ inputMethod: trigger === 'keyboard' ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE,
183
+ direction: (_ref4 = direction !== null && direction !== void 0 ? direction : previousDragMenuDirection) !== null && _ref4 !== void 0 ? _ref4 : 'column'
184
+ }
185
+ };
186
+ }
187
+ return undefined;
188
+ })(editorAnalyticsAPI)(function (state, dispatch) {
189
+ if (dispatch) {
190
+ toggleDragMenu(isDragMenuOpen, direction, index, trigger)(state, dispatch);
191
+ }
192
+ return true;
193
+ });
194
+ };
147
195
  };
@@ -7,7 +7,7 @@ import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
7
7
  import { CellSelection } from '@atlaskit/editor-tables';
8
8
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
9
9
  import { clearHoverSelection, hoverCell, hoverColumns, selectColumn, selectColumns } from '../../../pm-plugins/commands';
10
- import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
10
+ import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
11
11
  import { getRowsParams } from '../../../pm-plugins/utils/row-controls';
12
12
  import { getSelectedColumnIndexes } from '../../../pm-plugins/utils/selection';
13
13
  import { TableCssClassName as ClassName } from '../../../types';
@@ -23,7 +23,7 @@ var getSelectedColumns = function getSelectedColumns(selection) {
23
23
  return [];
24
24
  };
25
25
  export var ColumnControls = function ColumnControls(_ref) {
26
- var _colWidths$map$join;
26
+ var _colWidths$map$join, _api$analytics2;
27
27
  var editorView = _ref.editorView,
28
28
  tableActive = _ref.tableActive,
29
29
  tableRef = _ref.tableRef,
@@ -116,13 +116,14 @@ export var ColumnControls = function ColumnControls(_ref) {
116
116
  }
117
117
  }, [editorView, tableActive]);
118
118
  var toggleDragMenuHandler = useCallback(function (trigger, event) {
119
+ var _api$analytics;
119
120
  var state = editorView.state,
120
121
  dispatch = editorView.dispatch;
121
122
  if (event !== null && event !== void 0 && event.shiftKey) {
122
123
  return;
123
124
  }
124
- toggleDragMenu(undefined, 'column', colIndex, trigger)(state, dispatch);
125
- }, [editorView, colIndex]);
125
+ toggleDragMenuWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(undefined, 'column', colIndex, trigger)(state, dispatch);
126
+ }, [editorView, colIndex, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions]);
126
127
  var colIndexes = useMemo(function () {
127
128
  // Ignored via go/ees005
128
129
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -8,7 +8,7 @@ import { getSelectionRect } from '@atlaskit/editor-tables/utils';
8
8
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
9
9
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
10
  import { clearHoverSelection } from '../../../pm-plugins/commands';
11
- import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
11
+ import { toggleDragMenuWithAnalytics } from '../../../pm-plugins/drag-and-drop/commands-with-analytics';
12
12
  import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
13
13
  import { getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
14
14
  import { getSelectedRowIndexes } from '../../../pm-plugins/utils/selection';
@@ -27,7 +27,7 @@ var getSelectedRows = function getSelectedRows(selection) {
27
27
  return [];
28
28
  };
29
29
  export var DragControls = function DragControls(_ref) {
30
- var _tableNode$attrs$loca, _tableNode$attrs;
30
+ var _tableNode$attrs$loca, _tableNode$attrs, _api$analytics2;
31
31
  var tableRef = _ref.tableRef,
32
32
  tableNode = _ref.tableNode,
33
33
  tableWidth = _ref.tableWidth,
@@ -80,11 +80,12 @@ export var DragControls = function DragControls(_ref) {
80
80
  });
81
81
  }, [editorView]);
82
82
  var toggleDragMenuHandler = useCallback(function (trigger, event) {
83
+ var _api$analytics;
83
84
  if (event !== null && event !== void 0 && event.shiftKey) {
84
85
  return;
85
86
  }
86
- toggleDragMenu(undefined, 'row', hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, trigger)(editorView.state, editorView.dispatch);
87
- }, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex]);
87
+ toggleDragMenuWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)(undefined, 'row', hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, trigger)(editorView.state, editorView.dispatch);
88
+ }, [editorView, hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions]);
88
89
  var rowIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.rowIndex;
89
90
  var handleMouseOut = useCallback(function () {
90
91
  if (tableActive) {
@@ -4,7 +4,7 @@ import type { Command } from '@atlaskit/editor-common/types';
4
4
  * Table layout toggle logic
5
5
  * default -> wide -> full-width -> default
6
6
  */
7
- export declare const getNextLayout: (currentLayout: TableLayout) => "default" | "full-width" | "wide";
7
+ export declare const getNextLayout: (currentLayout: TableLayout) => "wide" | "full-width" | "default";
8
8
  export declare const toggleHeaderRow: Command;
9
9
  export declare const toggleHeaderColumn: Command;
10
10
  export declare const toggleNumberColumn: Command;
@@ -4,8 +4,10 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { Command } from '@atlaskit/editor-common/types';
5
5
  import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
6
6
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
7
- import type { DraggableData, DraggableType } from '../../types';
7
+ import type { DraggableData, DraggableType, TableDirection } from '../../types';
8
+ import type { TriggerType } from './types';
8
9
  export declare const clearDropTargetWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, sourceIndexes: number[] | undefined, status: TABLE_STATUS.CANCELLED | TABLE_STATUS.INVALID, tr?: Transaction) => Command;
9
10
  export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void, getIntl?: () => IntlShape) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, tr?: Transaction) => Command;
10
11
  export declare const moveSourceWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void, getIntl?: () => IntlShape) => (sourceType: DraggableType, direction: DraggableData["direction"]) => Command;
11
12
  export declare const cloneSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, targetDirection: "start" | "end", tr?: Transaction) => Command;
13
+ export declare const toggleDragMenuWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (isDragMenuOpen: boolean | undefined, direction?: TableDirection, index?: number, trigger?: TriggerType) => Command;
@@ -1,2 +1,2 @@
1
- export declare const tableFloatingCellButtonStyles: () => import("@emotion/react").SerializedStyles;
2
- export declare const tableFloatingCellButtonSelectedStyles: () => import("@emotion/react").SerializedStyles;
1
+ export declare const tableFloatingCellButtonStyles: () => import("@emotion/utils").SerializedStyles;
2
+ export declare const tableFloatingCellButtonSelectedStyles: () => import("@emotion/utils").SerializedStyles;
@@ -1,2 +1,2 @@
1
- export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
- export declare const tablePopupStyles: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/react").SerializedStyles;
1
+ export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/utils").SerializedStyles;
2
+ export declare const tablePopupStyles: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/utils").SerializedStyles;
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { TablePlugin } from '../../../tablePluginType';
5
- import type { CellHoverMeta } from '../../../types';
3
+ import type { CellHoverMeta, PluginInjectionAPI } from '../../../types';
6
4
  interface ColumnControlsProps {
7
5
  colWidths?: (number | undefined)[];
8
6
  editorView: EditorView;
@@ -21,6 +19,6 @@ interface ColumnControlsProps {
21
19
  tableRef: HTMLTableElement;
22
20
  }
23
21
  export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, stickyTop, localId, isInDanger, rowHeights, colWidths, isTableHovered, tableContainerWidth, isNumberColumnEnabled, isDragging, getScrollOffset, api, }: ColumnControlsProps & {
24
- api?: ExtractInjectionAPI<TablePlugin>;
22
+ api?: PluginInjectionAPI;
25
23
  }) => React.JSX.Element;
26
24
  export {};
@@ -1,12 +1,10 @@
1
1
  import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
2
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
4
3
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
5
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
- import type { TablePlugin } from '../../../tablePluginType';
7
- import type { CellHoverMeta } from '../../../types';
5
+ import type { CellHoverMeta, PluginInjectionAPI } from '../../../types';
8
6
  type DragControlsProps = {
9
- api?: ExtractInjectionAPI<TablePlugin>;
7
+ api?: PluginInjectionAPI;
10
8
  editorView: EditorView;
11
9
  hoveredCell?: CellHoverMeta;
12
10
  hoverRows: (rows: number[], danger?: boolean) => void;
@@ -4,10 +4,10 @@ export declare const tableRowHeight = 44;
4
4
  export declare const baseTableStyles: (props: {
5
5
  featureFlags?: FeatureFlags;
6
6
  isDragAndDropEnabled?: boolean;
7
- }) => import("@emotion/react").SerializedStyles;
7
+ }) => import("@emotion/utils").SerializedStyles;
8
8
  export declare const tableStyles: (props: {
9
9
  featureFlags?: FeatureFlags;
10
10
  isDragAndDropEnabled?: boolean;
11
- }) => import("@emotion/react").SerializedStyles;
12
- export declare const tableFullPageEditorStyles: import("@emotion/react").SerializedStyles;
13
- export declare const tableCommentEditorStyles: import("@emotion/react").SerializedStyles;
11
+ }) => import("@emotion/utils").SerializedStyles;
12
+ export declare const tableFullPageEditorStyles: import("@emotion/utils").SerializedStyles;
13
+ export declare const tableCommentEditorStyles: import("@emotion/utils").SerializedStyles;
@@ -1,20 +1,20 @@
1
- export declare const InsertMarker: (cssString?: string) => import("@emotion/react").SerializedStyles;
2
- export declare const HeaderButton: (cssString?: string) => import("@emotion/react").SerializedStyles;
3
- export declare const HeaderButtonHover: () => import("@emotion/react").SerializedStyles;
4
- export declare const HeaderButtonDanger: () => import("@emotion/react").SerializedStyles;
5
- export declare const dragInsertButtonWrapper: () => import("@emotion/react").SerializedStyles;
6
- export declare const dragCornerControlButton: () => import("@emotion/react").SerializedStyles;
7
- export declare const insertColumnButtonWrapper: () => import("@emotion/react").SerializedStyles;
8
- export declare const insertRowButtonWrapper: () => import("@emotion/react").SerializedStyles;
9
- export declare const columnControlsLineMarker: () => import("@emotion/react").SerializedStyles;
10
- export declare const DeleteButton: () => import("@emotion/react").SerializedStyles;
11
- export declare const OverflowShadow: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/react").SerializedStyles;
12
- export declare const OverflowShadowLessPadding: (tableOverflowShadowWidth: number) => import("@emotion/react").SerializedStyles;
13
- export declare const floatingColumnControls: () => import("@emotion/react").SerializedStyles;
14
- export declare const rowControlsWrapperDotStyle: () => import("@emotion/react").SerializedStyles;
15
- export declare const columnControlsDecoration: () => import("@emotion/react").SerializedStyles;
16
- export declare const hoveredDeleteButton: () => import("@emotion/react").SerializedStyles;
17
- export declare const hoveredCell: () => import("@emotion/react").SerializedStyles;
18
- export declare const hoveredWarningCell: import("@emotion/react").SerializedStyles;
19
- export declare const resizeHandle: () => import("@emotion/react").SerializedStyles;
20
- export declare const insertLine: () => import("@emotion/react").SerializedStyles;
1
+ export declare const InsertMarker: (cssString?: string) => import("@emotion/utils").SerializedStyles;
2
+ export declare const HeaderButton: (cssString?: string) => import("@emotion/utils").SerializedStyles;
3
+ export declare const HeaderButtonHover: () => import("@emotion/utils").SerializedStyles;
4
+ export declare const HeaderButtonDanger: () => import("@emotion/utils").SerializedStyles;
5
+ export declare const dragInsertButtonWrapper: () => import("@emotion/utils").SerializedStyles;
6
+ export declare const dragCornerControlButton: () => import("@emotion/utils").SerializedStyles;
7
+ export declare const insertColumnButtonWrapper: () => import("@emotion/utils").SerializedStyles;
8
+ export declare const insertRowButtonWrapper: () => import("@emotion/utils").SerializedStyles;
9
+ export declare const columnControlsLineMarker: () => import("@emotion/utils").SerializedStyles;
10
+ export declare const DeleteButton: () => import("@emotion/utils").SerializedStyles;
11
+ export declare const OverflowShadow: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/utils").SerializedStyles;
12
+ export declare const OverflowShadowLessPadding: (tableOverflowShadowWidth: number) => import("@emotion/utils").SerializedStyles;
13
+ export declare const floatingColumnControls: () => import("@emotion/utils").SerializedStyles;
14
+ export declare const rowControlsWrapperDotStyle: () => import("@emotion/utils").SerializedStyles;
15
+ export declare const columnControlsDecoration: () => import("@emotion/utils").SerializedStyles;
16
+ export declare const hoveredDeleteButton: () => import("@emotion/utils").SerializedStyles;
17
+ export declare const hoveredCell: () => import("@emotion/utils").SerializedStyles;
18
+ export declare const hoveredWarningCell: import("@emotion/utils").SerializedStyles;
19
+ export declare const resizeHandle: () => import("@emotion/utils").SerializedStyles;
20
+ export declare const insertLine: () => import("@emotion/utils").SerializedStyles;
@@ -4,7 +4,7 @@ import type { Command } from '@atlaskit/editor-common/types';
4
4
  * Table layout toggle logic
5
5
  * default -> wide -> full-width -> default
6
6
  */
7
- export declare const getNextLayout: (currentLayout: TableLayout) => "default" | "full-width" | "wide";
7
+ export declare const getNextLayout: (currentLayout: TableLayout) => "wide" | "full-width" | "default";
8
8
  export declare const toggleHeaderRow: Command;
9
9
  export declare const toggleHeaderColumn: Command;
10
10
  export declare const toggleNumberColumn: Command;
@@ -4,8 +4,10 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  import type { Command } from '@atlaskit/editor-common/types';
5
5
  import type { AriaLiveElementAttributes } from '@atlaskit/editor-plugin-accessibility-utils';
6
6
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
7
- import type { DraggableData, DraggableType } from '../../types';
7
+ import type { DraggableData, DraggableType, TableDirection } from '../../types';
8
+ import type { TriggerType } from './types';
8
9
  export declare const clearDropTargetWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP, sourceType: DraggableType, sourceIndexes: number[] | undefined, status: TABLE_STATUS.CANCELLED | TABLE_STATUS.INVALID, tr?: Transaction) => Command;
9
10
  export declare const moveSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void, getIntl?: () => IntlShape) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, tr?: Transaction) => Command;
10
11
  export declare const moveSourceWithAnalyticsViaShortcut: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void, getIntl?: () => IntlShape) => (sourceType: DraggableType, direction: DraggableData["direction"]) => Command;
11
12
  export declare const cloneSourceWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (inputMethod: INPUT_METHOD.TABLE_CONTEXT_MENU | INPUT_METHOD.DRAG_AND_DROP | INPUT_METHOD.SHORTCUT, sourceType: DraggableType, sourceIndexes: number[], targetIndex: number, targetDirection: "start" | "end", tr?: Transaction) => Command;
13
+ export declare const toggleDragMenuWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) => (isDragMenuOpen: boolean | undefined, direction?: TableDirection, index?: number, trigger?: TriggerType) => Command;
@@ -1,2 +1,2 @@
1
- export declare const tableFloatingCellButtonStyles: () => import("@emotion/react").SerializedStyles;
2
- export declare const tableFloatingCellButtonSelectedStyles: () => import("@emotion/react").SerializedStyles;
1
+ export declare const tableFloatingCellButtonStyles: () => import("@emotion/utils").SerializedStyles;
2
+ export declare const tableFloatingCellButtonSelectedStyles: () => import("@emotion/utils").SerializedStyles;
@@ -1,2 +1,2 @@
1
- export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/react").SerializedStyles;
2
- export declare const tablePopupStyles: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/react").SerializedStyles;
1
+ export declare const cellColourPreviewStyles: (selectedColor: string) => import("@emotion/utils").SerializedStyles;
2
+ export declare const tablePopupStyles: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/utils").SerializedStyles;
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
2
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { TablePlugin } from '../../../tablePluginType';
5
- import type { CellHoverMeta } from '../../../types';
3
+ import type { CellHoverMeta, PluginInjectionAPI } from '../../../types';
6
4
  interface ColumnControlsProps {
7
5
  colWidths?: (number | undefined)[];
8
6
  editorView: EditorView;
@@ -21,6 +19,6 @@ interface ColumnControlsProps {
21
19
  tableRef: HTMLTableElement;
22
20
  }
23
21
  export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, stickyTop, localId, isInDanger, rowHeights, colWidths, isTableHovered, tableContainerWidth, isNumberColumnEnabled, isDragging, getScrollOffset, api, }: ColumnControlsProps & {
24
- api?: ExtractInjectionAPI<TablePlugin>;
22
+ api?: PluginInjectionAPI;
25
23
  }) => React.JSX.Element;
26
24
  export {};
@@ -1,12 +1,10 @@
1
1
  import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
2
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
4
3
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
5
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
6
- import type { TablePlugin } from '../../../tablePluginType';
7
- import type { CellHoverMeta } from '../../../types';
5
+ import type { CellHoverMeta, PluginInjectionAPI } from '../../../types';
8
6
  type DragControlsProps = {
9
- api?: ExtractInjectionAPI<TablePlugin>;
7
+ api?: PluginInjectionAPI;
10
8
  editorView: EditorView;
11
9
  hoveredCell?: CellHoverMeta;
12
10
  hoverRows: (rows: number[], danger?: boolean) => void;
@@ -4,10 +4,10 @@ export declare const tableRowHeight = 44;
4
4
  export declare const baseTableStyles: (props: {
5
5
  featureFlags?: FeatureFlags;
6
6
  isDragAndDropEnabled?: boolean;
7
- }) => import("@emotion/react").SerializedStyles;
7
+ }) => import("@emotion/utils").SerializedStyles;
8
8
  export declare const tableStyles: (props: {
9
9
  featureFlags?: FeatureFlags;
10
10
  isDragAndDropEnabled?: boolean;
11
- }) => import("@emotion/react").SerializedStyles;
12
- export declare const tableFullPageEditorStyles: import("@emotion/react").SerializedStyles;
13
- export declare const tableCommentEditorStyles: import("@emotion/react").SerializedStyles;
11
+ }) => import("@emotion/utils").SerializedStyles;
12
+ export declare const tableFullPageEditorStyles: import("@emotion/utils").SerializedStyles;
13
+ export declare const tableCommentEditorStyles: import("@emotion/utils").SerializedStyles;
@@ -1,20 +1,20 @@
1
- export declare const InsertMarker: (cssString?: string) => import("@emotion/react").SerializedStyles;
2
- export declare const HeaderButton: (cssString?: string) => import("@emotion/react").SerializedStyles;
3
- export declare const HeaderButtonHover: () => import("@emotion/react").SerializedStyles;
4
- export declare const HeaderButtonDanger: () => import("@emotion/react").SerializedStyles;
5
- export declare const dragInsertButtonWrapper: () => import("@emotion/react").SerializedStyles;
6
- export declare const dragCornerControlButton: () => import("@emotion/react").SerializedStyles;
7
- export declare const insertColumnButtonWrapper: () => import("@emotion/react").SerializedStyles;
8
- export declare const insertRowButtonWrapper: () => import("@emotion/react").SerializedStyles;
9
- export declare const columnControlsLineMarker: () => import("@emotion/react").SerializedStyles;
10
- export declare const DeleteButton: () => import("@emotion/react").SerializedStyles;
11
- export declare const OverflowShadow: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/react").SerializedStyles;
12
- export declare const OverflowShadowLessPadding: (tableOverflowShadowWidth: number) => import("@emotion/react").SerializedStyles;
13
- export declare const floatingColumnControls: () => import("@emotion/react").SerializedStyles;
14
- export declare const rowControlsWrapperDotStyle: () => import("@emotion/react").SerializedStyles;
15
- export declare const columnControlsDecoration: () => import("@emotion/react").SerializedStyles;
16
- export declare const hoveredDeleteButton: () => import("@emotion/react").SerializedStyles;
17
- export declare const hoveredCell: () => import("@emotion/react").SerializedStyles;
18
- export declare const hoveredWarningCell: import("@emotion/react").SerializedStyles;
19
- export declare const resizeHandle: () => import("@emotion/react").SerializedStyles;
20
- export declare const insertLine: () => import("@emotion/react").SerializedStyles;
1
+ export declare const InsertMarker: (cssString?: string) => import("@emotion/utils").SerializedStyles;
2
+ export declare const HeaderButton: (cssString?: string) => import("@emotion/utils").SerializedStyles;
3
+ export declare const HeaderButtonHover: () => import("@emotion/utils").SerializedStyles;
4
+ export declare const HeaderButtonDanger: () => import("@emotion/utils").SerializedStyles;
5
+ export declare const dragInsertButtonWrapper: () => import("@emotion/utils").SerializedStyles;
6
+ export declare const dragCornerControlButton: () => import("@emotion/utils").SerializedStyles;
7
+ export declare const insertColumnButtonWrapper: () => import("@emotion/utils").SerializedStyles;
8
+ export declare const insertRowButtonWrapper: () => import("@emotion/utils").SerializedStyles;
9
+ export declare const columnControlsLineMarker: () => import("@emotion/utils").SerializedStyles;
10
+ export declare const DeleteButton: () => import("@emotion/utils").SerializedStyles;
11
+ export declare const OverflowShadow: (isDragAndDropEnabled: boolean | undefined) => import("@emotion/utils").SerializedStyles;
12
+ export declare const OverflowShadowLessPadding: (tableOverflowShadowWidth: number) => import("@emotion/utils").SerializedStyles;
13
+ export declare const floatingColumnControls: () => import("@emotion/utils").SerializedStyles;
14
+ export declare const rowControlsWrapperDotStyle: () => import("@emotion/utils").SerializedStyles;
15
+ export declare const columnControlsDecoration: () => import("@emotion/utils").SerializedStyles;
16
+ export declare const hoveredDeleteButton: () => import("@emotion/utils").SerializedStyles;
17
+ export declare const hoveredCell: () => import("@emotion/utils").SerializedStyles;
18
+ export declare const hoveredWarningCell: import("@emotion/utils").SerializedStyles;
19
+ export declare const resizeHandle: () => import("@emotion/utils").SerializedStyles;
20
+ export declare const insertLine: () => import("@emotion/utils").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "17.3.4",
3
+ "version": "17.3.6",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/editor-plugin-batch-attribute-updates": "^7.0.0",
38
38
  "@atlaskit/editor-plugin-content-insertion": "^7.0.0",
39
39
  "@atlaskit/editor-plugin-editor-viewmode": "^9.0.0",
40
- "@atlaskit/editor-plugin-extension": "10.0.8",
40
+ "@atlaskit/editor-plugin-extension": "10.0.9",
41
41
  "@atlaskit/editor-plugin-guideline": "^7.0.0",
42
42
  "@atlaskit/editor-plugin-interaction": "^14.0.0",
43
43
  "@atlaskit/editor-plugin-limited-mode": "^4.0.0",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
58
58
  "@atlaskit/primitives": "^18.0.0",
59
59
  "@atlaskit/theme": "^21.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^19.0.0",
60
+ "@atlaskit/tmp-editor-statsig": "^20.1.0",
61
61
  "@atlaskit/toggle": "^15.2.0",
62
62
  "@atlaskit/tokens": "^11.0.0",
63
63
  "@atlaskit/tooltip": "^20.14.0",