@atlaskit/editor-plugin-table 7.1.4 → 7.2.0

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 (84) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +0 -3
  3. package/dist/cjs/nodeviews/table.js +1 -4
  4. package/dist/cjs/plugin.js +0 -1
  5. package/dist/cjs/pm-plugins/drag-and-drop/actions.js +1 -2
  6. package/dist/cjs/pm-plugins/drag-and-drop/consts.js +2 -3
  7. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +14 -39
  8. package/dist/cjs/pm-plugins/drag-and-drop/reducer.js +0 -2
  9. package/dist/cjs/ui/DragHandle/index.js +3 -5
  10. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +1 -2
  11. package/dist/cjs/ui/FloatingDragMenu/index.js +0 -2
  12. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -3
  13. package/dist/cjs/ui/TableFloatingColumnControls/index.js +0 -2
  14. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +1 -3
  15. package/dist/cjs/ui/TableFloatingControls/index.js +4 -7
  16. package/dist/es2019/nodeviews/TableComponent.js +0 -3
  17. package/dist/es2019/nodeviews/table.js +1 -5
  18. package/dist/es2019/plugin.js +0 -1
  19. package/dist/es2019/pm-plugins/drag-and-drop/actions.js +1 -2
  20. package/dist/es2019/pm-plugins/drag-and-drop/consts.js +1 -2
  21. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +15 -39
  22. package/dist/es2019/pm-plugins/drag-and-drop/reducer.js +0 -5
  23. package/dist/es2019/ui/DragHandle/index.js +3 -4
  24. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +1 -2
  25. package/dist/es2019/ui/FloatingDragMenu/index.js +0 -2
  26. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -3
  27. package/dist/es2019/ui/TableFloatingColumnControls/index.js +0 -2
  28. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +1 -3
  29. package/dist/es2019/ui/TableFloatingControls/index.js +4 -7
  30. package/dist/esm/nodeviews/TableComponent.js +0 -3
  31. package/dist/esm/nodeviews/table.js +1 -4
  32. package/dist/esm/plugin.js +0 -1
  33. package/dist/esm/pm-plugins/drag-and-drop/actions.js +1 -2
  34. package/dist/esm/pm-plugins/drag-and-drop/consts.js +1 -2
  35. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +15 -39
  36. package/dist/esm/pm-plugins/drag-and-drop/reducer.js +0 -2
  37. package/dist/esm/ui/DragHandle/index.js +3 -5
  38. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +1 -2
  39. package/dist/esm/ui/FloatingDragMenu/index.js +0 -2
  40. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -3
  41. package/dist/esm/ui/TableFloatingColumnControls/index.js +0 -2
  42. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +1 -3
  43. package/dist/esm/ui/TableFloatingControls/index.js +4 -7
  44. package/dist/types/nodeviews/TableComponent.d.ts +0 -1
  45. package/dist/types/pm-plugins/drag-and-drop/actions.d.ts +1 -4
  46. package/dist/types/pm-plugins/drag-and-drop/consts.d.ts +0 -1
  47. package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
  48. package/dist/types/pm-plugins/drag-and-drop/types.d.ts +0 -1
  49. package/dist/types/ui/DragHandle/index.d.ts +0 -1
  50. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  51. package/dist/types/ui/FloatingDragMenu/index.d.ts +1 -2
  52. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -2
  53. package/dist/types/ui/TableFloatingColumnControls/index.d.ts +0 -1
  54. package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +0 -1
  55. package/dist/types/ui/TableFloatingControls/index.d.ts +0 -1
  56. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +0 -1
  57. package/dist/types-ts4.5/pm-plugins/drag-and-drop/actions.d.ts +1 -4
  58. package/dist/types-ts4.5/pm-plugins/drag-and-drop/consts.d.ts +0 -1
  59. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
  60. package/dist/types-ts4.5/pm-plugins/drag-and-drop/types.d.ts +0 -1
  61. package/dist/types-ts4.5/ui/DragHandle/index.d.ts +0 -1
  62. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  63. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +1 -2
  64. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -2
  65. package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +0 -1
  66. package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +0 -1
  67. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +0 -1
  68. package/package.json +4 -4
  69. package/src/nodeviews/TableComponent.tsx +0 -4
  70. package/src/nodeviews/table.tsx +0 -3
  71. package/src/plugin.tsx +0 -1
  72. package/src/pm-plugins/drag-and-drop/actions.ts +1 -9
  73. package/src/pm-plugins/drag-and-drop/consts.ts +0 -2
  74. package/src/pm-plugins/drag-and-drop/plugin.ts +17 -49
  75. package/src/pm-plugins/drag-and-drop/reducer.ts +0 -5
  76. package/src/pm-plugins/drag-and-drop/types.ts +0 -1
  77. package/src/ui/DragHandle/index.tsx +2 -5
  78. package/src/ui/FloatingDragMenu/DragMenu.tsx +1 -3
  79. package/src/ui/FloatingDragMenu/index.tsx +0 -3
  80. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +0 -3
  81. package/src/ui/TableFloatingColumnControls/index.tsx +0 -3
  82. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +0 -3
  83. package/src/ui/TableFloatingControls/index.tsx +1 -6
  84. package/src/__tests__/unit/pm-plugins/drag-and-drop/plugin.ts +0 -112
