@atlaskit/editor-plugin-table 7.3.8 → 7.3.10

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 (49) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/afm-cc/tsconfig.json +9 -0
  3. package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -2
  4. package/dist/cjs/nodeviews/TableComponent.js +1 -1
  5. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +24 -5
  6. package/dist/cjs/pm-plugins/drag-and-drop/utils/monitor.js +1 -1
  7. package/dist/cjs/pm-plugins/keymap.js +7 -0
  8. package/dist/cjs/ui/DragHandle/index.js +3 -3
  9. package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -3
  10. package/dist/cjs/ui/TableFloatingColumnControls/index.js +2 -2
  11. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
  12. package/dist/cjs/ui/TableFloatingControls/RowDropTarget/index.js +3 -3
  13. package/dist/es2019/nodeviews/ExternalDropTargets.js +1 -1
  14. package/dist/es2019/nodeviews/TableComponent.js +1 -1
  15. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +28 -4
  16. package/dist/es2019/pm-plugins/drag-and-drop/utils/monitor.js +1 -1
  17. package/dist/es2019/pm-plugins/keymap.js +7 -0
  18. package/dist/es2019/ui/DragHandle/index.js +2 -2
  19. package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -2
  20. package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -1
  21. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
  22. package/dist/es2019/ui/TableFloatingControls/RowDropTarget/index.js +2 -2
  23. package/dist/esm/nodeviews/ExternalDropTargets.js +1 -1
  24. package/dist/esm/nodeviews/TableComponent.js +1 -1
  25. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +23 -4
  26. package/dist/esm/pm-plugins/drag-and-drop/utils/monitor.js +1 -1
  27. package/dist/esm/pm-plugins/keymap.js +7 -0
  28. package/dist/esm/ui/DragHandle/index.js +2 -2
  29. package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +2 -2
  30. package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -1
  31. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
  32. package/dist/esm/ui/TableFloatingControls/RowDropTarget/index.js +2 -2
  33. package/dist/types/pm-plugins/drag-and-drop/utils/monitor.d.ts +1 -1
  34. package/dist/types/types.d.ts +1 -1
  35. package/dist/types-ts4.5/pm-plugins/drag-and-drop/utils/monitor.d.ts +1 -1
  36. package/dist/types-ts4.5/types.d.ts +1 -1
  37. package/package.json +8 -8
  38. package/src/nodeviews/ExternalDropTargets.tsx +1 -1
  39. package/src/nodeviews/TableComponent.tsx +1 -1
  40. package/src/pm-plugins/drag-and-drop/plugin.ts +43 -8
  41. package/src/pm-plugins/drag-and-drop/utils/monitor.ts +3 -3
  42. package/src/pm-plugins/keymap.ts +7 -0
  43. package/src/types.ts +1 -1
  44. package/src/ui/DragHandle/index.tsx +2 -2
  45. package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +2 -2
  46. package/src/ui/TableFloatingColumnControls/index.tsx +1 -1
  47. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +1 -1
  48. package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +2 -2
  49. package/tsconfig.json +894 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.3.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#75205](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75205) [`add1e7b7f424`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/add1e7b7f424) - Reduce NCS spam when holding the move column/row keyboard shortcut
