@atlaskit/editor-plugin-table 7.1.4 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +17 -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/pm-plugins/main.js +3 -0
  10. package/dist/cjs/ui/DragHandle/index.js +3 -5
  11. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +1 -2
  12. package/dist/cjs/ui/FloatingDragMenu/index.js +0 -2
  13. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -3
  14. package/dist/cjs/ui/TableFloatingColumnControls/index.js +0 -2
  15. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +1 -3
  16. package/dist/cjs/ui/TableFloatingControls/index.js +4 -7
  17. package/dist/es2019/nodeviews/TableComponent.js +0 -3
  18. package/dist/es2019/nodeviews/table.js +1 -5
  19. package/dist/es2019/plugin.js +0 -1
  20. package/dist/es2019/pm-plugins/drag-and-drop/actions.js +1 -2
  21. package/dist/es2019/pm-plugins/drag-and-drop/consts.js +1 -2
  22. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +15 -39
  23. package/dist/es2019/pm-plugins/drag-and-drop/reducer.js +0 -5
  24. package/dist/es2019/pm-plugins/main.js +4 -1
  25. package/dist/es2019/ui/DragHandle/index.js +3 -4
  26. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +1 -2
  27. package/dist/es2019/ui/FloatingDragMenu/index.js +0 -2
  28. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -3
  29. package/dist/es2019/ui/TableFloatingColumnControls/index.js +0 -2
  30. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +1 -3
  31. package/dist/es2019/ui/TableFloatingControls/index.js +4 -7
  32. package/dist/esm/nodeviews/TableComponent.js +0 -3
  33. package/dist/esm/nodeviews/table.js +1 -4
  34. package/dist/esm/plugin.js +0 -1
  35. package/dist/esm/pm-plugins/drag-and-drop/actions.js +1 -2
  36. package/dist/esm/pm-plugins/drag-and-drop/consts.js +1 -2
  37. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +15 -39
  38. package/dist/esm/pm-plugins/drag-and-drop/reducer.js +0 -2
  39. package/dist/esm/pm-plugins/main.js +4 -1
  40. package/dist/esm/ui/DragHandle/index.js +3 -5
  41. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +1 -2
  42. package/dist/esm/ui/FloatingDragMenu/index.js +0 -2
  43. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -3
  44. package/dist/esm/ui/TableFloatingColumnControls/index.js +0 -2
  45. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +1 -3
  46. package/dist/esm/ui/TableFloatingControls/index.js +4 -7
  47. package/dist/types/nodeviews/TableComponent.d.ts +0 -1
  48. package/dist/types/pm-plugins/drag-and-drop/actions.d.ts +1 -4
  49. package/dist/types/pm-plugins/drag-and-drop/consts.d.ts +0 -1
  50. package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
  51. package/dist/types/pm-plugins/drag-and-drop/types.d.ts +0 -1
  52. package/dist/types/ui/DragHandle/index.d.ts +0 -1
  53. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  54. package/dist/types/ui/FloatingDragMenu/index.d.ts +1 -2
  55. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -2
  56. package/dist/types/ui/TableFloatingColumnControls/index.d.ts +0 -1
  57. package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +0 -1
  58. package/dist/types/ui/TableFloatingControls/index.d.ts +0 -1
  59. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +0 -1
  60. package/dist/types-ts4.5/pm-plugins/drag-and-drop/actions.d.ts +1 -4
  61. package/dist/types-ts4.5/pm-plugins/drag-and-drop/consts.d.ts +0 -1
  62. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -2
  63. package/dist/types-ts4.5/pm-plugins/drag-and-drop/types.d.ts +0 -1
  64. package/dist/types-ts4.5/ui/DragHandle/index.d.ts +0 -1
  65. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +1 -2
  66. package/dist/types-ts4.5/ui/FloatingDragMenu/index.d.ts +1 -2
  67. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -2
  68. package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +0 -1
  69. package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +0 -1
  70. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +0 -1
  71. package/package.json +5 -5
  72. package/src/nodeviews/TableComponent.tsx +0 -4
  73. package/src/nodeviews/table.tsx +0 -3
  74. package/src/plugin.tsx +0 -1
  75. package/src/pm-plugins/drag-and-drop/actions.ts +1 -9
  76. package/src/pm-plugins/drag-and-drop/consts.ts +0 -2
  77. package/src/pm-plugins/drag-and-drop/plugin.ts +17 -49
  78. package/src/pm-plugins/drag-and-drop/reducer.ts +0 -5
  79. package/src/pm-plugins/drag-and-drop/types.ts +0 -1
  80. package/src/pm-plugins/main.ts +4 -0
  81. package/src/ui/DragHandle/index.tsx +2 -5
  82. package/src/ui/FloatingDragMenu/DragMenu.tsx +1 -3
  83. package/src/ui/FloatingDragMenu/index.tsx +0 -3
  84. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +0 -3
  85. package/src/ui/TableFloatingColumnControls/index.tsx +0 -3
  86. package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +0 -3
  87. package/src/ui/TableFloatingControls/index.tsx +1 -6
  88. package/src/__tests__/unit/pm-plugins/drag-and-drop/plugin.ts +0 -112
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#70802](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70802) [`ee58189e1b0e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ee58189e1b0e) - ED-21911 Adding custom paste handling for content copied from MBE frames.
8
+
9
+ ## 7.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#70702](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70702) [`de0d7031a536`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/de0d7031a536) - remove drag and drop nodesize limit
14
+
15
+ ### Patch Changes
16
+
17
+ - [#70152](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/70152) [`53ed3673df28`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/53ed3673df28) - Updating adf-schema version to 35.5.1
18
+ - Updated dependencies
19
+
3
20
  ## 7.1.4
4
21
 
5
22
  ### Patch Changes
@@ -488,7 +488,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
488
488
  getPos = _this$props10.getPos,
489
489
  pluginInjectionApi = _this$props10.pluginInjectionApi,
490
490
  isDragAndDropEnabled = _this$props10.isDragAndDropEnabled,
491
- canDrag = _this$props10.canDrag,
492
491
  getEditorFeatureFlags = _this$props10.getEditorFeatureFlags;
493
492
  var _this$state3 = this.state,
494
493
  showBeforeShadow = _this$state3.showBeforeShadow,
@@ -516,7 +515,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
516
515
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
517
516
  isHeaderRowEnabled: isHeaderRowEnabled,
518
517
  isDragAndDropEnabled: isDragAndDropEnabled,
519
- canDrag: canDrag,
520
518
  ordering: ordering,
521
519
  isHeaderColumnEnabled: isHeaderColumnEnabled,
522
520
  hasHeaderRow: hasHeaderRow
@@ -544,7 +542,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
544
542
  selection: view.state.selection,
545
543
  headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
546
544
  stickyHeader: this.state.stickyHeader,
547
- canDrag: canDrag,
548
545
  getEditorFeatureFlags: getEditorFeatureFlags,
549
546
  tableContainerWidth: tableContainerWidth,
550
547
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled
@@ -148,12 +148,10 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
148
148
  },