@@ -16,7 +16,6 @@ export const TableFloatingColumnControls = ({
16
16
  selection,
17
17
  isInDanger,
18
18
  isTableHovered,
19
- canDrag,
20
19
  tableContainerWidth,
21
20
  isNumberColumnEnabled
22
21
  }) => {
@@ -106,7 +105,6 @@ export const TableFloatingColumnControls = ({
106
105
  rowHeights: rowHeights,
107
106
  colWidths: colWidths,
108
107
  hasHeaderColumn: hasHeaderColumn,
109
- canDrag: canDrag,
110
108
  tableContainerWidth: tableContainerWidth,
111
109
  isNumberColumnEnabled: isNumberColumnEnabled,
112
110
  isDragging: isDragging
@@ -33,7 +33,6 @@ const DragControlsComponent = ({
33
33
  isInDanger,
34
34
  isResizing,
35
35
  isTableHovered,
36
- canDrag,
37
36
  hoverRows,
38
37
  selectRow,
39
38
  selectRows,
@@ -160,8 +159,7 @@ const DragControlsComponent = ({
160
159
  onMouseOver: handleMouseOver,
161
160
  onMouseOut: handleMouseOut,
162
161
  onMouseUp: onMouseUp,
163
- editorView: editorView,
164
- canDrag: canDrag
162
+ editorView: editorView
165
163
  }));
166
164
  };
167
165
  const rowHandles = hoveredCell => {
@@ -113,10 +113,9 @@ export default class TableFloatingControls extends Component {
113
113
  headerRowHeight,
114
114
  stickyHeader,
115
115
  hoveredCell,
116
- isTableHovered,
117
- canDrag
116
+ isTableHovered
118
117
  } = this.props;
119
- return this.state.tableWrapperWidth !== nextState.tableWrapperWidth || this.state.tableWrapperHeight !== nextState.tableWrapperHeight || ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || isSelectionUpdated(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell || isTableHovered !== nextProps.isTableHovered || canDrag !== nextProps.canDrag;
118
+ return this.state.tableWrapperWidth !== nextState.tableWrapperWidth || this.state.tableWrapperHeight !== nextState.tableWrapperHeight || ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || isSelectionUpdated(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell || isTableHovered !== nextProps.isTableHovered;
120
119
  }
121
120
  componentWillUnmount() {
122
121
  if (this.resizeObserver) {
@@ -139,8 +138,7 @@ export default class TableFloatingControls extends Component {
139
138
  stickyHeader,
140
139
  isDragAndDropEnabled,
141
140
  hoveredCell,
142
- isTableHovered,
143
- canDrag
141
+ isTableHovered
144
142
  } = this.props;
145
143
  if (!tableRef) {
146
144
  return null;
@@ -182,8 +180,7 @@ export default class TableFloatingControls extends Component {
182
180
  hoverRows: this.hoverRows,
183
181
  selectRow: this.selectRow,
184
182
  selectRows: this.selectRows,
185
- updateCellHoverLocation: this.updateCellHoverLocation,
186
- canDrag: canDrag
183
+ updateCellHoverLocation: this.updateCellHoverLocation
187
184
  })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
188
185
  editorView: editorView,
189
186
  tableRef: tableRef,
@@ -481,7 +481,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
481
481
  getPos = _this$props10.getPos,
482
482
  pluginInjectionApi = _this$props10.pluginInjectionApi,
483
483
  isDragAndDropEnabled = _this$props10.isDragAndDropEnabled,
484
- canDrag = _this$props10.canDrag,
485
484
  getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
486
485
  var _this$state3 = this.state,
487
486
  showBeforeShadow = _this$state3.showBeforeShadow,
@@ -509,7 +508,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
509
508
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
510
509
  isHeaderRowEnabled: isHeaderRowEnabled,
511
510
  isDragAndDropEnabled: isDragAndDropEnabled,
512
- canDrag: canDrag,
513
511
  ordering: ordering,
514
512
  isHeaderColumnEnabled: isHeaderColumnEnabled,
515
513
  hasHeaderRow: hasHeaderRow
@@ -537,7 +535,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
537
535
  selection: view.state.selection,
538
536
  headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
539
537
  stickyHeader: this.state.stickyHeader,
540
- canDrag: canDrag,
541
538
  getEditorFeatureFlags: getEditorFeatureFlags,
542
539
  tableContainerWidth: tableContainerWidth,
543
540
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled
@@ -141,12 +141,10 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
141
141
  },
142
142
  editorView: props.view,
143
143
  render: function render(pluginStates) {
144
- var _tableDragAndDropStat;
145
144
  var tableResizingPluginState = pluginStates.tableResizingPluginState,
146
145
  tableWidthPluginState = pluginStates.tableWidthPluginState,
147
146
  pluginState = pluginStates.pluginState,
148
- mediaState = pluginStates.mediaState,
149
- tableDragAndDropState = pluginStates.tableDragAndDropState;
147
+ mediaState = pluginStates.mediaState;
150
148
  var containerWidth = props.getEditorContainerWidth();
151
149
  var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
152
150
  var isResizing = Boolean((tableResizingPluginState === null || tableResizingPluginState === void 0 ? void 0 : tableResizingPluginState.dragging) || isTableResizing);
@@ -174,7 +172,6 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
174
172
  isHeaderRowEnabled: pluginState.isHeaderRowEnabled,
175
173
  isHeaderColumnEnabled: pluginState.isHeaderColumnEnabled,
176
174
  isDragAndDropEnabled: pluginState.isDragAndDropEnabled,
177
- canDrag: (_tableDragAndDropStat = tableDragAndDropState === null || tableDragAndDropState === void 0 ? void 0 : tableDragAndDropState.canDrag) !== null && _tableDragAndDropStat !== void 0 ? _tableDragAndDropStat : false,
178
175
  tableActive: tableActive,
179
176
  ordering: pluginState.ordering,
180
177
  isResizing: isResizing,
@@ -352,7 +352,6 @@ var tablesPlugin = function tablesPlugin(_ref) {
352
352
  direction: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
353
353
  index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
354
354
  isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
355
- canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
356
355
  getEditorContainerWidth: defaultGetEditorContainerWidth,
357
356
  editorAnalyticsAPI: editorAnalyticsAPI,
358
357
  stickyHeaders: stickyHeader,
@@ -1,8 +1,7 @@
1
1
  export var DragAndDropActionType = {
2
2
  SET_DROP_TARGET: 'SET_DROP_TARGET',
3
3
  CLEAR_DROP_TARGET: 'CLEAR_DROP_TARGET',
4
- TOGGLE_DRAG_MENU: 'TOGGLE_DRAG_MENU',
5
- UPDATE: 'UPDATE'
4
+ TOGGLE_DRAG_MENU: 'TOGGLE_DRAG_MENU'
6
5
  };
7
6
 
8
7
  // NOTE: This should be a Union of all possible actions
@@ -2,5 +2,4 @@ export var DropTargetType = {
2
2
  NONE: 'none',
3
3
  ROW: 'row',
4
4
  COLUMN: 'column'
5
- };
6
- export var DRAGGABLE_TABLE_NODE_SIZE_LIMIT = 20000;
5
+ };
@@ -1,6 +1,3 @@
1
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
1
  import { INPUT_METHOD, TABLE_STATUS } from '@atlaskit/editor-common/analytics';
5
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
@@ -16,7 +13,7 @@ import { insertColgroupFromNode } from '../table-resizing/utils';
16
13
  import { DragAndDropActionType } from './actions';
17
14
  import { clearDropTarget, setDropTarget, toggleDragMenu } from './commands';
18
15
  import { clearDropTargetWithAnalytics, moveSourceWithAnalytics } from './commands-with-analytics';
19
- import { DRAGGABLE_TABLE_NODE_SIZE_LIMIT, DropTargetType } from './consts';
16
+ import { DropTargetType } from './consts';
20
17
  import { createPluginState, getPluginState } from './plugin-factory';
21
18
  import { pluginKey } from './plugin-key';
22
19
  import { getDraggableDataFromEvent } from './utils/monitor';
@@ -167,24 +164,18 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher, edito
167
164
  dropTargetIndex: 0,
168
165
  isDragMenuOpen: false,
169
166
  dragMenuIndex: 0,
170
- isDragging: false,
171
- canDrag: false
167
+ isDragging: false
172
168
  };
173
169
  }),
174
170
  key: pluginKey,
175
171
  appendTransaction: function appendTransaction(transactions, oldState, newState) {
176
172
  var _getTablePluginState4 = getTablePluginState(oldState),
177
- oldTargetCellPosition = _getTablePluginState4.targetCellPosition,
178
- oldTableNode = _getTablePluginState4.tableNode;
173
+ oldTargetCellPosition = _getTablePluginState4.targetCellPosition;
179
174
  var _getTablePluginState5 = getTablePluginState(newState),
180
- newTargetCellPosition = _getTablePluginState5.targetCellPosition,
181
- newTableNode = _getTablePluginState5.tableNode;
175
+ newTargetCellPosition = _getTablePluginState5.targetCellPosition;
182
176
  var _getPluginState = getPluginState(newState),
183
177
  isDragMenuOpen = _getPluginState.isDragMenuOpen,
184
- dragMenuIndex = _getPluginState.dragMenuIndex,
185
- canDrag = _getPluginState.canDrag;
186
- var stateChanges = [];
187
- var tr = newState.tr;
178
+ dragMenuIndex = _getPluginState.dragMenuIndex;
188
179
 
189
180
  // What's happening here? you asked... In a nutshell;
190
181
  // If the target cell position changes while the drag menu is open then we want to close the drag menu if it has been opened.
@@ -192,6 +183,14 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher, edito
192
183
  // to check if the new target cell position is pointed at a different cell than what the drag menu was opened on.
193
184
  if (oldTargetCellPosition !== newTargetCellPosition) {
194
185
  if (isDragMenuOpen) {
186
+ var tr = newState.tr;
187
+ var action = {
188
+ type: DragAndDropActionType.TOGGLE_DRAG_MENU,
189
+ data: {
190
+ isDragMenuOpen: false,
191
+ direction: undefined
192
+ }
193
+ };
195
194
  if (newTargetCellPosition !== undefined) {
196
195
  var cells = getCellsInRow(dragMenuIndex)(tr.selection);
197
196
  // ED-20673 check if it is a cell selection,
@@ -199,36 +198,13 @@ export var createPlugin = function createPlugin(dispatch, eventDispatcher, edito
199
198
  // should not close the drag menu.
200
199
  var isCellSelection = tr.selection instanceof CellSelection;
201
200
  if (cells && cells.length && cells[0].node !== tr.doc.nodeAt(newTargetCellPosition) && !isCellSelection) {
202
- stateChanges.push({
203
- isDragMenuOpen: false,
204
- dragMenuDirection: undefined
205
- });
201
+ return tr.setMeta(pluginKey, action);
206
202
  } // else NOP
207
203
  } else {
208
- stateChanges.push({
209
- isDragMenuOpen: false,
210
- dragMenuDirection: undefined
211
- });
204
+ return tr.setMeta(pluginKey, action);
212
205
  }
213
206
  }
214
207
  }
215
- if ((oldTableNode === null || oldTableNode === void 0 ? void 0 : oldTableNode.nodeSize) !== (newTableNode === null || newTableNode === void 0 ? void 0 : newTableNode.nodeSize)) {
216
- var _newTableNode$nodeSiz;
217
- var nextCanDrag = ((_newTableNode$nodeSiz = newTableNode === null || newTableNode === void 0 ? void 0 : newTableNode.nodeSize) !== null && _newTableNode$nodeSiz !== void 0 ? _newTableNode$nodeSiz : 0) < DRAGGABLE_TABLE_NODE_SIZE_LIMIT;
218
- if (canDrag !== nextCanDrag) {
219
- stateChanges.push({
220
- canDrag: nextCanDrag
221
- });
222
- }
223
- }
224
- if (stateChanges.length) {
225
- return tr.setMeta(pluginKey, {
226
- type: DragAndDropActionType.UPDATE,
227
- data: _objectSpread({}, stateChanges.reduce(function (state, cur) {
228
- return _objectSpread(_objectSpread({}, state), cur);
229
- }, {}))
230
- }).setMeta('addToHistory', false);
231
- }
232
208
  },
233
209
  view: function view(editorView) {
234
210
  return {
@@ -25,8 +25,6 @@ export default (function (pluginState, action) {
25
25
  dragMenuDirection: action.data.direction,
26
26
  dragMenuIndex: action.data.index
27
27
  });
28
- case DragAndDropActionType.UPDATE:
29
- return _objectSpread(_objectSpread({}, pluginState), action.data);
30
28
  default:
31
29
  return pluginState;
32
30
  }
@@ -31,8 +31,6 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
31
31
  _onMouseUp = _ref.onMouseUp,
32
32
  onClick = _ref.onClick,
33
33
  editorView = _ref.editorView,
34
- _ref$canDrag = _ref.canDrag,
35
- _canDrag = _ref$canDrag === void 0 ? false : _ref$canDrag,
36
34
  formatMessage = _ref.intl.formatMessage;
37
35
  var dragHandleDivRef = useRef(null);
38
36
  var _useState = useState(null),
@@ -62,7 +60,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
62
60
  return draggable({
63
61
  element: dragHandleDivRefCurrent,
64
62
  canDrag: function canDrag() {
65
- return _canDrag && !hasMergedCells;
63
+ return !hasMergedCells;
66
64
  },
67
65
  getInitialData: function getInitialData() {
68
66
  return {
@@ -110,7 +108,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
110
108
  }
111
109
  });
112
110
  }
113
- }, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells, _canDrag]);
111
+ }, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
114
112
  var showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
115
113
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
116
114
  className: ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE,
@@ -128,7 +126,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
128
126
  onClick: onClick
129
127
  }), /*#__PURE__*/React.createElement("button", {
130
128
  id: isDragMenuTarget ? showDragMenuAnchorId : undefined,
131
- className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, _defineProperty({}, ClassName.DRAG_HANDLE_DISABLED, !_canDrag || hasMergedCells)),
129
+ className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, _defineProperty({}, ClassName.DRAG_HANDLE_DISABLED, hasMergedCells)),
132
130
  ref: dragHandleDivRef,
