@atlaskit/editor-plugin-table 2.10.0 → 2.10.2

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 (37) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +9 -3
  3. package/dist/cjs/plugins/table/nodeviews/TableContainer.js +9 -2
  4. package/dist/cjs/plugins/table/nodeviews/TableResizer.js +5 -1
  5. package/dist/cjs/plugins/table/nodeviews/table.js +4 -2
  6. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +9 -3
  7. package/dist/es2019/plugins/table/nodeviews/TableContainer.js +10 -3
  8. package/dist/es2019/plugins/table/nodeviews/TableResizer.js +6 -1
  9. package/dist/es2019/plugins/table/nodeviews/table.js +3 -1
  10. package/dist/esm/plugins/table/nodeviews/TableComponent.js +9 -3
  11. package/dist/esm/plugins/table/nodeviews/TableContainer.js +10 -3
  12. package/dist/esm/plugins/table/nodeviews/TableResizer.js +5 -1
  13. package/dist/esm/plugins/table/nodeviews/table.js +4 -2
  14. package/dist/types/plugins/table/nodeviews/TableContainer.d.ts +4 -2
  15. package/dist/types/plugins/table/nodeviews/table.d.ts +4 -4
  16. package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +4 -2
  17. package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +4 -4
  18. package/package.json +3 -3
  19. package/src/__tests__/unit/commands/go-to-next-cell.ts +5 -5
  20. package/src/__tests__/unit/commands/insert.ts +5 -5
  21. package/src/__tests__/unit/commands/misc.ts +6 -8
  22. package/src/__tests__/unit/copy-paste.ts +10 -13
  23. package/src/__tests__/unit/event-handlers/index.ts +6 -6
  24. package/src/__tests__/unit/handlers.ts +6 -5
  25. package/src/__tests__/unit/hover-selection.ts +7 -6
  26. package/src/__tests__/unit/layout.ts +6 -6
  27. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +23 -23
  28. package/src/__tests__/unit/sort-column.ts +5 -5
  29. package/src/__tests__/unit/transforms/delete-columns.ts +6 -6
  30. package/src/__tests__/unit/transforms/delete-rows.ts +6 -6
  31. package/src/__tests__/unit/transforms/merging.ts +5 -5
  32. package/src/__tests__/unit/ui/TableFloatingControls.tsx +5 -5
  33. package/src/__tests__/unit/utils.ts +5 -5
  34. package/src/plugins/table/nodeviews/TableComponent.tsx +20 -3
  35. package/src/plugins/table/nodeviews/TableContainer.tsx +19 -3
  36. package/src/plugins/table/nodeviews/TableResizer.tsx +3 -0
  37. package/src/plugins/table/nodeviews/table.tsx +14 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 2.10.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`31031f52f80`](https://bitbucket.org/atlassian/atlassian-frontend/commits/31031f52f80) - Fix table shift when two users resize the same table in collab mode
8
+ - Updated dependencies
9
+
10
+ ## 2.10.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`30d49e87f62`](https://bitbucket.org/atlassian/atlassian-frontend/commits/30d49e87f62) - Added danger apperance to ReszierNext component and toggled it when the delete icon in the table floating toolbar is rolled over
15
+ - Updated dependencies
16
+
3
17
  ## 2.10.0
4
18
 
5
19
  ### Minor Changes
@@ -320,7 +320,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
320
320
  view = _this$props8.view,
321
321
  getNode = _this$props8.getNode,
322
322
  isMediaFullscreen = _this$props8.isMediaFullscreen,
323
- allowColumnResizing = _this$props8.allowColumnResizing;
323
+ allowColumnResizing = _this$props8.allowColumnResizing,
324
+ isResizing = _this$props8.isResizing,
325
+ options = _this$props8.options;
324
326
  var _getPluginState = (0, _pluginFactory.getPluginState)(view.state),
325
327
  isInDanger = _getPluginState.isInDanger;
326
328
  var table = (0, _utils2.findTable)(view.state.selection);
@@ -347,7 +349,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
347
349
  var previousTable = this.node;
348
350
  if ((0, _utils4.tablesHaveDifferentColumnWidths)(currentTable, previousTable) || (0, _utils4.tablesHaveDifferentNoOfColumns)(currentTable, previousTable)) {
349
351
  var _view = this.props.view;
350
- (0, _utils3.insertColgroupFromNode)(this.table, currentTable);
352
+ var shouldRecreateResizeCols = !(options !== null && options !== void 0 && options.isTableResizingEnabled) || !isResizing || (0, _utils4.tablesHaveDifferentNoOfColumns)(currentTable, previousTable) && isResizing;
353
+ if (shouldRecreateResizeCols) {
354
+ (0, _utils3.insertColgroupFromNode)(this.table, currentTable);
355
+ }
351
356
  (0, _dom.updateControls)()(_view.state);
352
357
  }
353
358
  this.handleTableResizingDebounced();
@@ -421,7 +426,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
421
426
  isBreakoutEnabled: options === null || options === void 0 ? void 0 : options.isBreakoutEnabled,
422
427
  isNested: isNested,
423
428
  pluginInjectionApi: pluginInjectionApi,
424
- isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled
429
+ isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled,
430
+ isResizing: isResizing
425
431
  }, /*#__PURE__*/_react.default.createElement("div", {
426
432
  className: _types.TableCssClassName.TABLE_STICKY_SENTINEL_TOP,
427
433
  "data-testid": "sticky-sentinel-top"
@@ -50,9 +50,11 @@ var ResizableTableContainer = function ResizableTableContainer(_ref2) {
50
50
  editorView = _ref2.editorView,
51
51
  getPos = _ref2.getPos,
52
52
  tableRef = _ref2.tableRef,
53
+ isResizing = _ref2.isResizing,
53
54
  pluginInjectionApi = _ref2.pluginInjectionApi;
54
55
  var containerRef = (0, _react.useRef)(null);
55
56
  var marginLeftRef = (0, _react.useRef)(0);
57
+ var tableWidthRef = (0, _react.useRef)(_editorSharedStyles.akEditorDefaultLayoutWidth);
56
58
  var updateWidth = (0, _react.useCallback)(function (width) {
57
59
  if (!containerRef.current) {
58
60
  return;
@@ -87,12 +89,15 @@ var ResizableTableContainer = function ResizableTableContainer(_ref2) {
87
89
  // 76 is currently an accepted padding value considering the spacing for resizer handle
88
90
  var responsiveContainerWidth = containerWidth - 76;
89
91
  var width = Math.min(tableWidth, responsiveContainerWidth);
90
- marginLeftRef.current = getMarginLeft(lineLength, width);
92
+ if (!isResizing) {
93
+ tableWidthRef.current = width;
94
+ marginLeftRef.current = getMarginLeft(lineLength, width);
95
+ }
91
96
  var maxResizerWidth = Math.min(responsiveContainerWidth, _utils.TABLE_MAX_WIDTH);
92
97
  return /*#__PURE__*/_react.default.createElement("div", {
93
98
  style: {
94
99
  marginLeft: marginLeftRef.current,
95
- width: width
100
+ width: tableWidthRef.current
96
101
  },
97
102
  className: _types.TableCssClassName.TABLE_RESIZER_CONTAINER,
98
103
  ref: containerRef
@@ -126,6 +131,7 @@ var TableContainer = function TableContainer(_ref3) {
126
131
  getPos = _ref3.getPos,
127
132
  tableRef = _ref3.tableRef,
128
133
  isNested = _ref3.isNested,
134
+ isResizing = _ref3.isResizing,
129
135
  pluginInjectionApi = _ref3.pluginInjectionApi;
130
136
  if (isTableResizingEnabled && !isNested) {
131
137
  return /*#__PURE__*/_react.default.createElement(ResizableTableContainer, {
@@ -136,6 +142,7 @@ var TableContainer = function TableContainer(_ref3) {
136
142
  editorView: editorView,
137
143
  getPos: getPos,
138
144
  tableRef: tableRef,
145
+ isResizing: isResizing,
139
146
  pluginInjectionApi: pluginInjectionApi
140
147
  }, children);
141
148
  }
@@ -14,6 +14,7 @@ var _guideline = require("@atlaskit/editor-common/guideline");
14
14
  var _resizer = require("@atlaskit/editor-common/resizer");
15
15
  var _styles = require("@atlaskit/editor-common/styles");
16
16
  var _utils = require("@atlaskit/editor-tables/utils");
17
+ var _pluginFactory = require("../pm-plugins/plugin-factory");
17
18
  var _utils2 = require("../pm-plugins/table-resizing/utils");
18
19
  var _tableWidth = require("../pm-plugins/table-width");
19
20
  var _consts = require("../ui/consts");
@@ -86,6 +87,8 @@ var TableResizer = function TableResizer(_ref) {
86
87
  setSnappingEnabled = _useState2[1];
87
88
  var resizerMinWidth = getResizerMinWidth(node);
88
89
  var handleHeightSize = getResizerHandleHeight(tableRef);
90
+ var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
91
+ isInDanger = _getPluginState.isInDanger;
89
92
  var _useMeasureFramerate = (0, _analytics.useMeasureFramerate)(),
90
93
  startMeasure = _useMeasureFramerate.startMeasure,
91
94
  endMeasure = _useMeasureFramerate.endMeasure,
@@ -213,7 +216,8 @@ var TableResizer = function TableResizer(_ref) {
213
216
  handlePositioning: "adjacent",
214
217
  innerPadding: tableHandlePosition,
215
218
  isHandleVisible: ((_findTable = (0, _utils.findTable)((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
216
- handleComponent: handleComponent
219
+ handleComponent: handleComponent,
220
+ appearance: isInDanger ? 'danger' : undefined
217
221
  }, children);
218
222
  };
219
223
  exports.TableResizer = TableResizer;
@@ -96,7 +96,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
96
96
  }, {
97
97
  key: "setDomAttrs",
98
98
  value: function setDomAttrs(node) {
99
- var _this2 = this;
99
+ var _this2 = this,
100
+ _tableWidthPluginKey$;
100
101
  if (!this.table) {
101
102
  return;
102
103
  }
@@ -107,7 +108,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
107
108
 
108
109
  // handle inline style when table been resized
109
110
  var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
110
- if (tableInlineWidth) {
111
+ var isTableResizing = (_tableWidthPluginKey$ = _tableWidth.pluginKey.getState(this.view.state)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
112
+ if (!isTableResizing && tableInlineWidth) {
111
113
  handleInlineTableWidth(this.table, tableInlineWidth);
112
114
  }
113
115
  }
@@ -312,7 +312,9 @@ class TableComponent extends React.Component {
312
312
  view,
313
313
  getNode,
314
314
  isMediaFullscreen,
315
- allowColumnResizing
315
+ allowColumnResizing,
316
+ isResizing,
317
+ options
316
318
  } = this.props;
317
319
  const {
318
320
  isInDanger
@@ -343,7 +345,10 @@ class TableComponent extends React.Component {
343
345
  const {
344
346
  view
345
347
  } = this.props;
346
- recreateResizeColsByNode(this.table, currentTable);
348
+ const shouldRecreateResizeCols = !(options !== null && options !== void 0 && options.isTableResizingEnabled) || !isResizing || tablesHaveDifferentNoOfColumns(currentTable, previousTable) && isResizing;
349
+ if (shouldRecreateResizeCols) {
350
+ recreateResizeColsByNode(this.table, currentTable);
351
+ }
347
352
  updateControls()(view.state);
348
353
  }
349
354
  this.handleTableResizingDebounced();
@@ -418,7 +423,8 @@ class TableComponent extends React.Component {
418
423
  isBreakoutEnabled: options === null || options === void 0 ? void 0 : options.isBreakoutEnabled,
419
424
  isNested: isNested,
420
425
  pluginInjectionApi: pluginInjectionApi,
421
- isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled
426
+ isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled,
427
+ isResizing: isResizing
422
428
  }, /*#__PURE__*/React.createElement("div", {
423
429
  className: ClassName.TABLE_STICKY_SENTINEL_TOP,
424
430
  "data-testid": "sticky-sentinel-top"
@@ -2,7 +2,7 @@ import React, { forwardRef, useCallback, useRef } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
4
4
  import { calcTableWidth } from '@atlaskit/editor-common/styles';
5
- import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
5
+ import { akEditorDefaultLayoutWidth, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
6
6
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
7
7
  import { TableCssClassName as ClassName } from '../types';
8
8
  import { TableResizer } from './TableResizer';
@@ -40,10 +40,12 @@ export const ResizableTableContainer = ({
40
40
  editorView,
41
41
  getPos,
42
42
  tableRef,
43
+ isResizing,
43
44
  pluginInjectionApi
44
45
  }) => {
45
46
  const containerRef = useRef(null);
46
47
  const marginLeftRef = useRef(0);
48
+ const tableWidthRef = useRef(akEditorDefaultLayoutWidth);
47
49
  const updateWidth = useCallback(width => {
48
50
  if (!containerRef.current) {
49
51
  return;
@@ -78,12 +80,15 @@ export const ResizableTableContainer = ({
78
80
  // 76 is currently an accepted padding value considering the spacing for resizer handle
79
81
  const responsiveContainerWidth = containerWidth - 76;
80
82
  const width = Math.min(tableWidth, responsiveContainerWidth);
81
- marginLeftRef.current = getMarginLeft(lineLength, width);
83
+ if (!isResizing) {
84
+ tableWidthRef.current = width;
85
+ marginLeftRef.current = getMarginLeft(lineLength, width);
86
+ }
82
87
  const maxResizerWidth = Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
83
88
  return /*#__PURE__*/React.createElement("div", {
84
89
  style: {
85
90
  marginLeft: marginLeftRef.current,
86
- width
91
+ width: tableWidthRef.current
87
92
  },
88
93
  className: ClassName.TABLE_RESIZER_CONTAINER,
89
94
  ref: containerRef
@@ -117,6 +122,7 @@ export const TableContainer = ({
117
122
  getPos,
118
123
  tableRef,
119
124
  isNested,
125
+ isResizing,
120
126
  pluginInjectionApi
121
127
  }) => {
122
128
  if (isTableResizingEnabled && !isNested) {
@@ -128,6 +134,7 @@ export const TableContainer = ({
128
134
  editorView: editorView,
129
135
  getPos: getPos,
130
136
  tableRef: tableRef,
137
+ isResizing: isResizing,
131
138
  pluginInjectionApi: pluginInjectionApi
132
139
  }, children);
133
140
  }
@@ -4,6 +4,7 @@ import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
4
4
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
5
5
  import { resizerHandleShadowClassName } from '@atlaskit/editor-common/styles';
6
6
  import { findTable } from '@atlaskit/editor-tables/utils';
7
+ import { getPluginState } from '../pm-plugins/plugin-factory';
7
8
  import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
8
9
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
9
10
  import { TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
@@ -70,6 +71,9 @@ export const TableResizer = ({
70
71
  const [snappingEnabled, setSnappingEnabled] = useState(false);
71
72
  const resizerMinWidth = getResizerMinWidth(node);
72
73
  const handleHeightSize = getResizerHandleHeight(tableRef);
74
+ const {
75
+ isInDanger
76
+ } = getPluginState(editorView.state);
73
77
  const {
74
78
  startMeasure,
75
79
  endMeasure,
@@ -200,6 +204,7 @@ export const TableResizer = ({
200
204
  handlePositioning: "adjacent",
201
205
  innerPadding: tableHandlePosition,
202
206
  isHandleVisible: ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
203
- handleComponent: handleComponent
207
+ handleComponent: handleComponent,
208
+ appearance: isInDanger ? 'danger' : undefined
204
209
  }, children);
205
210
  };
@@ -69,6 +69,7 @@ export default class TableView extends ReactNodeView {
69
69
  return rendered;
70
70
  }
71
71
  setDomAttrs(node) {
72
+ var _tableWidthPluginKey$;
72
73
  if (!this.table) {
73
74
  return;
74
75
  }
@@ -79,7 +80,8 @@ export default class TableView extends ReactNodeView {
79
80
 
80
81
  // handle inline style when table been resized
81
82
  const tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
82
- if (tableInlineWidth) {
83
+ const isTableResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(this.view.state)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
84
+ if (!isTableResizing && tableInlineWidth) {
83
85
  handleInlineTableWidth(this.table, tableInlineWidth);
84
86
  }
85
87
  }
@@ -313,7 +313,9 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
313
313
  view = _this$props8.view,
314
314
  getNode = _this$props8.getNode,
315
315
  isMediaFullscreen = _this$props8.isMediaFullscreen,
316
- allowColumnResizing = _this$props8.allowColumnResizing;
316
+ allowColumnResizing = _this$props8.allowColumnResizing,
317
+ isResizing = _this$props8.isResizing,
318
+ options = _this$props8.options;
317
319
  var _getPluginState = getPluginState(view.state),
318
320
  isInDanger = _getPluginState.isInDanger;
319
321
  var table = findTable(view.state.selection);
@@ -340,7 +342,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
340
342
  var previousTable = this.node;
341
343
  if (tablesHaveDifferentColumnWidths(currentTable, previousTable) || tablesHaveDifferentNoOfColumns(currentTable, previousTable)) {
342
344
  var _view = this.props.view;
343
- recreateResizeColsByNode(this.table, currentTable);
345
+ var shouldRecreateResizeCols = !(options !== null && options !== void 0 && options.isTableResizingEnabled) || !isResizing || tablesHaveDifferentNoOfColumns(currentTable, previousTable) && isResizing;
346
+ if (shouldRecreateResizeCols) {
347
+ recreateResizeColsByNode(this.table, currentTable);
348
+ }
344
349
  updateControls()(_view.state);
345
350
  }
346
351
  this.handleTableResizingDebounced();
@@ -414,7 +419,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
414
419
  isBreakoutEnabled: options === null || options === void 0 ? void 0 : options.isBreakoutEnabled,
415
420
  isNested: isNested,
416
421
  pluginInjectionApi: pluginInjectionApi,
417
- isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled
422
+ isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled,
423
+ isResizing: isResizing
418
424
  }, /*#__PURE__*/React.createElement("div", {
419
425
  className: ClassName.TABLE_STICKY_SENTINEL_TOP,
420
426
  "data-testid": "sticky-sentinel-top"
@@ -2,7 +2,7 @@ import React, { forwardRef, useCallback, useRef } from 'react';
2
2
  import classNames from 'classnames';
3
3
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
4
4
  import { calcTableWidth } from '@atlaskit/editor-common/styles';
5
- import { akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
5
+ import { akEditorDefaultLayoutWidth, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
6
6
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
7
7
  import { TableCssClassName as ClassName } from '../types';
8
8
  import { TableResizer } from './TableResizer';
@@ -39,9 +39,11 @@ export var ResizableTableContainer = function ResizableTableContainer(_ref2) {
39
39
  editorView = _ref2.editorView,
40
40
  getPos = _ref2.getPos,
41
41
  tableRef = _ref2.tableRef,
42
+ isResizing = _ref2.isResizing,
42
43
  pluginInjectionApi = _ref2.pluginInjectionApi;
43
44
  var containerRef = useRef(null);
44
45
  var marginLeftRef = useRef(0);
46
+ var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
45
47
  var updateWidth = useCallback(function (width) {
46
48
  if (!containerRef.current) {
47
49
  return;
@@ -76,12 +78,15 @@ export var ResizableTableContainer = function ResizableTableContainer(_ref2) {
76
78
  // 76 is currently an accepted padding value considering the spacing for resizer handle
77
79
  var responsiveContainerWidth = containerWidth - 76;
78
80
  var width = Math.min(tableWidth, responsiveContainerWidth);
79
- marginLeftRef.current = getMarginLeft(lineLength, width);
81
+ if (!isResizing) {
82
+ tableWidthRef.current = width;
83
+ marginLeftRef.current = getMarginLeft(lineLength, width);
84
+ }
80
85
  var maxResizerWidth = Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
81
86
  return /*#__PURE__*/React.createElement("div", {
82
87
  style: {
83
88
  marginLeft: marginLeftRef.current,
84
- width: width
89
+ width: tableWidthRef.current
85
90
  },
86
91
  className: ClassName.TABLE_RESIZER_CONTAINER,
87
92
  ref: containerRef
@@ -114,6 +119,7 @@ export var TableContainer = function TableContainer(_ref3) {
114
119
  getPos = _ref3.getPos,
115
120
  tableRef = _ref3.tableRef,
116
121
  isNested = _ref3.isNested,
122
+ isResizing = _ref3.isResizing,
117
123
  pluginInjectionApi = _ref3.pluginInjectionApi;
118
124
  if (isTableResizingEnabled && !isNested) {
119
125
  return /*#__PURE__*/React.createElement(ResizableTableContainer, {
@@ -124,6 +130,7 @@ export var TableContainer = function TableContainer(_ref3) {
124
130
  editorView: editorView,
125
131
  getPos: getPos,
126
132
  tableRef: tableRef,
133
+ isResizing: isResizing,
127
134
  pluginInjectionApi: pluginInjectionApi
128
135
  }, children);
129
136
  }
@@ -8,6 +8,7 @@ import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
8
8
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
9
9
  import { resizerHandleShadowClassName } from '@atlaskit/editor-common/styles';
10
10
  import { findTable } from '@atlaskit/editor-tables/utils';
11
+ import { getPluginState } from '../pm-plugins/plugin-factory';
11
12
  import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
12
13
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
13
14
  import { TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '../ui/consts';
@@ -76,6 +77,8 @@ export var TableResizer = function TableResizer(_ref) {
76
77
  setSnappingEnabled = _useState2[1];
77
78
  var resizerMinWidth = getResizerMinWidth(node);
78
79
  var handleHeightSize = getResizerHandleHeight(tableRef);
80
+ var _getPluginState = getPluginState(editorView.state),
81
+ isInDanger = _getPluginState.isInDanger;
79
82
  var _useMeasureFramerate = useMeasureFramerate(),
80
83
  startMeasure = _useMeasureFramerate.startMeasure,
81
84
  endMeasure = _useMeasureFramerate.endMeasure,
@@ -203,6 +206,7 @@ export var TableResizer = function TableResizer(_ref) {
203
206
  handlePositioning: "adjacent",
204
207
  innerPadding: tableHandlePosition,
205
208
  isHandleVisible: ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
206
- handleComponent: handleComponent
209
+ handleComponent: handleComponent,
210
+ appearance: isInDanger ? 'danger' : undefined
207
211
  }, children);
208
212
  };
@@ -89,7 +89,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
89
89
  }, {
90
90
  key: "setDomAttrs",
91
91
  value: function setDomAttrs(node) {
92
- var _this2 = this;
92
+ var _this2 = this,
93
+ _tableWidthPluginKey$;
93
94
  if (!this.table) {
94
95
  return;
95
96
  }
@@ -100,7 +101,8 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
100
101
 
101
102
  // handle inline style when table been resized
102
103
  var tableInlineWidth = getInlineWidth(node, this.reactComponentProps.options, this.view.state, this.getPos());
103
- if (tableInlineWidth) {
104
+ var isTableResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(this.view.state)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
105
+ if (!isTableResizing && tableInlineWidth) {
104
106
  handleInlineTableWidth(this.table, tableInlineWidth);
105
107
  }
106
108
  }
@@ -23,9 +23,10 @@ type ResizableTableContainerProps = {
23
23
  editorView: EditorView;
24
24
  getPos: () => number | undefined;
25
25
  tableRef: HTMLTableElement;
26
+ isResizing?: boolean;
26
27
  pluginInjectionApi?: PluginInjectionAPI;
27
28
  };
28
- export declare const ResizableTableContainer: ({ children, className, node, lineLength, containerWidth, editorView, getPos, tableRef, pluginInjectionApi, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element;
29
+ export declare const ResizableTableContainer: ({ children, className, node, lineLength, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element;
29
30
  type TableContainerProps = {
30
31
  node: PMNode;
31
32
  className: string;
@@ -36,7 +37,8 @@ type TableContainerProps = {
36
37
  getPos: () => number | undefined;
37
38
  tableRef: HTMLTableElement;
38
39
  isNested: boolean;
40
+ isResizing?: boolean;
39
41
  pluginInjectionApi?: PluginInjectionAPI;
40
42
  };
41
- export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, pluginInjectionApi, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
43
+ export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, isResizing, pluginInjectionApi, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
42
44
  export {};
@@ -3,10 +3,10 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
4
4
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
5
5
  import type { GetEditorContainerWidth, GetEditorFeatureFlags, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
6
- import { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
7
- import { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
8
- import { PluginInjectionAPI } from '../types';
9
- import { Props, TableOptions } from './types';
6
+ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
7
+ import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
8
+ import type { PluginInjectionAPI } from '../types';
9
+ import type { Props, TableOptions } from './types';
10
10
  type ForwardRef = (node: HTMLElement | null) => void;
11
11
  export default class TableView extends ReactNodeView<Props> {
12
12
  private table;
@@ -23,9 +23,10 @@ type ResizableTableContainerProps = {
23
23
  editorView: EditorView;
24
24
  getPos: () => number | undefined;
25
25
  tableRef: HTMLTableElement;
26
+ isResizing?: boolean;
26
27
  pluginInjectionApi?: PluginInjectionAPI;
27
28
  };
28
- export declare const ResizableTableContainer: ({ children, className, node, lineLength, containerWidth, editorView, getPos, tableRef, pluginInjectionApi, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element;
29
+ export declare const ResizableTableContainer: ({ children, className, node, lineLength, containerWidth, editorView, getPos, tableRef, isResizing, pluginInjectionApi, }: PropsWithChildren<ResizableTableContainerProps>) => JSX.Element;
29
30
  type TableContainerProps = {
30
31
  node: PMNode;
31
32
  className: string;
@@ -36,7 +37,8 @@ type TableContainerProps = {
36
37
  getPos: () => number | undefined;
37
38
  tableRef: HTMLTableElement;
38
39
  isNested: boolean;
40
+ isResizing?: boolean;
39
41
  pluginInjectionApi?: PluginInjectionAPI;
40
42
  };
41
- export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, pluginInjectionApi, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
43
+ export declare const TableContainer: ({ children, node, className, containerWidth: { lineLength, width: editorWidth }, isTableResizingEnabled, isBreakoutEnabled, editorView, getPos, tableRef, isNested, isResizing, pluginInjectionApi, }: PropsWithChildren<TableContainerProps>) => JSX.Element;
42
44
  export {};
@@ -3,10 +3,10 @@ import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
3
  import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
4
4
  import ReactNodeView from '@atlaskit/editor-common/react-node-view';
5
5
  import type { GetEditorContainerWidth, GetEditorFeatureFlags, getPosHandler, getPosHandlerNode } from '@atlaskit/editor-common/types';
6
- import { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
7
- import { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
8
- import { PluginInjectionAPI } from '../types';
9
- import { Props, TableOptions } from './types';
6
+ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
7
+ import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
8
+ import type { PluginInjectionAPI } from '../types';
9
+ import type { Props, TableOptions } from './types';
10
10
  type ForwardRef = (node: HTMLElement | null) => void;
11
11
  export default class TableView extends ReactNodeView<Props> {
12
12
  private table;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@atlaskit/adf-schema": "^28.1.0",
31
- "@atlaskit/editor-common": "^74.47.0",
31
+ "@atlaskit/editor-common": "^74.49.0",
32
32
  "@atlaskit/editor-palette": "1.5.1",
33
33
  "@atlaskit/editor-plugin-analytics": "^0.1.0",
34
34
  "@atlaskit/editor-plugin-content-insertion": "^0.0.8",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/icon": "^21.12.0",
39
39
  "@atlaskit/platform-feature-flags": "^0.2.1",
40
40
  "@atlaskit/theme": "^12.5.0",
41
- "@atlaskit/tokens": "^1.14.0",
41
+ "@atlaskit/tokens": "^1.15.0",
42
42
  "@atlaskit/tooltip": "^17.8.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1",
@@ -4,15 +4,15 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
4
4
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
5
5
  import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
6
6
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
7
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
+ import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
+ import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
8
9
  import {
9
10
  createProsemirrorEditorFactory,
10
- LightEditorPlugin,
11
11
  Preset,
12
12
  } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
13
+ import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
13
14
  import {
14
15
  doc,
15
- DocBuilder,
16
16
  p,
17
17
  table,
18
18
  td,
@@ -24,7 +24,7 @@ import {
24
24
  import tablePlugin from '../../../plugins/table';
25
25
  import { goToNextCell } from '../../../plugins/table/commands/go-to-next-cell';
26
26
  import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
27
- import { TablePluginState } from '../../../plugins/table/types';
27
+ import type { TablePluginState } from '../../../plugins/table/types';
28
28
 
29
29
  const TABLE_LOCAL_ID = 'test-table-local-id';
30
30
 
@@ -43,7 +43,7 @@ describe('table plugin: goToNextCell', () => {
43
43
  .add(guidelinePlugin)
44
44
  .add(tablePlugin);
45
45
  const editor = (doc: DocBuilder) =>
46
- createEditor<TablePluginState, PluginKey>({
46
+ createEditor<TablePluginState, PluginKey, typeof preset>({
47
47
  doc,
48
48
  preset,
49
49
  pluginKey,
@@ -4,15 +4,15 @@ import { contentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertio
4
4
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
5
5
  import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
6
6
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
7
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
+ import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
+ import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
8
9
  import {
9
10
  createProsemirrorEditorFactory,
10
- LightEditorPlugin,
11
11
  Preset,
12
12
  } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
13
+ import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
13
14
  import {
14
15
  doc,
15
- DocBuilder,
16
16
  p,
17
17
  table,
18
18
  td,
@@ -23,7 +23,7 @@ import {
23
23
  import tablePlugin from '../../../plugins/table';
24
24
  import { addColumnAt } from '../../../plugins/table/commands/insert';
25
25
  import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
26
- import { TablePluginState } from '../../../plugins/table/types';
26
+ import type { TablePluginState } from '../../../plugins/table/types';
27
27
 
28
28
  const TABLE_LOCAL_ID = 'test-table-local-id';
29
29
 
@@ -54,7 +54,7 @@ describe('table plugin: insert', () => {
54
54
  ]);
55
55
 
56
56
  const editor = (doc: DocBuilder) =>
57
- createEditor<TablePluginState, PluginKey>({
57
+ createEditor<TablePluginState, PluginKey, typeof preset>({
58
58
  doc,
59
59
  preset,
60
60
  pluginKey,
@@ -4,16 +4,16 @@ import { decorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
4
  import featureFlagsPlugin from '@atlaskit/editor-plugin-feature-flags';
5
5
  import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
6
6
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
7
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
+ import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
8
8
  import { isColumnSelected } from '@atlaskit/editor-tables/utils';
9
+ import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
9
10
  import {
10
11
  createProsemirrorEditorFactory,
11
- LightEditorPlugin,
12
12
  Preset,
13
13
  } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
14
+ import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
14
15
  import {
15
16
  doc,
16
- DocBuilder,
17
17
  p,
18
18
  table,
19
19
  td,
@@ -29,10 +29,8 @@ import {
29
29
  import { getDecorations } from '../../../plugins/table/pm-plugins/decorations/plugin';
30
30
  import { getPluginState } from '../../../plugins/table/pm-plugins/plugin-factory';
31
31
  import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
32
- import {
33
- TableDecorations,
34
- TablePluginState,
35
- } from '../../../plugins/table/types';
32
+ import type { TablePluginState } from '../../../plugins/table/types';
33
+ import { TableDecorations } from '../../../plugins/table/types';
36
34
 
37
35
  describe('table plugin: commands', () => {
38
36
  const createEditor = createProsemirrorEditorFactory();
@@ -50,7 +48,7 @@ describe('table plugin: commands', () => {
50
48
  },
51
49
  ]);
52
50
  const editor = (doc: DocBuilder) =>
53
- createEditor<TablePluginState, PluginKey>({
51
+ createEditor<TablePluginState, PluginKey, typeof preset>({
54
52
  doc,
55
53
  preset,
56
54
  pluginKey,