149
149
  editorView: props.view,
150
150
  render: function render(pluginStates) {
151
- var _tableDragAndDropStat;
152
151
  var tableResizingPluginState = pluginStates.tableResizingPluginState,
153
152
  tableWidthPluginState = pluginStates.tableWidthPluginState,
154
153
  pluginState = pluginStates.pluginState,
155
- mediaState = pluginStates.mediaState,
156
- tableDragAndDropState = pluginStates.tableDragAndDropState;
154
+ mediaState = pluginStates.mediaState;
157
155
  var containerWidth = props.getEditorContainerWidth();
158
156
  var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
159
157
  var isResizing = Boolean((tableResizingPluginState === null || tableResizingPluginState === void 0 ? void 0 : tableResizingPluginState.dragging) || isTableResizing);
@@ -181,7 +179,6 @@ var TableView = exports.default = /*#__PURE__*/function (_ReactNodeView) {
181
179
  isHeaderRowEnabled: pluginState.isHeaderRowEnabled,
182
180
  isHeaderColumnEnabled: pluginState.isHeaderColumnEnabled,
183
181
  isDragAndDropEnabled: pluginState.isDragAndDropEnabled,
184
- canDrag: (_tableDragAndDropStat = tableDragAndDropState === null || tableDragAndDropState === void 0 ? void 0 : tableDragAndDropState.canDrag) !== null && _tableDragAndDropStat !== void 0 ? _tableDragAndDropStat : false,
185
182
  tableActive: tableActive,
186
183
  ordering: pluginState.ordering,
187
184
  isResizing: isResizing,
@@ -359,7 +359,6 @@ var tablesPlugin = function tablesPlugin(_ref) {
359
359
  direction: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
360
360
  index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
361
361
  isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
362
- canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
363
362
  getEditorContainerWidth: defaultGetEditorContainerWidth,
364
363
  editorAnalyticsAPI: editorAnalyticsAPI,
365
364
  stickyHeaders: stickyHeader,
@@ -7,8 +7,7 @@ exports.DragAndDropActionType = void 0;
7
7
  var DragAndDropActionType = exports.DragAndDropActionType = {
8
8
  SET_DROP_TARGET: 'SET_DROP_TARGET',
9
9
  CLEAR_DROP_TARGET: 'CLEAR_DROP_TARGET',
10
- TOGGLE_DRAG_MENU: 'TOGGLE_DRAG_MENU',
11
- UPDATE: 'UPDATE'
10
+ TOGGLE_DRAG_MENU: 'TOGGLE_DRAG_MENU'
12
11
  };
13
12
 
14
13
  // NOTE: This should be a Union of all possible actions
@@ -3,10 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DropTargetType = exports.DRAGGABLE_TABLE_NODE_SIZE_LIMIT = void 0;
6
+ exports.DropTargetType = void 0;
7
7
  var DropTargetType = exports.DropTargetType = {
8
8
  NONE: 'none',
9
9
  ROW: 'row',
10
10
  COLUMN: 'column'
11
- };
12
- var DRAGGABLE_TABLE_NODE_SIZE_LIMIT = exports.DRAGGABLE_TABLE_NODE_SIZE_LIMIT = 20000;
11
+ };
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.createPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _analytics = require("@atlaskit/editor-common/analytics");
10
8
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
9
  var _view = require("@atlaskit/editor-prosemirror/view");
@@ -25,8 +23,6 @@ var _consts = require("./consts");
25
23
  var _pluginFactory2 = require("./plugin-factory");
26
24
  var _pluginKey2 = require("./plugin-key");
27
25
  var _monitor = require("./utils/monitor");
28
- 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; }
29
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
30
26
  var destroyFn = function destroyFn(editorView, editorAnalyticsAPI) {
31
27
  var editorPageScrollContainer = document.querySelector('.fabric-editor-popup-scroll-parent');
32
28
  var rowAutoScrollers = editorPageScrollContainer ? [(0, _element2.monitorForElements)({
@@ -174,24 +170,18 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
174
170
  dropTargetIndex: 0,
175
171
  isDragMenuOpen: false,
176
172
  dragMenuIndex: 0,
177
- isDragging: false,
178
- canDrag: false
173
+ isDragging: false
179
174
  };
180
175
  }),
181
176
  key: _pluginKey2.pluginKey,
182
177
  appendTransaction: function appendTransaction(transactions, oldState, newState) {
183
178
  var _getTablePluginState4 = (0, _pluginFactory.getPluginState)(oldState),
184
- oldTargetCellPosition = _getTablePluginState4.targetCellPosition,
185
- oldTableNode = _getTablePluginState4.tableNode;
179
+ oldTargetCellPosition = _getTablePluginState4.targetCellPosition;
186
180
  var _getTablePluginState5 = (0, _pluginFactory.getPluginState)(newState),
187
- newTargetCellPosition = _getTablePluginState5.targetCellPosition,
188
- newTableNode = _getTablePluginState5.tableNode;
181
+ newTargetCellPosition = _getTablePluginState5.targetCellPosition;
189
182
  var _getPluginState = (0, _pluginFactory2.getPluginState)(newState),
190
183
  isDragMenuOpen = _getPluginState.isDragMenuOpen,
191
- dragMenuIndex = _getPluginState.dragMenuIndex,
192
- canDrag = _getPluginState.canDrag;
193
- var stateChanges = [];
194
- var tr = newState.tr;
184
+ dragMenuIndex = _getPluginState.dragMenuIndex;
195
185
 
196
186
  // What's happening here? you asked... In a nutshell;
197
187
  // 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.
@@ -199,6 +189,14 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
199
189
  // to check if the new target cell position is pointed at a different cell than what the drag menu was opened on.
200
190
  if (oldTargetCellPosition !== newTargetCellPosition) {
201
191
  if (isDragMenuOpen) {
192
+ var tr = newState.tr;
193
+ var action = {
194
+ type: _actions.DragAndDropActionType.TOGGLE_DRAG_MENU,
195
+ data: {
196
+ isDragMenuOpen: false,
197
+ direction: undefined
198
+ }
199
+ };
202
200
  if (newTargetCellPosition !== undefined) {
203
201
  var cells = (0, _utils.getCellsInRow)(dragMenuIndex)(tr.selection);
204
202
  // ED-20673 check if it is a cell selection,
@@ -206,36 +204,13 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
206
204
  // should not close the drag menu.
207
205
  var isCellSelection = tr.selection instanceof _cellSelection.CellSelection;
208
206
  if (cells && cells.length && cells[0].node !== tr.doc.nodeAt(newTargetCellPosition) && !isCellSelection) {
209
- stateChanges.push({
210
- isDragMenuOpen: false,
211
- dragMenuDirection: undefined
212
- });
207
+ return tr.setMeta(_pluginKey2.pluginKey, action);
213
208
  } // else NOP
214
209
  } else {
215
- stateChanges.push({
216
- isDragMenuOpen: false,
217
- dragMenuDirection: undefined
218
- });
210
+ return tr.setMeta(_pluginKey2.pluginKey, action);
219
211
  }
220
212
  }
221
213
  }
222
- if ((oldTableNode === null || oldTableNode === void 0 ? void 0 : oldTableNode.nodeSize) !== (newTableNode === null || newTableNode === void 0 ? void 0 : newTableNode.nodeSize)) {
223
- var _newTableNode$nodeSiz;
224
- var nextCanDrag = ((_newTableNode$nodeSiz = newTableNode === null || newTableNode === void 0 ? void 0 : newTableNode.nodeSize) !== null && _newTableNode$nodeSiz !== void 0 ? _newTableNode$nodeSiz : 0) < _consts.DRAGGABLE_TABLE_NODE_SIZE_LIMIT;
225
- if (canDrag !== nextCanDrag) {
226
- stateChanges.push({
227
- canDrag: nextCanDrag
228
- });
229
- }
230
- }
231
- if (stateChanges.length) {
232
- return tr.setMeta(_pluginKey2.pluginKey, {
233
- type: _actions.DragAndDropActionType.UPDATE,
234
- data: _objectSpread({}, stateChanges.reduce(function (state, cur) {
235
- return _objectSpread(_objectSpread({}, state), cur);
236
- }, {}))
237
- }).setMeta('addToHistory', false);
238
- }
239
214
  },
240
215
  view: function view(editorView) {
241
216
  return {
@@ -32,8 +32,6 @@ var _default = exports.default = function _default(pluginState, action) {
32
32
  dragMenuDirection: action.data.direction,
33
33
  dragMenuIndex: action.data.index
34
34
  });
35
- case _actions.DragAndDropActionType.UPDATE:
36
- return _objectSpread(_objectSpread({}, pluginState), action.data);
37
35
  default:
38
36
  return pluginState;
39
37
  }
@@ -171,6 +171,9 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
171
171
 
172
172
  /** If a partial paste of bodied extension, paste only text */
173
173
  slice = (0, _transforms.transformSliceToRemoveOpenBodiedExtension)(slice, schema);
174
+
175
+ /** If a partial paste of multi bodied extension, paste only children */
176
+ slice = (0, _transforms.transformSliceToRemoveOpenMultiBodiedExtension)(slice, schema);
174
177
  slice = (0, _utils3.transformSliceToCorrectEmptyTableCells)(slice, schema);
175
178
  if (!pluginConfig.allowColumnResizing) {
176
179
  slice = (0, _misc.transformSliceToRemoveColumnsWidths)(slice, schema);
@@ -41,8 +41,6 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
41
41
  _onMouseUp = _ref.onMouseUp,
42
42
  onClick = _ref.onClick,
43
43
  editorView = _ref.editorView,
44
- _ref$canDrag = _ref.canDrag,
45
- _canDrag = _ref$canDrag === void 0 ? false : _ref$canDrag,
46
44
  formatMessage = _ref.intl.formatMessage;
47
45
  var dragHandleDivRef = (0, _react.useRef)(null);
48
46
  var _useState = (0, _react.useState)(null),
@@ -72,7 +70,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
72
70
  return (0, _element.draggable)({
73
71
  element: dragHandleDivRefCurrent,
74
72
  canDrag: function canDrag() {
75
- return _canDrag && !hasMergedCells;
73
+ return !hasMergedCells;
76
74
  },
77
75
  getInitialData: function getInitialData() {
78
76
  return {
@@ -120,7 +118,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
120
118
  }
121
119
  });
122
120
  }
123
- }, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells, _canDrag]);
121
+ }, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
124
122
  var showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