133
131
  style: {
134
132
  transform: isColumn ? 'none' : 'rotate(90deg)',
@@ -170,7 +170,6 @@ export var DragMenu = function DragMenu(_ref) {
170
170
  scrollableElement = _ref.scrollableElement,
171
171
  targetCellPosition = _ref.targetCellPosition,
172
172
  getEditorContainerWidth = _ref.getEditorContainerWidth,
173
- canDrag = _ref.canDrag,
174
173
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
175
174
  pluginConfig = _ref.pluginConfig,
176
175
  formatMessage = _ref.intl.formatMessage;
@@ -187,7 +186,7 @@ export var DragMenu = function DragMenu(_ref) {
187
186
  var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
188
187
  var hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
189
188
  var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
190
- var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !!canDrag && !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI);
189
+ var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI);
191
190
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
192
191
  menuItems = _convertToDropdownIte.menuItems,
193
192
  menuCallback = _convertToDropdownIte.menuCallback;
@@ -15,7 +15,6 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
15
15
  index = _ref.index,
16
16
  targetCellPosition = _ref.targetCellPosition,
17
17
  getEditorContainerWidth = _ref.getEditorContainerWidth,
18
- canDrag = _ref.canDrag,
19
18
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
20
19
  stickyHeaders = _ref.stickyHeaders,
21
20
  pluginConfig = _ref.pluginConfig;
@@ -55,7 +54,6 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
55
54
  index: index,
56
55
  targetCellPosition: targetCellPosition,
57
56
  getEditorContainerWidth: getEditorContainerWidth,
58
- canDrag: canDrag,
59
57
  editorAnalyticsAPI: editorAnalyticsAPI,
60
58
  pluginConfig: pluginConfig
61
59
  }));