8
+
9
+ ## 7.3.9
10
+
11
+ ### Patch Changes
12
+
13
+ - [#70616](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70616) [`76068b6be8dc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/76068b6be8dc) - Upgrading to Pragmatic drag and drop 1.0
14
+ - Updated dependencies
15
+
3
16
  ## 7.3.8
4
17
 
5
18
  ### Patch Changes
@@ -57,6 +57,15 @@
57
57
  {
58
58
  "path": "../../../platform/feature-flags/afm-cc/tsconfig.json"
59
59
  },
60
+ {
61
+ "path": "../../../pragmatic-drag-and-drop/core/afm-cc/tsconfig.json"
62
+ },
63
+ {
64
+ "path": "../../../pragmatic-drag-and-drop/auto-scroll/afm-cc/tsconfig.json"
65
+ },
66
+ {
67
+ "path": "../../../pragmatic-drag-and-drop/hitbox/afm-cc/tsconfig.json"
68
+ },
60
69
  {
61
70
  "path": "../../../design-system/primitives/afm-cc/tsconfig.json"
62
71
  },
@@ -9,7 +9,7 @@ exports.ExternalDropTargets = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var _styles = require("@atlaskit/editor-common/styles");
12
- var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
12
+ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
13
13
  var _consts = require("../ui/consts");
14
14
  var _ColumnDropTarget = require("../ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget");
15
15
  var _utils = require("../utils");
@@ -26,7 +26,7 @@ var ExternalDropTargets = exports.ExternalDropTargets = function ExternalDropTar
26
26
  setIsDragging = _useState2[1];
27
27
  var currentNodeLocalId = node === null || node === void 0 ? void 0 : node.attrs.localId;
28
28
  (0, _react.useEffect)(function () {
29
- return (0, _element.monitorForElements)({
29
+ return (0, _adapter.monitorForElements)({
30
30
  canMonitor: function canMonitor(_ref2) {
31
31
  var source = _ref2.source;
32
32
  var _ref3 = source.data,
@@ -24,7 +24,7 @@ var _utils = require("@atlaskit/editor-common/utils");
24
24
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
25
25
  var _utils2 = require("@atlaskit/editor-tables/utils");
26
26
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
27
- var _combine = require("@atlaskit/pragmatic-drag-and-drop/util/combine");
27
+ var _combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
28
28
  var _commands = require("../commands");
29
29
  var _utils3 = require("../pm-plugins/drag-and-drop/utils");
30
30
  var _pluginFactory = require("../pm-plugins/plugin-factory");
@@ -10,8 +10,8 @@ var _view = require("@atlaskit/editor-prosemirror/view");
10
10
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
11
11
  var _utils = require("@atlaskit/editor-tables/utils");
12
12
  var _element = require("@atlaskit/pragmatic-drag-and-drop-auto-scroll/element");
13
- var _element2 = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
14
- var _combine = require("@atlaskit/pragmatic-drag-and-drop/util/combine");
13
+ var _combine = require("@atlaskit/pragmatic-drag-and-drop/combine");
14
+ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
15
15
  var _utils2 = require("../../utils");
16
16
  var _pluginFactory = require("../plugin-factory");
17
17
  var _pluginKey = require("../plugin-key");
@@ -25,7 +25,7 @@ var _pluginKey2 = require("./plugin-key");
25
25
  var _monitor = require("./utils/monitor");
26
26
  var destroyFn = function destroyFn(editorView, editorAnalyticsAPI) {
27
27
  var editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
28
- var rowAutoScrollers = editorPageScrollContainer ? [(0, _element2.monitorForElements)({
28
+ var rowAutoScrollers = editorPageScrollContainer ? [(0, _adapter.monitorForElements)({
29
29
  canMonitor: function canMonitor(_ref) {
30
30
  var source = _ref.source;
31
31
  var _ref2 = source.data,
@@ -49,7 +49,7 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI) {
49
49
  return type === 'table-row';
50
50
  }
51
51
  })] : [];
52
- return _combine.combine.apply(void 0, rowAutoScrollers.concat([(0, _element2.monitorForElements)({
52
+ return _combine.combine.apply(void 0, rowAutoScrollers.concat([(0, _adapter.monitorForElements)({
53
53
  canMonitor: function canMonitor(_ref5) {
54
54
  var source = _ref5.source;
55
55
  var _ref6 = source.data,
@@ -240,9 +240,28 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
240
240
  },
241
241
  handleKeyDown: function handleKeyDown(view, event) {
242
242
  var _ref8;
243
+ var tr = view.state.tr;
244
+ var keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
245
+
246
+ /** fix for NCS spam update where the user is holding down the move column / row keyboard shortcut
247
+ * if the user is holding down shortcut (ctrl + shift + alt + arrowKey), we want to move the selection only once
248
+ * See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
249
+ */
250
+
251
+ // Do early check for the keys we want to trap here so we can abort early
252
+ if (event.ctrlKey && event.shiftKey && event.altKey) {
253
+ var _getSelectedCellInfo = (0, _utils.getSelectedCellInfo)(tr.selection),
254
+ verticalCells = _getSelectedCellInfo.verticalCells,
255
+ horizontalCells = _getSelectedCellInfo.horizontalCells,
256
+ totalRowCount = _getSelectedCellInfo.totalRowCount,
257
+ totalColumnCount = _getSelectedCellInfo.totalColumnCount;
258
+ var isRowOrColumnSelected = horizontalCells === totalColumnCount || verticalCells === totalRowCount;
259
+ if (isRowOrColumnSelected && keysToTrapWhen.includes(event.key) && event.repeat) {
260
+ return true;
261
+ }
262
+ }
243
263
  var isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'].includes((_ref8 = event.target || null) === null || _ref8 === void 0 ? void 0 : _ref8.id);
244
264
  var keysToTrap = ['Enter', ' '];
245
- var keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
246
265
  var _getPluginState3 = (0, _pluginFactory2.getPluginState)(view.state),
247
266
  isDragMenuOpen = _getPluginState3.isDragMenuOpen;
248
267
 
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getDraggableDataFromEvent = void 0;
7
- var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge");
7
+ var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
8
8
  var getDraggableDataFromEvent = exports.getDraggableDataFromEvent = function getDraggableDataFromEvent(_ref) {
9
9
  var _extractClosestEdge;
10
10
  var location = _ref.location,
@@ -42,6 +42,13 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
42
42
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.addColumnAfter.common, (0, _insert.addColumnAfter)(getEditorContainerWidth), list);
43
43
  if (dragAndDropEnabled) {
44
44
  // Move row/column shortcuts
45
+ /**
46
+ * NOTE: If the keyboard shortcut for moving rows or columns is changed, we need to update the handleKeyDown function
47
+ * in packages/editor/editor-plugin-table/src/pm-plugins/drag-and-drop/plugin.ts
48
+ * to make sure the logic for holding the shortcut keys is valid
49
+ * See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
50
+ */
51
+
45
52
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRowDown.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI)('table-row', 1), list);
46
53
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRowUp.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI)('table-row', -1), list);
47
54
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveColumnLeft.common, (0, _commandsWithAnalytics2.moveSourceWithAnalyticsViaShortcut)(editorAnalyticsAPI)('table-column', -1), list);
@@ -14,8 +14,8 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
14
14
  var _reactIntlNext = require("react-intl-next");
15
15
  var _messages = require("@atlaskit/editor-common/messages");
16
16
  var _utils = require("@atlaskit/editor-common/utils");
17
- var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
18
- var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview");
17
+ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
18
+ var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
19
19
  var _pluginFactory = require("../../pm-plugins/drag-and-drop/plugin-factory");
20
20
  var _pluginFactory2 = require("../../pm-plugins/plugin-factory");
21
21
  var _types = require("../../types");
@@ -70,7 +70,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
70
70
  (0, _react.useEffect)(function () {
71
71
  var dragHandleDivRefCurrent = dragHandleDivRef.current;
72
72
  if (dragHandleDivRefCurrent) {
73
- return (0, _element.draggable)({
73
+ return (0, _adapter.draggable)({
74
74
  element: dragHandleDivRefCurrent,
75
75
  canDrag: function canDrag() {
76
76
  return !hasMergedCells;
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.ColumnDropTarget = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge");
10
- var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
9
+ var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
10
+ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
11
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
13
  var ColumnDropTarget = exports.ColumnDropTarget = function ColumnDropTarget(_ref) {
@@ -21,7 +21,7 @@ var ColumnDropTarget = exports.ColumnDropTarget = function ColumnDropTarget(_ref
21
21
  if (!dropTargetRef.current) {
22
22
  return;
23
23
  }
24
- return (0, _element.dropTargetForElements)({
24
+ return (0, _adapter.dropTargetForElements)({
25
25
  element: dropTargetRef.current,
26
26
  canDrop: function canDrop(_ref2) {
27
27
  var _data$indexes, _data$indexes2;
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = exports.TableFloatingColumnControls = void 0;
9
9
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
10
  var _react = _interopRequireWildcard(require("react"));
11
- var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
11
+ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
12
12
  var _types = require("../../types");
13
13
  var _utils = require("../../utils");
14
14
  var _ColumnControls = require("./ColumnControls");
@@ -81,7 +81,7 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
81
81
  }
82
82
  }, [tableRef]);
83
83
  (0, _react.useEffect)(function () {
84
- return (0, _element.monitorForElements)({
84
+ return (0, _adapter.monitorForElements)({
85
85
  canMonitor: function canMonitor(_ref2) {
86
86
  var source = _ref2.source;
87
87
  var _ref3 = source.data,
@@ -11,7 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
11
11
  var _reactIntlNext = require("react-intl-next");
12
12
  var _editorTables = require("@atlaskit/editor-tables");
13
13
  var _utils = require("@atlaskit/editor-tables/utils");
14
- var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
14
+ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
15
15
  var _commands = require("../../../commands");
16
16
  var _commands2 = require("../../../pm-plugins/drag-and-drop/commands");
17
17
  var _pluginFactory = require("../../../pm-plugins/plugin-factory");
@@ -61,7 +61,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
61
61
  var selectedRowIndexes = getSelectedRows(editorView.state.selection);
62
62
  var currentNodeLocalId = (_tableNode$attrs$loca = tableNode === null || tableNode === void 0 || (_tableNode$attrs = tableNode.attrs) === null || _tableNode$attrs === void 0 ? void 0 : _tableNode$attrs.localId) !== null && _tableNode$attrs$loca !== void 0 ? _tableNode$attrs$loca : '';
63
63
  (0, _react.useEffect)(function () {
64
- return (0, _element.monitorForElements)({
64
+ return (0, _adapter.monitorForElements)({
65
65
  canMonitor: function canMonitor(_ref2) {
66
66
  var source = _ref2.source;
67
67
  var _ref3 = source.data,
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge");
10
- var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
9
+ var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge");
10
+ var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
11
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
13
  var RowDropTarget = function RowDropTarget(_ref) {
@@ -19,7 +19,7 @@ var RowDropTarget = function RowDropTarget(_ref) {
19
19
  if (!dropTargetRef.current) {
20
20
  return;
21
21
  }
22
- return (0, _element.dropTargetForElements)({
22
+ return (0, _adapter.dropTargetForElements)({
23
23
  element: dropTargetRef.current,
24
24
  canDrop: function canDrop(_ref2) {
25
25
  var _data$indexes, _data$indexes2;
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react';
2
2
  import { tableMarginTop } from '@atlaskit/editor-common/styles';
3
- import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
3
+ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
4
4
  import { dropTargetExtendedWidth, dropTargetsZIndex } from '../ui/consts';
5
5
  import { ColumnDropTarget } from '../ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget';
6
6
  import { getColumnsWidths } from '../utils';
@@ -10,7 +10,7 @@ import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
10
10
  import { MAX_BROWSER_SCROLLBAR_HEIGHT, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
11
11
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
12
12
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
13
- import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
13
+ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
14
14
  import { autoSizeTable, clearHoverSelection } from '../commands';
15
15
  import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
16
16
  import { getPluginState } from '../pm-plugins/plugin-factory';
@@ -2,10 +2,10 @@ import { INPUT_METHOD, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
- import { getCellsInRow } from '@atlaskit/editor-tables/utils';
5
+ import { getCellsInRow, getSelectedCellInfo } from '@atlaskit/editor-tables/utils';
6
6
  import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
7
- import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
8
- import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
7
+ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
8
+ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
9
9
  import { findNearestCellIndexToPoint, hasMergedCellsInBetween } from '../../utils';
10
10
  import { getPluginState as getTablePluginState } from '../plugin-factory';
11
11
  import { pluginKey as tablePluginKey } from '../plugin-key';
@@ -250,9 +250,33 @@ export const createPlugin = (dispatch, eventDispatcher, editorAnalyticsAPI) => {
250
250
  },
251
251
  handleKeyDown: (view, event) => {
252
252
  var _ref;
253
+ const {
254
+ state: {
255
+ tr
256
+ }
257
+ } = view;
258
+ const keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
259
+
260
+ /** fix for NCS spam update where the user is holding down the move column / row keyboard shortcut
261
+ * if the user is holding down shortcut (ctrl + shift + alt + arrowKey), we want to move the selection only once
262
+ * See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
263
+ */
264
+
265
+ // Do early check for the keys we want to trap here so we can abort early
266
+ if (event.ctrlKey && event.shiftKey && event.altKey) {
267
+ const {
268
+ verticalCells,
269
+ horizontalCells,
270
+ totalRowCount,
271
+ totalColumnCount
272
+ } = getSelectedCellInfo(tr.selection);
273
+ const isRowOrColumnSelected = horizontalCells === totalColumnCount || verticalCells === totalRowCount;
274
+ if (isRowOrColumnSelected && keysToTrapWhen.includes(event.key) && event.repeat) {
275
+ return true;
276
+ }
277
+ }
253
278
  const isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'].includes((_ref = event.target || null) === null || _ref === void 0 ? void 0 : _ref.id);
254
279
  const keysToTrap = ['Enter', ' '];
255
- const keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
256
280
  const {
257
281
  isDragMenuOpen
258
282
  } = getPluginState(view.state);
@@ -1,4 +1,4 @@
1
- import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
1
+ import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
2
2
  export const getDraggableDataFromEvent = ({
3
3
  location,
4
4
  source
@@ -33,6 +33,13 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
33
33
  bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
34
34
  if (dragAndDropEnabled) {
35
35
  // Move row/column shortcuts
36
+ /**
37
+ * NOTE: If the keyboard shortcut for moving rows or columns is changed, we need to update the handleKeyDown function
38
+ * in packages/editor/editor-plugin-table/src/pm-plugins/drag-and-drop/plugin.ts
39
+ * to make sure the logic for holding the shortcut keys is valid
40
+ * See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
41
+ */
42
+
36
43
  bindKeymapWithCommand(moveRowDown.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', 1), list);
37
44
  bindKeymapWithCommand(moveRowUp.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', -1), list);
38
45
  bindKeymapWithCommand(moveColumnLeft.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', -1), list);
@@ -4,8 +4,8 @@ import ReactDOM from 'react-dom';
4
4
  import { injectIntl } from 'react-intl-next';
5
5
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { browser } from '@atlaskit/editor-common/utils';
7
- import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
8
- import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
7
+ import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
8
+ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
9
9
  import { getPluginState as getDnDPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
10
10
  import { getPluginState } from '../../pm-plugins/plugin-factory';
11
11
  import { TableCssClassName as ClassName } from '../../types';
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
3
- import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
2
+ import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
3
+ import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
4
4
  export const ColumnDropTarget = ({
5
5
  index,
6
6
  localId,
@@ -1,5 +1,5 @@
1
1
  import React, { useEffect, useMemo, useRef, useState } from 'react';
2
- import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
2
+ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
3
3
  import { TableCssClassName as ClassName } from '../../types';
4
4
  import { containsHeaderColumn, getColumnsWidths, getRowHeights } from '../../utils';
5
5
  import { ColumnControls } from './ColumnControls';
@@ -4,7 +4,7 @@ import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'reac
4
4
  import { injectIntl } from 'react-intl-next';
5
5
  import { CellSelection } from '@atlaskit/editor-tables';
6
6
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
- import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
7
+ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
8
8
  import { clearHoverSelection } from '../../../commands';
9
9
  import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
10
10
  import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
3
- import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
2
+ import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
3
+ import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
4
4
  const RowDropTarget = ({
5
5
  index,
6
6
  localId,
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { useEffect, useState } from 'react';
3
3
  import { tableMarginTop } from '@atlaskit/editor-common/styles';
4
- import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
4
+ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
5
5
  import { dropTargetExtendedWidth, dropTargetsZIndex } from '../ui/consts';
6
6
  import { ColumnDropTarget } from '../ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget';
7
7
  import { getColumnsWidths } from '../utils';
@@ -21,7 +21,7 @@ import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
21
21
  import { MAX_BROWSER_SCROLLBAR_HEIGHT, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
22
22
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
23
23
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
24
- import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
24
+ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
25
25
  import { autoSizeTable, clearHoverSelection } from '../commands';
26
26
  import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
27
27
  import { getPluginState } from '../pm-plugins/plugin-factory';
@@ -2,10 +2,10 @@ import { INPUT_METHOD, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
- import { getCellsInRow } from '@atlaskit/editor-tables/utils';
5
+ import { getCellsInRow, getSelectedCellInfo } from '@atlaskit/editor-tables/utils';
6
6
  import { autoScrollForElements } from '@atlaskit/pragmatic-drag-and-drop-auto-scroll/element';
7
- import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
8
- import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
7
+ import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
8
+ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
9
9
  import { findNearestCellIndexToPoint, hasMergedCellsInBetween } from '../../utils';
10
10
  import { getPluginState as getTablePluginState } from '../plugin-factory';
11
11
  import { pluginKey as tablePluginKey } from '../plugin-key';
@@ -234,9 +234,28 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher, edito
234
234
  },
235
235
  handleKeyDown: function handleKeyDown(view, event) {
236
236
  var _ref8;
237
+ var tr = view.state.tr;
238
+ var keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
239
+
240
+ /** fix for NCS spam update where the user is holding down the move column / row keyboard shortcut
241
+ * if the user is holding down shortcut (ctrl + shift + alt + arrowKey), we want to move the selection only once
242
+ * See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
243
+ */
244
+
245
+ // Do early check for the keys we want to trap here so we can abort early
246
+ if (event.ctrlKey && event.shiftKey && event.altKey) {
247
+ var _getSelectedCellInfo = getSelectedCellInfo(tr.selection),
248
+ verticalCells = _getSelectedCellInfo.verticalCells,
249
+ horizontalCells = _getSelectedCellInfo.horizontalCells,
250
+ totalRowCount = _getSelectedCellInfo.totalRowCount,
251
+ totalColumnCount = _getSelectedCellInfo.totalColumnCount;
252
+ var isRowOrColumnSelected = horizontalCells === totalColumnCount || verticalCells === totalRowCount;
253
+ if (isRowOrColumnSelected && keysToTrapWhen.includes(event.key) && event.repeat) {
254
+ return true;
255
+ }
256
+ }
237
257
  var isDragHandleFocused = ['drag-handle-button-row', 'drag-handle-button-column'].includes((_ref8 = event.target || null) === null || _ref8 === void 0 ? void 0 : _ref8.id);
238
258
  var keysToTrap = ['Enter', ' '];
239
- var keysToTrapWhen = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
240
259
  var _getPluginState3 = getPluginState(view.state),
241
260
  isDragMenuOpen = _getPluginState3.isDragMenuOpen;
242
261
 
@@ -1,4 +1,4 @@
1
- import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
1
+ import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
2
2
  export var getDraggableDataFromEvent = function getDraggableDataFromEvent(_ref) {
3
3
  var _extractClosestEdge;
4
4
  var location = _ref.location,
@@ -35,6 +35,13 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
35
35
  bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
36
36
  if (dragAndDropEnabled) {
37
37
  // Move row/column shortcuts
38
+ /**
39
+ * NOTE: If the keyboard shortcut for moving rows or columns is changed, we need to update the handleKeyDown function
40
+ * in packages/editor/editor-plugin-table/src/pm-plugins/drag-and-drop/plugin.ts
41
+ * to make sure the logic for holding the shortcut keys is valid
42
+ * See ticket ED-22154 https://product-fabric.atlassian.net/browse/ED-22154
43
+ */
44
+
38
45
  bindKeymapWithCommand(moveRowDown.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', 1), list);
39
46
  bindKeymapWithCommand(moveRowUp.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-row', -1), list);
40
47
  bindKeymapWithCommand(moveColumnLeft.common, moveSourceWithAnalyticsViaShortcut(editorAnalyticsAPI)('table-column', -1), list);
@@ -6,8 +6,8 @@ import ReactDOM from 'react-dom';
6
6
  import { injectIntl } from 'react-intl-next';
7
7
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
8
8
  import { browser } from '@atlaskit/editor-common/utils';
9
- import { draggable } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
10
- import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/util/set-custom-native-drag-preview';
9
+ import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
10
+ import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
11
11
  import { getPluginState as getDnDPluginState } from '../../pm-plugins/drag-and-drop/plugin-factory';
12
12
  import { getPluginState } from '../../pm-plugins/plugin-factory';
13
13
  import { TableCssClassName as ClassName } from '../../types';
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
3
- import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
2
+ import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
3
+ import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
4
4
  export var ColumnDropTarget = function ColumnDropTarget(_ref) {
5
5
  var index = _ref.index,
6
6
  localId = _ref.localId,
@@ -3,7 +3,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
3
3
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4
4
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
5
  import React, { useEffect, useMemo, useRef, useState } from 'react';
6
- import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
6
+ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
7
7
  import { TableCssClassName as ClassName } from '../../types';
8
8
  import { containsHeaderColumn, getColumnsWidths, getRowHeights } from '../../utils';
9
9
  import { ColumnControls } from './ColumnControls';
@@ -5,7 +5,7 @@ import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'reac
5
5
  import { injectIntl } from 'react-intl-next';
6
6
  import { CellSelection } from '@atlaskit/editor-tables';
7
7
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
8
- import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
8
+ import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
9
9
  import { clearHoverSelection } from '../../../commands';
10
10
  import { toggleDragMenu } from '../../../pm-plugins/drag-and-drop/commands';
11
11
  import { getPluginState as getTablePluginState } from '../../../pm-plugins/plugin-factory';
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
3
- import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
2
+ import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
3
+ import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
4
4
  var RowDropTarget = function RowDropTarget(_ref) {
5
5
  var index = _ref.index,
6
6
  localId = _ref.localId,
@@ -1,3 +1,3 @@
1
- import type { ElementEventBasePayload } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
1
+ import type { ElementEventBasePayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
2
2
  import type { DraggableData } from '../../../types';
3
3
  export declare const getDraggableDataFromEvent: ({ location, source, }: ElementEventBasePayload) => DraggableData | undefined;
@@ -7,7 +7,7 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
7
7
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
8
8
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { Rect } from '@atlaskit/editor-tables/table-map';
10
- import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
10
+ import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
11
11
  import type tablePlugin from './plugin';
12
12
  export declare const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
13
13
  export type RowInsertPosition = 'TOP' | 'BOTTOM';
@@ -1,3 +1,3 @@
1
- import type { ElementEventBasePayload } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
1
+ import type { ElementEventBasePayload } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
2
2
  import type { DraggableData } from '../../../types';
3
3
  export declare const getDraggableDataFromEvent: ({ location, source, }: ElementEventBasePayload) => DraggableData | undefined;
@@ -7,7 +7,7 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
7
7
  import type { Transaction } from '@atlaskit/editor-prosemirror/state';
8
8
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { Rect } from '@atlaskit/editor-tables/table-map';
10
- import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
10
+ import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
11
11
  import type tablePlugin from './plugin';
12
12
  export declare const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
13
13
  export type RowInsertPosition = 'TOP' | 'BOTTOM';