125
123
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("button", {
126
124
  className: _types.TableCssClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE,
@@ -138,7 +136,7 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
138
136
  onClick: onClick
139
137
  }), /*#__PURE__*/_react.default.createElement("button", {
140
138
  id: isDragMenuTarget ? showDragMenuAnchorId : undefined,
141
- className: (0, _classnames2.default)(_types.TableCssClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, (0, _defineProperty2.default)({}, _types.TableCssClassName.DRAG_HANDLE_DISABLED, !_canDrag || hasMergedCells)),
139
+ className: (0, _classnames2.default)(_types.TableCssClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, (0, _defineProperty2.default)({}, _types.TableCssClassName.DRAG_HANDLE_DISABLED, hasMergedCells)),
142
140
  ref: dragHandleDivRef,
143
141
  style: {
144
142
  transform: isColumn ? 'none' : 'rotate(90deg)',
@@ -178,7 +178,6 @@ var DragMenu = exports.DragMenu = function DragMenu(_ref) {
178
178
  scrollableElement = _ref.scrollableElement,
179
179
  targetCellPosition = _ref.targetCellPosition,
180
180
  getEditorContainerWidth = _ref.getEditorContainerWidth,
181
- canDrag = _ref.canDrag,
182
181
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
183
182
  pluginConfig = _ref.pluginConfig,
184
183
  formatMessage = _ref.intl.formatMessage;
@@ -195,7 +194,7 @@ var DragMenu = exports.DragMenu = function DragMenu(_ref) {
195
194
  var shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
196
195
  var hasMergedCellsInTable = (0, _utils3.getMergedCellsPositions)(state.tr).length > 0;
197
196
  var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
198
- var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !!canDrag && !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI);
197
+ var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI);
199
198
  var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
200
199
  menuItems = _convertToDropdownIte.menuItems,
201
200
  menuCallback = _convertToDropdownIte.menuCallback;
@@ -22,7 +22,6 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
22
22
  index = _ref.index,
23
23
  targetCellPosition = _ref.targetCellPosition,
24
24
  getEditorContainerWidth = _ref.getEditorContainerWidth,
25
- canDrag = _ref.canDrag,
26
25
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
27
26
  stickyHeaders = _ref.stickyHeaders,
28
27
  pluginConfig = _ref.pluginConfig;
@@ -62,7 +61,6 @@ var FloatingDragMenu = function FloatingDragMenu(_ref) {
62
61
  index: index,
63
62
  targetCellPosition: targetCellPosition,
64
63
  getEditorContainerWidth: getEditorContainerWidth,
65
- canDrag: canDrag,
66
64
  editorAnalyticsAPI: editorAnalyticsAPI,
67
65
  pluginConfig: pluginConfig
68
66
  }));
@@ -44,7 +44,6 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
44
44
  colWidths = _ref.colWidths,
45
45
  hasHeaderColumn = _ref.hasHeaderColumn,
46
46
  isTableHovered = _ref.isTableHovered,
47
- canDrag = _ref.canDrag,
48
47
  tableContainerWidth = _ref.tableContainerWidth,
49
48
  isNumberColumnEnabled = _ref.isNumberColumnEnabled,
50
49
  isDragging = _ref.isDragging;
@@ -188,8 +187,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
188
187
  onMouseOver: handleMouseOver,
189
188
  onMouseOut: handleMouseOut,
190
189
  onMouseUp: handleMouseUp,
191
- editorView: editorView,
192
- canDrag: canDrag
190
+ editorView: editorView
193
191
  }));