@@ -35,7 +35,6 @@ export var ColumnControls = function ColumnControls(_ref) {
35
35
  colWidths = _ref.colWidths,
36
36
  hasHeaderColumn = _ref.hasHeaderColumn,
37
37
  isTableHovered = _ref.isTableHovered,
38
- canDrag = _ref.canDrag,
39
38
  tableContainerWidth = _ref.tableContainerWidth,
40
39
  isNumberColumnEnabled = _ref.isNumberColumnEnabled,
41
40
  isDragging = _ref.isDragging;
@@ -179,8 +178,7 @@ export var ColumnControls = function ColumnControls(_ref) {
179
178
  onMouseOver: handleMouseOver,
180
179
  onMouseOut: handleMouseOut,
181
180
  onMouseUp: handleMouseUp,
182
- editorView: editorView,
183
- canDrag: canDrag
181
+ editorView: editorView
184
182
  }));
185
183
  };
186
184
  var columnHandles = function columnHandles(hoveredCell) {
@@ -20,7 +20,6 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
20
20
  selection = _ref.selection,
21
21
  isInDanger = _ref.isInDanger,
22
22
  isTableHovered = _ref.isTableHovered,
23
- canDrag = _ref.canDrag,
24
23
  tableContainerWidth = _ref.tableContainerWidth,
25
24
  isNumberColumnEnabled = _ref.isNumberColumnEnabled;
26
25
  var _useState = useState({
@@ -125,7 +124,6 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
125
124
  rowHeights: rowHeights,
126
125
  colWidths: colWidths,
127
126
  hasHeaderColumn: hasHeaderColumn,
128
- canDrag: canDrag,
129
127
  tableContainerWidth: tableContainerWidth,
130
128
  isNumberColumnEnabled: isNumberColumnEnabled,
131
129
  isDragging: isDragging
@@ -35,7 +35,6 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
35
35
  isInDanger = _ref.isInDanger,
36
36
  isResizing = _ref.isResizing,
37
37
  isTableHovered = _ref.isTableHovered,
38
- canDrag = _ref.canDrag,
39
38
  hoverRows = _ref.hoverRows,
40
39
  selectRow = _ref.selectRow,
41
40
  selectRows = _ref.selectRows,
@@ -162,8 +161,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
162
161
  onMouseOver: handleMouseOver,
163
162
  onMouseOut: handleMouseOut,
164
163
  onMouseUp: onMouseUp,
165
- editorView: editorView,
166
- canDrag: canDrag
164
+ editorView: editorView
167
165
  }));
168
166
  };
169
167
  var rowHandles = function rowHandles(hoveredCell) {
@@ -136,9 +136,8 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
136
136
  headerRowHeight = _this$props2.headerRowHeight,
137
137
  stickyHeader = _this$props2.stickyHeader,
138
138
  hoveredCell = _this$props2.hoveredCell,
139
- isTableHovered = _this$props2.isTableHovered,
140
- canDrag = _this$props2.canDrag;
141
- return this.state.tableWrapperWidth !== nextState.tableWrapperWidth || this.state.tableWrapperHeight !== nextState.tableWrapperHeight || ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || isSelectionUpdated(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell || isTableHovered !== nextProps.isTableHovered || canDrag !== nextProps.canDrag;
139
+ isTableHovered = _this$props2.isTableHovered;
140
+ return this.state.tableWrapperWidth !== nextState.tableWrapperWidth || this.state.tableWrapperHeight !== nextState.tableWrapperHeight || ordering !== nextProps.ordering || tableRef !== nextProps.tableRef || tableActive !== nextProps.tableActive || isInDanger !== nextProps.isInDanger || isResizing !== nextProps.isResizing || hoveredRows !== nextProps.hoveredRows || isHeaderRowEnabled !== nextProps.isHeaderRowEnabled || isHeaderColumnEnabled !== nextProps.isHeaderColumnEnabled || isNumberColumnEnabled !== nextProps.isNumberColumnEnabled || isSelectionUpdated(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell || isTableHovered !== nextProps.isTableHovered;
142
141
  }
143
142
  }, {
144
143
  key: "componentWillUnmount",
@@ -165,8 +164,7 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
165
164
  stickyHeader = _this$props3.stickyHeader,
166
165
  isDragAndDropEnabled = _this$props3.isDragAndDropEnabled,
167
166
  hoveredCell = _this$props3.hoveredCell,
168
- isTableHovered = _this$props3.isTableHovered,
169
- canDrag = _this$props3.canDrag;
167
+ isTableHovered = _this$props3.isTableHovered;
170
168
  if (!tableRef) {
171
169
  return null;
172
170
  }
@@ -209,8 +207,7 @@ var TableFloatingControls = /*#__PURE__*/function (_Component) {
209
207
  hoverRows: this.hoverRows,
210
208
  selectRow: this.selectRow,
211
209
  selectRows: this.selectRows,
212
- updateCellHoverLocation: this.updateCellHoverLocation,
213
- canDrag: canDrag
210
+ updateCellHoverLocation: this.updateCellHoverLocation
214
211
  })) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