194
192
  };
195
193
  var columnHandles = function columnHandles(hoveredCell) {
@@ -30,7 +30,6 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
30
30
  selection = _ref.selection,
31
31
  isInDanger = _ref.isInDanger,
32
32
  isTableHovered = _ref.isTableHovered,
33
- canDrag = _ref.canDrag,
34
33
  tableContainerWidth = _ref.tableContainerWidth,
35
34
  isNumberColumnEnabled = _ref.isNumberColumnEnabled;
36
35
  var _useState = (0, _react.useState)({
@@ -135,7 +134,6 @@ var TableFloatingColumnControls = exports.TableFloatingColumnControls = function
135
134
  rowHeights: rowHeights,
136
135
  colWidths: colWidths,
137
136
  hasHeaderColumn: hasHeaderColumn,
138
- canDrag: canDrag,
139
137
  tableContainerWidth: tableContainerWidth,
140
138
  isNumberColumnEnabled: isNumberColumnEnabled,
141
139
  isDragging: isDragging
@@ -45,7 +45,6 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
45
45
  isInDanger = _ref.isInDanger,
46
46
  isResizing = _ref.isResizing,
47
47
  isTableHovered = _ref.isTableHovered,
48
- canDrag = _ref.canDrag,
49
48
  hoverRows = _ref.hoverRows,
50
49
  selectRow = _ref.selectRow,
51
50
  selectRows = _ref.selectRows,
@@ -172,8 +171,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
172
171
  onMouseOver: handleMouseOver,
173
172
  onMouseOut: handleMouseOut,
174
173
  onMouseUp: onMouseUp,
175
- editorView: editorView,
176
- canDrag: canDrag
174
+ editorView: editorView
177
175
  }));