215
212
  editorView: editorView,
216
213
  tableRef: tableRef,
@@ -23,7 +23,6 @@ export interface ComponentProps {
23
23
  isHeaderColumnEnabled: boolean;
24
24
  isMediaFullscreen?: boolean;
25
25
  isDragAndDropEnabled?: boolean;
26
- canDrag?: boolean;
27
26
  tableActive: boolean;
28
27
  ordering: TableColumnOrdering;
29
28
  isResizing?: boolean;
@@ -1,7 +1,6 @@
1
1
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { TableDirection } from '../../types';
3
3
  import type { DropTargetType } from './consts';
4
- import type { DragAndDropPluginState } from './types';
5
4
  export interface DragAndDropAction<T, D> {
6
5
  type: T;
7
6
  data: D;
@@ -10,7 +9,6 @@ export declare const DragAndDropActionType: {
10
9
  readonly SET_DROP_TARGET: "SET_DROP_TARGET";
11
10
  readonly CLEAR_DROP_TARGET: "CLEAR_DROP_TARGET";
12
11
  readonly TOGGLE_DRAG_MENU: "TOGGLE_DRAG_MENU";
13
- readonly UPDATE: "UPDATE";
14
12
  };
15
13
  export type DragAndDropSetDropTargetAction = DragAndDropAction<typeof DragAndDropActionType.SET_DROP_TARGET, {
16
14
  type: DropTargetType;
@@ -25,5 +23,4 @@ export type DragAndDropToggleDragMenuAction = DragAndDropAction<typeof DragAndDr
25
23
  direction: TableDirection;
26
24
  index: number;
27
25
  }>;
28
- export type DragAndDropUpdateAction = DragAndDropAction<typeof DragAndDropActionType.UPDATE, Partial<DragAndDropPluginState>>;
29
- export type DragAndDropPluginAction = DragAndDropSetDropTargetAction | DragAndDropClearDropTargetAction | DragAndDropToggleDragMenuAction | DragAndDropUpdateAction;
26
+ export type DragAndDropPluginAction = DragAndDropSetDropTargetAction | DragAndDropClearDropTargetAction | DragAndDropToggleDragMenuAction;
@@ -4,4 +4,3 @@ export declare const DropTargetType: {
4
4
  readonly COLUMN: "column";
5
5
  };
6
6
  export type DropTargetType = (typeof DropTargetType)[keyof typeof DropTargetType];
7
- export declare const DRAGGABLE_TABLE_NODE_SIZE_LIMIT = 20000;
@@ -1,5 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import type { DragAndDropPluginState } from './types';
5
- export declare const createPlugin: (dispatch: Dispatch, eventDispatcher: EventDispatcher, editorAnalyticsAPI?: EditorAnalyticsAPI) => SafePlugin<DragAndDropPluginState>;
4
+ export declare const createPlugin: (dispatch: Dispatch, eventDispatcher: EventDispatcher, editorAnalyticsAPI?: EditorAnalyticsAPI) => SafePlugin<import("./types").DragAndDropPluginState>;
@@ -9,5 +9,4 @@ export interface DragAndDropPluginState {
9
9
  dragMenuDirection?: TableDirection;
10
10
  dragMenuIndex: number;
11
11
  isDragging: boolean;
12
- canDrag: boolean;
13
12
  }
@@ -17,7 +17,6 @@ type DragHandleProps = {
17
17
  onMouseOut?: MouseEventHandler;
18
18
  onMouseUp?: MouseEventHandler;
19
19
  editorView: EditorView;
20
- canDrag?: boolean;
21
20
  isDragMenuTarget: boolean;
22
21
  };
23
22
  export declare const DragHandle: React.FC<import("react-intl-next").WithIntlProps<DragHandleProps & WrappedComponentProps<"intl">>> & {
@@ -19,10 +19,9 @@ type DragMenuProps = {
19
19
  scrollableElement?: HTMLElement;
20
20
  pluginConfig?: PluginConfig;
21
21
  getEditorContainerWidth: GetEditorContainerWidth;
22
- canDrag?: boolean;
23
22
  editorAnalyticsAPI?: EditorAnalyticsAPI;
24
23
  };
25
- export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null;
24
+ export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null;
26
25
  declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps<"intl">>> & {
27
26
  WrappedComponent: import("react").ComponentType<DragMenuProps & WrappedComponentProps<"intl">>;
28
27
  };
@@ -17,13 +17,12 @@ export interface Props {
17
17
  index?: number;
18
18
  targetCellPosition?: number;
19
19
  getEditorContainerWidth: GetEditorContainerWidth;
20
- canDrag?: boolean;
21
20
  editorAnalyticsAPI?: EditorAnalyticsAPI;
22
21
  stickyHeaders?: RowStickyState;
23
22
  pluginConfig?: PluginConfig;
24
23
  }
25
24
  declare const FloatingDragMenu: {
26
- ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, stickyHeaders, pluginConfig, }: Props): JSX.Element | null;
25
+ ({ mountPoint, boundariesElement, scrollableElement, editorView, isOpen, tableNode, direction, index, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, stickyHeaders, pluginConfig, }: Props): JSX.Element | null;
27
26
  displayName: string;
28
27
  };
29
28
  export default FloatingDragMenu;
@@ -14,10 +14,9 @@ export interface ColumnControlsProps {
14
14
  colWidths?: (number | undefined)[];
15
15
  hasHeaderColumn?: boolean;
16
16
  isTableHovered?: boolean;
17
- canDrag?: boolean;
18
17
  tableContainerWidth?: number;
19
18
  isNumberColumnEnabled?: boolean;
20
19
  isDragging?: boolean;
21
20
  }
22
- export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, canDrag, tableContainerWidth, isNumberColumnEnabled, isDragging, }: ColumnControlsProps) => JSX.Element;
21
+ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hoveredCell, isResizing, stickyTop, localId, isInDanger, rowHeights, colWidths, hasHeaderColumn, isTableHovered, tableContainerWidth, isNumberColumnEnabled, isDragging, }: ColumnControlsProps) => JSX.Element;
23
22
  export default ColumnControls;