178
176
  };
179
177
  var rowHandles = function rowHandles(hoveredCell) {
@@ -146,9 +146,8 @@ var TableFloatingControls = exports.default = /*#__PURE__*/function (_Component)
146
146
  headerRowHeight = _this$props2.headerRowHeight,
147
147
  stickyHeader = _this$props2.stickyHeader,
148
148
  hoveredCell = _this$props2.hoveredCell,
149
- isTableHovered = _this$props2.isTableHovered,
150
- canDrag = _this$props2.canDrag;
151
- 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 || (0, _utils2.isSelectionUpdated)(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell || isTableHovered !== nextProps.isTableHovered || canDrag !== nextProps.canDrag;
149
+ isTableHovered = _this$props2.isTableHovered;
150
+ 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 || (0, _utils2.isSelectionUpdated)(selection, nextProps.selection) || headerRowHeight !== nextProps.headerRowHeight || stickyHeader !== nextProps.stickyHeader || hoveredCell !== nextProps.hoveredCell || isTableHovered !== nextProps.isTableHovered;
152
151
  }
153
152
  }, {
154
153
  key: "componentWillUnmount",
@@ -175,8 +174,7 @@ var TableFloatingControls = exports.default = /*#__PURE__*/function (_Component)
175
174
  stickyHeader = _this$props3.stickyHeader,
176
175
  isDragAndDropEnabled = _this$props3.isDragAndDropEnabled,
177
176
  hoveredCell = _this$props3.hoveredCell,
178
- isTableHovered = _this$props3.isTableHovered,
179
- canDrag = _this$props3.canDrag;
177
+ isTableHovered = _this$props3.isTableHovered;
180
178
  if (!tableRef) {
181
179
  return null;
182
180
  }
@@ -219,8 +217,7 @@ var TableFloatingControls = exports.default = /*#__PURE__*/function (_Component)
219
217
  hoverRows: this.hoverRows,
220
218
  selectRow: this.selectRow,
221
219
  selectRows: this.selectRows,
222
- updateCellHoverLocation: this.updateCellHoverLocation,
223
- canDrag: canDrag
220
+ updateCellHoverLocation: this.updateCellHoverLocation
224
221
  })) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_CornerControls.CornerControls, {
225
222
  editorView: editorView,
226
223
  tableRef: tableRef,
@@ -484,7 +484,6 @@ class TableComponent extends React.Component {
484
484
  getPos,
485
485
  pluginInjectionApi,
486
486
  isDragAndDropEnabled,
487
- canDrag,
488
487
  getEditorFeatureFlags
489
488
  } = this.props;
490
489
  const {
@@ -515,7 +514,6 @@ class TableComponent extends React.Component {
515
514
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
516
515
  isHeaderRowEnabled: isHeaderRowEnabled,
517
516
  isDragAndDropEnabled: isDragAndDropEnabled,
518
- canDrag: canDrag,
519
517
  ordering: ordering,
520
518
  isHeaderColumnEnabled: isHeaderColumnEnabled,
521
519
  hasHeaderRow: hasHeaderRow
@@ -543,7 +541,6 @@ class TableComponent extends React.Component {
543
541
  selection: view.state.selection,
544
542
  headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
545
543
  stickyHeader: this.state.stickyHeader,
546
- canDrag: canDrag,
547
544
  getEditorFeatureFlags: getEditorFeatureFlags,
548
545
  tableContainerWidth: tableContainerWidth,
549
546
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled
@@ -117,14 +117,11 @@ export default class TableView extends ReactNodeView {
117
117
  },
118
118
  editorView: props.view,
119
119
  render: pluginStates => {
120
- var _tableDragAndDropStat;
121
120
  const {
122
121
  tableResizingPluginState,
123
122
  tableWidthPluginState,
124
123
  pluginState,
125
- // containerWidth,
126
- mediaState,
127
- tableDragAndDropState
124
+ mediaState
128
125
  } = pluginStates;
129
126
  const containerWidth = props.getEditorContainerWidth();
130
127
  const isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
@@ -153,7 +150,6 @@ export default class TableView extends ReactNodeView {
153
150
  isHeaderRowEnabled: pluginState.isHeaderRowEnabled,
154
151
  isHeaderColumnEnabled: pluginState.isHeaderColumnEnabled,
155
152
  isDragAndDropEnabled: pluginState.isDragAndDropEnabled,
156
- canDrag: (_tableDragAndDropStat = tableDragAndDropState === null || tableDragAndDropState === void 0 ? void 0 : tableDragAndDropState.canDrag) !== null && _tableDragAndDropStat !== void 0 ? _tableDragAndDropStat : false,
157
153
  tableActive: tableActive,
158
154
  ordering: pluginState.ordering,
159
155
  isResizing: isResizing,
@@ -356,7 +356,6 @@ const tablesPlugin = ({
356
356
  direction: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
357
357
  index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
358
358
  isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
359
- canDrag: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.canDrag,
360
359
  getEditorContainerWidth: defaultGetEditorContainerWidth,
361
360
  editorAnalyticsAPI: editorAnalyticsAPI,
362
361
  stickyHeaders: stickyHeader,
@@ -1,8 +1,7 @@
1
1
  export const 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 const DropTargetType = {
2
2
  NONE: 'none',
3
3
  ROW: 'row',
4
4
  COLUMN: 'column'
5
- };
6
- export const DRAGGABLE_TABLE_NODE_SIZE_LIMIT = 20000;
5
+ };
@@ -13,7 +13,7 @@ import { insertColgroupFromNode } from '../table-resizing/utils';
13
13
  import { DragAndDropActionType } from './actions';
14
14
  import { clearDropTarget, setDropTarget, toggleDragMenu } from './commands';
15
15
  import { clearDropTargetWithAnalytics, moveSourceWithAnalytics } from './commands-with-analytics';
16
- import { DRAGGABLE_TABLE_NODE_SIZE_LIMIT, DropTargetType } from './consts';
16
+ import { DropTargetType } from './consts';
17
17
  import { createPluginState, getPluginState } from './plugin-factory';
18
18
  import { pluginKey } from './plugin-key';
19
19
  import { getDraggableDataFromEvent } from './utils/monitor';
@@ -177,26 +177,20 @@ export const createPlugin = (dispatch, eventDispatcher, editorAnalyticsAPI) => {
177
177
  dropTargetIndex: 0,
178
178
  isDragMenuOpen: false,
179
179
  dragMenuIndex: 0,
180
- isDragging: false,
181
- canDrag: false
180
+ isDragging: false
182
181
  })),
183
182
  key: pluginKey,
184
183
  appendTransaction: (transactions, oldState, newState) => {
185
184
  const {
186
- targetCellPosition: oldTargetCellPosition,
187
- tableNode: oldTableNode
185
+ targetCellPosition: oldTargetCellPosition
188
186
  } = getTablePluginState(oldState);
189
187
  const {
190
- targetCellPosition: newTargetCellPosition,
191
- tableNode: newTableNode
188
+ targetCellPosition: newTargetCellPosition
192
189
  } = getTablePluginState(newState);
193
190
  const {
194
191
  isDragMenuOpen,
195
- dragMenuIndex,
196
- canDrag
192
+ dragMenuIndex
197
193
  } = getPluginState(newState);
198
- const stateChanges = [];
199
- const tr = newState.tr;
200
194
 
201
195
  // What's happening here? you asked... In a nutshell;
202
196
  // 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.
@@ -204,6 +198,14 @@ export const createPlugin = (dispatch, eventDispatcher, editorAnalyticsAPI) => {
204
198
  // to check if the new target cell position is pointed at a different cell than what the drag menu was opened on.
205
199
  if (oldTargetCellPosition !== newTargetCellPosition) {
206
200
  if (isDragMenuOpen) {
201
+ const tr = newState.tr;
202
+ const action = {
203
+ type: DragAndDropActionType.TOGGLE_DRAG_MENU,
204
+ data: {
205
+ isDragMenuOpen: false,
206
+ direction: undefined
207
+ }
208
+ };
207
209
  if (newTargetCellPosition !== undefined) {
208
210
  const cells = getCellsInRow(dragMenuIndex)(tr.selection);
209
211
  // ED-20673 check if it is a cell selection,
@@ -211,39 +213,13 @@ export const createPlugin = (dispatch, eventDispatcher, editorAnalyticsAPI) => {
211
213
  // should not close the drag menu.
212
214
  const isCellSelection = tr.selection instanceof CellSelection;
213
215
  if (cells && cells.length && cells[0].node !== tr.doc.nodeAt(newTargetCellPosition) && !isCellSelection) {
214
- stateChanges.push({
215
- isDragMenuOpen: false,
216
- dragMenuDirection: undefined
217
- });
216
+ return tr.setMeta(pluginKey, action);
218
217
  } // else NOP
219
218
  } else {
220
- stateChanges.push({
221
- isDragMenuOpen: false,
222
- dragMenuDirection: undefined
223
- });
219
+ return tr.setMeta(pluginKey, action);
224
220
  }
225
221
  }
226
222
  }
227
- if ((oldTableNode === null || oldTableNode === void 0 ? void 0 : oldTableNode.nodeSize) !== (newTableNode === null || newTableNode === void 0 ? void 0 : newTableNode.nodeSize)) {
228
- var _newTableNode$nodeSiz;
229
- const 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;
230
- if (canDrag !== nextCanDrag) {
231
- stateChanges.push({
232
- canDrag: nextCanDrag
233
- });
234
- }
235
- }
236
- if (stateChanges.length) {
237
- return tr.setMeta(pluginKey, {
238
- type: DragAndDropActionType.UPDATE,
239
- data: {
240
- ...stateChanges.reduce((state, cur) => ({
241
- ...state,
242
- ...cur
243
- }), {})
244
- }
245
- }).setMeta('addToHistory', false);
246
- }
247
223
  },
248
224
  view: editorView => {
249
225
  return {
@@ -25,11 +25,6 @@ export default ((pluginState, action) => {
25
25
  dragMenuDirection: action.data.direction,
26
26
  dragMenuIndex: action.data.index
27
27
  };
28
- case DragAndDropActionType.UPDATE:
29
- return {
30
- ...pluginState,
31
- ...action.data
32
- };
33
28
  default:
34
29
  return pluginState;
35
30
  }
@@ -1,7 +1,7 @@
1
1
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import { insideTable } from '@atlaskit/editor-common/core-utils';
3
3
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
- import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes } from '@atlaskit/editor-common/transforms';
4
+ import { transformSliceToRemoveOpenBodiedExtension, transformSliceToRemoveOpenExpand, transformSliceToRemoveOpenLayoutNodes, transformSliceToRemoveOpenMultiBodiedExtension } from '@atlaskit/editor-common/transforms';
5
5
  import { browser, closestElement } from '@atlaskit/editor-common/utils';
6
6
  import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
7
  import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
@@ -163,6 +163,9 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
163
163
 
164
164
  /** If a partial paste of bodied extension, paste only text */
165
165
  slice = transformSliceToRemoveOpenBodiedExtension(slice, schema);
166
+
167
+ /** If a partial paste of multi bodied extension, paste only children */
168
+ slice = transformSliceToRemoveOpenMultiBodiedExtension(slice, schema);
166
169
  slice = transformSliceToCorrectEmptyTableCells(slice, schema);
167
170
  if (!pluginConfig.allowColumnResizing) {
168
171
  slice = transformSliceToRemoveColumnsWidths(slice, schema);
@@ -26,7 +26,6 @@ const DragHandleComponent = ({
26
26
  onMouseUp,
27
27
  onClick,
28
28
  editorView,
29
- canDrag = false,
30
29
  intl: {
31
30
  formatMessage
32
31
  }
@@ -57,7 +56,7 @@ const DragHandleComponent = ({
57
56
  return draggable({
58
57
  element: dragHandleDivRefCurrent,
59
58
  canDrag: () => {
60
- return canDrag && !hasMergedCells;
59
+ return !hasMergedCells;
61
60
  },
62
61
  getInitialData() {
63
62
  return {
@@ -106,7 +105,7 @@ const DragHandleComponent = ({
106
105
  }
107
106
  });
108
107
  }
109
- }, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells, canDrag]);
108
+ }, [tableLocalId, direction, indexes, isRow, editorView.state.selection, hasMergedCells]);
110
109
  const showDragMenuAnchorId = isRow ? 'drag-handle-button-row' : 'drag-handle-button-column';
111
110
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
112
111
  className: ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE,
@@ -125,7 +124,7 @@ const DragHandleComponent = ({
125
124
  }), /*#__PURE__*/React.createElement("button", {
126
125
  id: isDragMenuTarget ? showDragMenuAnchorId : undefined,
127
126
  className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, {
128
- [ClassName.DRAG_HANDLE_DISABLED]: !canDrag || hasMergedCells
127
+ [ClassName.DRAG_HANDLE_DISABLED]: hasMergedCells
129
128
  }),
130
129
  ref: dragHandleDivRef,
131
130
  style: {