@@ -22,7 +22,6 @@ export interface Props {
22
22
  ordering?: TableColumnOrdering;
23
23
  stickyHeader?: RowStickyState;
24
24
  isTableHovered?: boolean;
25
- canDrag?: boolean;
26
25
  tableContainerWidth?: number;
27
26
  isNumberColumnEnabled?: boolean;
28
27
  }
@@ -13,7 +13,6 @@ type DragControlsProps = {
13
13
  isInDanger?: boolean;
14
14
  isResizing?: boolean;
15
15
  isTableHovered?: boolean;
16
- canDrag?: boolean;
17
16
  hoverRows: (rows: number[], danger?: boolean) => void;
18
17
  selectRow: (row: number, expand: boolean) => void;
19
18
  selectRows: (rowIndexes: number[]) => void;
@@ -18,7 +18,6 @@ export interface Props {
18
18
  isHeaderColumnEnabled?: boolean;
19
19
  isNumberColumnEnabled?: boolean;
20
20
  isDragAndDropEnabled?: boolean;
21
- canDrag?: boolean;
22
21
  hasHeaderRow?: boolean;
23
22
  headerRowHeight?: number;
24
23
  hoveredRows?: number[];
@@ -23,7 +23,6 @@ export interface ComponentProps {
23
23
  isHeaderColumnEnabled: boolean;
24
24
  isMediaFullscreen?: boolean;
25
25
  isDragAndDropEnabled?: boolean;
26
- canDrag?: boolean;
27
26
  tableActive: boolean;
28
27
  ordering: TableColumnOrdering;
29
28
  isResizing?: boolean;
@@ -1,7 +1,6 @@
1
1
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
2
  import type { TableDirection } from '../../types';
3
3
  import type { DropTargetType } from './consts';
4
- import type { DragAndDropPluginState } from './types';
5
4
  export interface DragAndDropAction<T, D> {
6
5
  type: T;
7
6
  data: D;
@@ -10,7 +9,6 @@ export declare const DragAndDropActionType: {
10
9
  readonly SET_DROP_TARGET: "SET_DROP_TARGET";
11
10
  readonly CLEAR_DROP_TARGET: "CLEAR_DROP_TARGET";
12
11
  readonly TOGGLE_DRAG_MENU: "TOGGLE_DRAG_MENU";
13
- readonly UPDATE: "UPDATE";
14
12
  };
15
13
  export type DragAndDropSetDropTargetAction = DragAndDropAction<typeof DragAndDropActionType.SET_DROP_TARGET, {
16
14
  type: DropTargetType;
@@ -25,5 +23,4 @@ export type DragAndDropToggleDragMenuAction = DragAndDropAction<typeof DragAndDr
25
23
  direction: TableDirection;
26
24
  index: number;
27
25
  }>;
28
- export type DragAndDropUpdateAction = DragAndDropAction<typeof DragAndDropActionType.UPDATE, Partial<DragAndDropPluginState>>;
29
- export type DragAndDropPluginAction = DragAndDropSetDropTargetAction | DragAndDropClearDropTargetAction | DragAndDropToggleDragMenuAction | DragAndDropUpdateAction;
26
+ export type DragAndDropPluginAction = DragAndDropSetDropTargetAction | DragAndDropClearDropTargetAction | DragAndDropToggleDragMenuAction;
@@ -4,4 +4,3 @@ export declare const DropTargetType: {
4
4
  readonly COLUMN: "column";
5
5
  };
6
6
  export type DropTargetType = (typeof DropTargetType)[keyof typeof DropTargetType];
7
- export declare const DRAGGABLE_TABLE_NODE_SIZE_LIMIT = 20000;
@@ -1,5 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import type { DragAndDropPluginState } from './types';
5
- export declare const createPlugin: (dispatch: Dispatch, eventDispatcher: EventDispatcher, editorAnalyticsAPI?: EditorAnalyticsAPI) => SafePlugin<DragAndDropPluginState>;
4
+ export declare const createPlugin: (dispatch: Dispatch, eventDispatcher: EventDispatcher, editorAnalyticsAPI?: EditorAnalyticsAPI) => SafePlugin<import("./types").DragAndDropPluginState>;
@@ -9,5 +9,4 @@ export interface DragAndDropPluginState {
9
9
  dragMenuDirection?: TableDirection;
10
10
  dragMenuIndex: number;
11
11
  isDragging: boolean;
12
- canDrag: boolean;
13
12
  }
@@ -17,7 +17,6 @@ type DragHandleProps = {
17
17
  onMouseOut?: MouseEventHandler;
18
18
  onMouseUp?: MouseEventHandler;
19
19
  editorView: EditorView;
20
- canDrag?: boolean;
21
20
  isDragMenuTarget: boolean;
22
21
  };
23
22
  export declare const DragHandle: React.FC<import("react-intl-next").WithIntlProps<DragHandleProps & WrappedComponentProps<"intl">>> & {
@@ -19,10 +19,9 @@ type DragMenuProps = {
19
19
  scrollableElement?: HTMLElement;
20
20
  pluginConfig?: PluginConfig;
21
21
  getEditorContainerWidth: GetEditorContainerWidth;
22
- canDrag?: boolean;
23
22
  editorAnalyticsAPI?: EditorAnalyticsAPI;
24
23
  };
25
- export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, canDrag, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null;
24
+ export declare const DragMenu: ({ direction, index, isOpen, editorView, tableNode, mountPoint, boundariesElement, scrollableElement, targetCellPosition, getEditorContainerWidth, editorAnalyticsAPI, pluginConfig, intl: { formatMessage }, }: DragMenuProps & WrappedComponentProps) => jsx.JSX.Element | null;
26
25
  declare const _default: import("react").FC<import("react-intl-next").WithIntlProps<DragMenuProps & WrappedComponentProps<"intl">>> & {
27
26
  WrappedComponent: import("react").ComponentType<DragMenuProps & WrappedComponentProps<"intl">>;
28
27
  };