@atlaskit/editor-plugin-table 5.3.23 → 5.3.25

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 (72) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/nodeviews/TableRow.js +1 -1
  3. package/dist/cjs/plugins/table/pm-plugins/drag-and-drop/plugin.js +1 -1
  4. package/dist/cjs/plugins/table/pm-plugins/keymap.js +1 -1
  5. package/dist/cjs/plugins/table/transforms/column-width.js +10 -43
  6. package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +1 -1
  7. package/dist/es2019/plugins/table/nodeviews/TableRow.js +1 -1
  8. package/dist/es2019/plugins/table/pm-plugins/drag-and-drop/plugin.js +1 -1
  9. package/dist/es2019/plugins/table/pm-plugins/keymap.js +1 -1
  10. package/dist/es2019/plugins/table/transforms/column-width.js +10 -43
  11. package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +1 -1
  12. package/dist/esm/plugins/table/nodeviews/TableRow.js +1 -1
  13. package/dist/esm/plugins/table/pm-plugins/drag-and-drop/plugin.js +1 -1
  14. package/dist/esm/plugins/table/pm-plugins/keymap.js +1 -1
  15. package/dist/esm/plugins/table/transforms/column-width.js +10 -43
  16. package/dist/esm/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +1 -1
  17. package/package.json +3 -6
  18. package/src/__tests__/unit/analytics.ts +2 -1
  19. package/src/__tests__/unit/collab.ts +2 -1
  20. package/src/__tests__/unit/commands/go-to-next-cell.ts +1 -0
  21. package/src/__tests__/unit/commands/insert.ts +1 -0
  22. package/src/__tests__/unit/commands/misc.ts +1 -0
  23. package/src/__tests__/unit/commands/sort.ts +2 -1
  24. package/src/__tests__/unit/commands.ts +1 -0
  25. package/src/__tests__/unit/copy-paste.ts +2 -1
  26. package/src/__tests__/unit/event-handlers/index.ts +2 -1
  27. package/src/__tests__/unit/event-handlers.ts +2 -1
  28. package/src/__tests__/unit/fix-tables.ts +2 -1
  29. package/src/__tests__/unit/get-toolbar-config.ts +1 -0
  30. package/src/__tests__/unit/handlers.ts +2 -1
  31. package/src/__tests__/unit/hover-selection.ts +2 -1
  32. package/src/__tests__/unit/index.ts +2 -1
  33. package/src/__tests__/unit/layout.ts +2 -1
  34. package/src/__tests__/unit/nodeviews/TableComponent.tsx +1 -1
  35. package/src/__tests__/unit/nodeviews/TableContainer.tsx +1 -1
  36. package/src/__tests__/unit/nodeviews/cell.ts +2 -1
  37. package/src/__tests__/unit/nodeviews/table.ts +1 -0
  38. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +1 -0
  39. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +1 -0
  40. package/src/__tests__/unit/pm-plugins/main.ts +1 -0
  41. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +2 -1
  42. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +1 -0
  43. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +1 -0
  44. package/src/__tests__/unit/pm-plugins/table-width.ts +2 -1
  45. package/src/__tests__/unit/sort-column.ts +2 -1
  46. package/src/__tests__/unit/toolbar.ts +1 -0
  47. package/src/__tests__/unit/transforms/delete-columns.ts +2 -1
  48. package/src/__tests__/unit/transforms/delete-rows.ts +2 -1
  49. package/src/__tests__/unit/transforms/merging.ts +2 -1
  50. package/src/__tests__/unit/ui/ContextualMenu.tsx +2 -1
  51. package/src/__tests__/unit/ui/CornerControls.tsx +2 -1
  52. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +2 -1
  53. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +2 -1
  54. package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +1 -1
  55. package/src/__tests__/unit/ui/FloatingDragMenu.tsx +2 -1
  56. package/src/__tests__/unit/ui/FloatingInsertButton.tsx +1 -1
  57. package/src/__tests__/unit/ui/NumberColumn.tsx +2 -1
  58. package/src/__tests__/unit/ui/RowControls.tsx +2 -1
  59. package/src/__tests__/unit/ui/RowDragControls.tsx +2 -1
  60. package/src/__tests__/unit/ui/TableFloatingColumnControls.tsx +2 -1
  61. package/src/__tests__/unit/ui/TableFloatingControls.tsx +2 -1
  62. package/src/__tests__/unit/undo-redo.ts +1 -0
  63. package/src/__tests__/unit/utils/collapse.ts +1 -0
  64. package/src/__tests__/unit/utils/nodes.ts +2 -1
  65. package/src/__tests__/unit/utils/row-controls.ts +2 -1
  66. package/src/__tests__/unit/utils.ts +1 -0
  67. package/src/plugins/table/nodeviews/TableRow.ts +1 -1
  68. package/src/plugins/table/pm-plugins/drag-and-drop/plugin.ts +1 -1
  69. package/src/plugins/table/pm-plugins/drag-and-drop/utils/monitor.ts +1 -1
  70. package/src/plugins/table/pm-plugins/keymap.ts +4 -4
  71. package/src/plugins/table/transforms/column-width.ts +14 -60
  72. package/src/plugins/table/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 5.3.25
4
+
5
+ ### Patch Changes
6
+
7
+ - [#42925](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42925) [`8ea16423505`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8ea16423505) - Removes FF platform.editor.update-table-cell-width-via-step
8
+
9
+ ## 5.3.24
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 5.3.23
4
16
 
5
17
  ### Patch Changes
@@ -16,8 +16,8 @@ var _debounce = _interopRequireDefault(require("lodash/debounce"));
16
16
  var _throttle = _interopRequireDefault(require("lodash/throttle"));
17
17
  var _ui = require("@atlaskit/editor-common/ui");
18
18
  var _utils = require("@atlaskit/editor-common/utils");
19
- var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge");
20
19
  var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
20
+ var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge");
21
21
  var _pluginFactory = require("../pm-plugins/plugin-factory");
22
22
  var _pluginKey = require("../pm-plugins/plugin-key");
23
23
  var _commands = require("../pm-plugins/sticky-headers/commands");
@@ -9,8 +9,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
10
  var _view = require("@atlaskit/editor-prosemirror/view");
11
11
  var _utils = require("@atlaskit/editor-tables/utils");
12
- var _pragmaticDragAndDropReactBeautifulDndAutoscroll = require("@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll");
13
12
  var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
13
+ var _pragmaticDragAndDropReactBeautifulDndAutoscroll = require("@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll");
14
14
  var _mergedCells = require("../../utils/merged-cells");
15
15
  var _pluginFactory = require("../plugin-factory");
16
16
  var _actions = require("./actions");
@@ -10,8 +10,8 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
10
10
  var _commands = require("@atlaskit/editor-prosemirror/commands");
11
11
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
12
12
  var _commands2 = require("../commands");
13
- var _commandsWithAnalytics = require("../commands-with-analytics");
14
13
  var _insert = require("../commands/insert");
14
+ var _commandsWithAnalytics = require("../commands-with-analytics");
15
15
  var _analytics2 = require("../utils/analytics");
16
16
  var createTableWithAnalytics = function createTableWithAnalytics(editorAnalyticsAPI) {
17
17
  return (0, _analytics2.withEditorAnalyticsAPI)({
@@ -67,52 +67,19 @@ var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidth
67
67
  }
68
68
 
69
69
  // updating all cells with new attributes
70
- if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.update-table-cell-width-via-step')) {
71
- var seen = {};
72
- for (var _rowIndex = 0; _rowIndex < map.height; _rowIndex++) {
73
- for (var _columnIndex = 0; _columnIndex < map.width; _columnIndex++) {
74
- var _mapIndex = _rowIndex * map.width + _columnIndex;
75
- var pos = map.map[_mapIndex];
76
- var cell = table.nodeAt(pos);
77
- if (!seen[pos] && cell) {
78
- if (updatedCellsAttrs[pos]) {
79
- tr.step(new _transform.AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
80
- }
81
- seen[pos] = true;
70
+ var seen = {};
71
+ for (var _rowIndex = 0; _rowIndex < map.height; _rowIndex++) {
72
+ for (var _columnIndex = 0; _columnIndex < map.width; _columnIndex++) {
73
+ var _mapIndex = _rowIndex * map.width + _columnIndex;
74
+ var pos = map.map[_mapIndex];
75
+ var cell = table.nodeAt(pos);
76
+ if (!seen[pos] && cell) {
77
+ if (updatedCellsAttrs[pos]) {
78
+ tr.step(new _transform.AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
82
79
  }
80
+ seen[pos] = true;
83
81
  }
84
82
  }
85
- } else {
86
- var rows = [];
87
- var _seen = {};
88
- for (var _rowIndex2 = 0; _rowIndex2 < map.height; _rowIndex2++) {
89
- var row = table.child(_rowIndex2);
90
- var cells = [];
91
- for (var _columnIndex2 = 0; _columnIndex2 < map.width; _columnIndex2++) {
92
- var _mapIndex2 = _rowIndex2 * map.width + _columnIndex2;
93
- var _pos = map.map[_mapIndex2];
94
- var _cell = table.nodeAt(_pos);
95
- if (!_seen[_pos] && _cell) {
96
- cells.push(_cell.type.createChecked(updatedCellsAttrs[_pos] || _cell.attrs, _cell.content, _cell.marks));
97
- _seen[_pos] = true;
98
- }
99
- }
100
- rows.push(row.type.createChecked(row.attrs, cells, row.marks));
101
- }
102
- var tablePos = start - 1;
103
- var selectionBookmark = tr.selection.getBookmark();
104
- tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
105
- /**
106
- * We want to restore to the original selection but w/o applying the mapping. Function
107
- * tr.replaceWith puts the selection after the inserted content. We need to manually
108
- * set the selection back to original state. Mapping in this case doesn't quite work
109
- * e.g. if we change the content before a selection. This is because mapping
110
- * means moving it if the content in front of it changed. Instead we can get
111
- * bookmark of selection.
112
- *
113
- * @see https://github.com/ProseMirror/prosemirror/issues/645
114
- */
115
- tr.setSelection(selectionBookmark.resolve(tr.doc));
116
83
  }
117
84
  return tr;
118
85
  };
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.ColumnDropTarget = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge");
10
9
  var _element = require("@atlaskit/pragmatic-drag-and-drop/adapter/element");
10
+ var _closestEdge = require("@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge");
11
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
13
  var ColumnDropTarget = exports.ColumnDropTarget = function ColumnDropTarget(_ref) {
@@ -3,8 +3,8 @@ import debounce from 'lodash/debounce';
3
3
  import throttle from 'lodash/throttle';
4
4
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
5
5
  import { browser } from '@atlaskit/editor-common/utils';
6
- import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
7
6
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
7
+ import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
8
8
  import { getPluginState } from '../pm-plugins/plugin-factory';
9
9
  import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
10
10
  import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
@@ -1,8 +1,8 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
3
  import { getCellsInRow } from '@atlaskit/editor-tables/utils';
4
- import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
5
4
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
5
+ import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
6
6
  import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils/merged-cells';
7
7
  import { getPluginState as getTablePluginState } from '../plugin-factory';
8
8
  import { DragAndDropActionType } from './actions';
@@ -3,8 +3,8 @@ import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace,
3
3
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
4
4
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
5
5
  import { createTable, goToNextCell, moveCursorBackward, triggerUnlessTableHeader } from '../commands';
6
- import { addRowAroundSelection, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
7
6
  import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
7
+ import { addRowAroundSelection, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
8
8
  import { withEditorAnalyticsAPI } from '../utils/analytics';
9
9
  const createTableWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI({
10
10
  action: ACTION.INSERTED,
@@ -60,52 +60,19 @@ export const updateColumnWidths = (resizeState, table, start) => tr => {
60
60
  }
61
61
 
62
62
  // updating all cells with new attributes
63
- if (getBooleanFF('platform.editor.update-table-cell-width-via-step')) {
64
- const seen = {};
65
- for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
66
- for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
67
- const mapIndex = rowIndex * map.width + columnIndex;
68
- const pos = map.map[mapIndex];
69
- const cell = table.nodeAt(pos);
70
- if (!seen[pos] && cell) {
71
- if (updatedCellsAttrs[pos]) {
72
- tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
73
- }
74
- seen[pos] = true;
75
- }
76
- }
77
- }
78
- } else {
79
- const rows = [];
80
- const seen = {};
81
- for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
82
- const row = table.child(rowIndex);
83
- const cells = [];
84
- for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
85
- const mapIndex = rowIndex * map.width + columnIndex;
86
- const pos = map.map[mapIndex];
87
- const cell = table.nodeAt(pos);
88
- if (!seen[pos] && cell) {
89
- cells.push(cell.type.createChecked(updatedCellsAttrs[pos] || cell.attrs, cell.content, cell.marks));
90
- seen[pos] = true;
63
+ const seen = {};
64
+ for (let rowIndex = 0; rowIndex < map.height; rowIndex++) {
65
+ for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
66
+ const mapIndex = rowIndex * map.width + columnIndex;
67
+ const pos = map.map[mapIndex];
68
+ const cell = table.nodeAt(pos);
69
+ if (!seen[pos] && cell) {
70
+ if (updatedCellsAttrs[pos]) {
71
+ tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
91
72
  }
73
+ seen[pos] = true;
92
74
  }
93
- rows.push(row.type.createChecked(row.attrs, cells, row.marks));
94
75
  }
95
- const tablePos = start - 1;
96
- const selectionBookmark = tr.selection.getBookmark();
97
- tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
98
- /**
99
- * We want to restore to the original selection but w/o applying the mapping. Function
100
- * tr.replaceWith puts the selection after the inserted content. We need to manually
101
- * set the selection back to original state. Mapping in this case doesn't quite work
102
- * e.g. if we change the content before a selection. This is because mapping
103
- * means moving it if the content in front of it changed. Instead we can get
104
- * bookmark of selection.
105
- *
106
- * @see https://github.com/ProseMirror/prosemirror/issues/645
107
- */
108
- tr.setSelection(selectionBookmark.resolve(tr.doc));
109
76
  }
110
77
  return tr;
111
78
  };
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
3
2
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
3
+ import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
4
4
  export const ColumnDropTarget = ({
5
5
  index,
6
6
  localId,
@@ -11,8 +11,8 @@ import debounce from 'lodash/debounce';
11
11
  import throttle from 'lodash/throttle';
12
12
  import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
13
13
  import { browser } from '@atlaskit/editor-common/utils';
14
- import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
15
14
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
15
+ import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
16
16
  import { getPluginState } from '../pm-plugins/plugin-factory';
17
17
  import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
18
18
  import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
@@ -2,8 +2,8 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { getCellsInRow } from '@atlaskit/editor-tables/utils';
5
- import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
6
5
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
6
+ import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
7
7
  import { hasMergedCellsInColumn, hasMergedCellsInRow } from '../../utils/merged-cells';
8
8
  import { getPluginState as getTablePluginState } from '../plugin-factory';
9
9
  import { DragAndDropActionType } from './actions';
@@ -3,8 +3,8 @@ import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace,
3
3
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
4
4
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
5
5
  import { createTable, goToNextCell, moveCursorBackward, triggerUnlessTableHeader } from '../commands';
6
- import { addRowAroundSelection, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
7
6
  import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
7
+ import { addRowAroundSelection, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
8
8
  import { withEditorAnalyticsAPI } from '../utils/analytics';
9
9
  var createTableWithAnalytics = function createTableWithAnalytics(editorAnalyticsAPI) {
10
10
  return withEditorAnalyticsAPI({
@@ -61,52 +61,19 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
61
61
  }
62
62
 
63
63
  // updating all cells with new attributes
64
- if (getBooleanFF('platform.editor.update-table-cell-width-via-step')) {
65
- var seen = {};
66
- for (var _rowIndex = 0; _rowIndex < map.height; _rowIndex++) {
67
- for (var _columnIndex = 0; _columnIndex < map.width; _columnIndex++) {
68
- var _mapIndex = _rowIndex * map.width + _columnIndex;
69
- var pos = map.map[_mapIndex];
70
- var cell = table.nodeAt(pos);
71
- if (!seen[pos] && cell) {
72
- if (updatedCellsAttrs[pos]) {
73
- tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
74
- }
75
- seen[pos] = true;
64
+ var seen = {};
65
+ for (var _rowIndex = 0; _rowIndex < map.height; _rowIndex++) {
66
+ for (var _columnIndex = 0; _columnIndex < map.width; _columnIndex++) {
67
+ var _mapIndex = _rowIndex * map.width + _columnIndex;
68
+ var pos = map.map[_mapIndex];
69
+ var cell = table.nodeAt(pos);
70
+ if (!seen[pos] && cell) {
71
+ if (updatedCellsAttrs[pos]) {
72
+ tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
76
73
  }
74
+ seen[pos] = true;
77
75
  }
78
76
  }
79
- } else {
80
- var rows = [];
81
- var _seen = {};
82
- for (var _rowIndex2 = 0; _rowIndex2 < map.height; _rowIndex2++) {
83
- var row = table.child(_rowIndex2);
84
- var cells = [];
85
- for (var _columnIndex2 = 0; _columnIndex2 < map.width; _columnIndex2++) {
86
- var _mapIndex2 = _rowIndex2 * map.width + _columnIndex2;
87
- var _pos = map.map[_mapIndex2];
88
- var _cell = table.nodeAt(_pos);
89
- if (!_seen[_pos] && _cell) {
90
- cells.push(_cell.type.createChecked(updatedCellsAttrs[_pos] || _cell.attrs, _cell.content, _cell.marks));
91
- _seen[_pos] = true;
92
- }
93
- }
94
- rows.push(row.type.createChecked(row.attrs, cells, row.marks));
95
- }
96
- var tablePos = start - 1;
97
- var selectionBookmark = tr.selection.getBookmark();
98
- tr.replaceWith(tablePos, tablePos + table.nodeSize, table.type.createChecked(table.attrs, rows, table.marks));
99
- /**
100
- * We want to restore to the original selection but w/o applying the mapping. Function
101
- * tr.replaceWith puts the selection after the inserted content. We need to manually
102
- * set the selection back to original state. Mapping in this case doesn't quite work
103
- * e.g. if we change the content before a selection. This is because mapping
104
- * means moving it if the content in front of it changed. Instead we can get
105
- * bookmark of selection.
106
- *
107
- * @see https://github.com/ProseMirror/prosemirror/issues/645
108
- */
109
- tr.setSelection(selectionBookmark.resolve(tr.doc));
110
77
  }
111
78
  return tr;
112
79
  };
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
- import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
3
2
  import { dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
3
+ import { attachClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
4
4
  export var ColumnDropTarget = function ColumnDropTarget(_ref) {
5
5
  var index = _ref.index,
6
6
  localId = _ref.localId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "5.3.23",
3
+ "version": "5.3.25",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -30,7 +30,7 @@
30
30
  "@atlaskit/adf-schema": "^32.0.0",
31
31
  "@atlaskit/custom-steps": "^0.0.2",
32
32
  "@atlaskit/editor-common": "^76.18.0",
33
- "@atlaskit/editor-palette": "1.5.1",
33
+ "@atlaskit/editor-palette": "1.5.2",
34
34
  "@atlaskit/editor-plugin-analytics": "^0.3.0",
35
35
  "@atlaskit/editor-plugin-content-insertion": "^0.1.0",
36
36
  "@atlaskit/editor-plugin-guideline": "^0.5.0",
@@ -44,7 +44,7 @@
44
44
  "@atlaskit/pragmatic-drag-and-drop": "^0.24.0",
45
45
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",
46
46
  "@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^0.6.4",
47
- "@atlaskit/primitives": "^1.9.0",
47
+ "@atlaskit/primitives": "^1.10.0",
48
48
  "@atlaskit/theme": "^12.6.0",
49
49
  "@atlaskit/tokens": "^1.28.0",
50
50
  "@atlaskit/tooltip": "^17.8.0",
@@ -118,9 +118,6 @@
118
118
  "platform.editor.table.column-controls-styles-updated": {
119
119
  "type": "boolean"
120
120
  },
121
- "platform.editor.update-table-cell-width-via-step": {
122
- "type": "boolean"
123
- },
124
121
  "platform.editor.resizing-table-height-improvement": {
125
122
  "type": "boolean"
126
123
  },
@@ -9,6 +9,7 @@ import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
9
9
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
10
10
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
11
11
  import type { Rect } from '@atlaskit/editor-tables/table-map';
12
+ // eslint-disable-next-line import/no-extraneous-dependencies
12
13
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
13
14
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
14
15
  import {
@@ -30,7 +31,6 @@ import {
30
31
  import sendKeyToPm from '@atlaskit/editor-test-helpers/send-key-to-pm';
31
32
  import { B50 } from '@atlaskit/theme/colors';
32
33
 
33
- import tablePlugin from '../../plugins/table-plugin';
34
34
  import {
35
35
  deleteColumnsWithAnalytics,
36
36
  deleteRowsWithAnalytics,
@@ -51,6 +51,7 @@ import { handleCut } from '../../plugins/table/event-handlers';
51
51
  import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
52
52
  import { replaceSelectedTable } from '../../plugins/table/transforms';
53
53
  import type { PluginConfig } from '../../plugins/table/types';
54
+ import tablePlugin from '../../plugins/table-plugin';
54
55
 
55
56
  const defaultTableDoc = doc(
56
57
  table()(
@@ -7,6 +7,7 @@ import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
7
7
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
8
8
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
9
9
  import { removeColumnAt } from '@atlaskit/editor-tables/utils';
10
+ // eslint-disable-next-line import/no-extraneous-dependencies
10
11
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
11
12
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
12
13
  import {
@@ -23,10 +24,10 @@ import {
23
24
  tr,
24
25
  } from '@atlaskit/editor-test-helpers/doc-builder';
25
26
 
26
- import tablePlugin from '../../plugins/table-plugin';
27
27
  import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
28
28
  import { setResizeHandlePos } from '../../plugins/table/pm-plugins/table-resizing/commands';
29
29
  import type { PluginConfig } from '../../plugins/table/types';
30
+ import tablePlugin from '../../plugins/table-plugin';
30
31
 
31
32
  const TABLE_LOCAL_ID = 'test-table-local-id';
32
33
 
@@ -8,6 +8,7 @@ import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
8
8
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
9
9
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
10
10
  import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
11
+ // eslint-disable-next-line import/no-extraneous-dependencies
11
12
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
12
13
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
13
14
  import {
@@ -10,6 +10,7 @@ import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
10
10
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
11
11
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
12
12
  import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
13
+ // eslint-disable-next-line import/no-extraneous-dependencies
13
14
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
14
15
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
15
16
  import {
@@ -9,6 +9,7 @@ import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
9
9
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
10
10
  import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
11
11
  import { isColumnSelected } from '@atlaskit/editor-tables/utils';
12
+ // eslint-disable-next-line import/no-extraneous-dependencies
12
13
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
13
14
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
14
15
  import {
@@ -7,6 +7,7 @@ import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
7
7
  import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
8
8
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
9
9
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
10
+ // eslint-disable-next-line import/no-extraneous-dependencies
10
11
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
11
12
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
12
13
  import {
@@ -23,8 +24,8 @@ import {
23
24
  tr,
24
25
  } from '@atlaskit/editor-test-helpers/doc-builder';
25
26
 
26
- import tablePlugin from '../../../plugins/table-plugin';
27
27
  import { sortByColumn } from '../../../plugins/table/commands/sort';
28
+ import tablePlugin from '../../../plugins/table-plugin';
28
29
 
29
30
  const TABLE_LOCAL_ID = 'test-table-local-id';
30
31
 
@@ -17,6 +17,7 @@ import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
17
17
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
18
18
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
19
19
  import { isRowSelected } from '@atlaskit/editor-tables/utils';
20
+ // eslint-disable-next-line import/no-extraneous-dependencies
20
21
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
21
22
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
22
23
  import {
@@ -28,6 +28,7 @@ import {
28
28
  selectColumn,
29
29
  selectTable,
30
30
  } from '@atlaskit/editor-tables/utils';
31
+ // eslint-disable-next-line import/no-extraneous-dependencies
31
32
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
32
33
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
33
34
  import {
@@ -52,7 +53,6 @@ import {
52
53
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
53
54
  import defaultSchema from '@atlaskit/editor-test-helpers/schema';
54
55
 
55
- import tablePlugin from '../../plugins/table-plugin';
56
56
  import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
57
57
  import type { PluginConfig, TablePluginState } from '../../plugins/table/types';
58
58
  import {
@@ -62,6 +62,7 @@ import {
62
62
  transformSliceToRemoveOpenTable,
63
63
  unwrapContentFromTable,
64
64
  } from '../../plugins/table/utils/paste';
65
+ import tablePlugin from '../../plugins/table-plugin';
65
66
 
66
67
  const TABLE_LOCAL_ID = 'test-table-local-id';
67
68
  const array = (...args: any): Node[] => args.map((i: any) => i(defaultSchema));
@@ -7,6 +7,7 @@ import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
7
7
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
8
8
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
9
9
  import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
10
+ // eslint-disable-next-line import/no-extraneous-dependencies
10
11
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
11
12
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
12
13
  import {
@@ -22,11 +23,11 @@ import {
22
23
  tr,
23
24
  } from '@atlaskit/editor-test-helpers/doc-builder';
24
25
 
25
- import tablePlugin from '../../../plugins/table-plugin';
26
26
  import { whenTableInFocus } from '../../../plugins/table/event-handlers';
27
27
  import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
28
28
  import { setDragging } from '../../../plugins/table/pm-plugins/table-resizing/commands';
29
29
  import type { TablePluginState } from '../../../plugins/table/types';
30
+ import tablePlugin from '../../../plugins/table-plugin';
30
31
 
31
32
  describe('event-handlers', () => {
32
33
  let editor: any;
@@ -9,6 +9,7 @@ import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
9
9
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
10
10
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
11
11
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
12
+ // eslint-disable-next-line import/no-extraneous-dependencies
12
13
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
13
14
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
14
15
  import {
@@ -27,7 +28,6 @@ import {
27
28
  } from '@atlaskit/editor-test-helpers/doc-builder';
28
29
  import { ffTest } from '@atlassian/feature-flags-test-utils';
29
30
 
30
- import tablePlugin from '../../plugins/table-plugin';
31
31
  import {
32
32
  addResizeHandleDecorations,
33
33
  showInsertColumnButton,
@@ -42,6 +42,7 @@ import {
42
42
  import { getPluginState } from '../../plugins/table/pm-plugins/plugin-factory';
43
43
  import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
44
44
  import { TableCssClassName as ClassName } from '../../plugins/table/types';
45
+ import tablePlugin from '../../plugins/table-plugin';
45
46
 
46
47
  describe('table plugin: decorations', () => {
47
48
  const createEditor = createProsemirrorEditorFactory();
@@ -6,6 +6,7 @@ import { featureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
6
6
  import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
7
7
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
8
8
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
9
+ // eslint-disable-next-line import/no-extraneous-dependencies
9
10
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
10
11
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
11
12
  import {
@@ -22,9 +23,9 @@ import {
22
23
  tr,
23
24
  } from '@atlaskit/editor-test-helpers/doc-builder';
24
25
 
25
- import tablePlugin from '../../plugins/table-plugin';
26
26
  import { pluginKey as tablePluginKey } from '../../plugins/table/pm-plugins/plugin-key';
27
27
  import type { PluginConfig } from '../../plugins/table/types';
28
+ import tablePlugin from '../../plugins/table-plugin';
28
29
 
29
30
  const TABLE_LOCAL_ID = 'test-table-local-id';
30
31
 
@@ -14,6 +14,7 @@ import { guidelinePlugin } from '@atlaskit/editor-plugin-guideline';
14
14
  import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
15
15
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
16
16
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
17
+ // eslint-disable-next-line import/no-extraneous-dependencies
17
18
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
18
19
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
19
20
  import {
@@ -7,6 +7,7 @@ import { selectionPlugin } from '@atlaskit/editor-plugin-selection';
7
7
  import { widthPlugin } from '@atlaskit/editor-plugin-width';
8
8
  import type { PluginKey } from '@atlaskit/editor-prosemirror/state';
9
9
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
10
+ // eslint-disable-next-line import/no-extraneous-dependencies
10
11
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
11
12
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
12
13
  import {
@@ -22,11 +23,11 @@ import {
22
23
  tr,
23
24
  } from '@atlaskit/editor-test-helpers/doc-builder';
24
25
 
25
- import tablePlugin from '../../plugins/table-plugin';
26
26
  import { handleDocOrSelectionChanged } from '../../plugins/table/handlers';
27
27
  import { defaultTableSelection } from '../../plugins/table/pm-plugins/default-table-selection';
28
28
  import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
29
29
  import type { TablePluginState } from '../../plugins/table/types';
30
+ import tablePlugin from '../../plugins/table-plugin';
30
31
 
31
32
  describe('table action handlers', () => {
32
33
  let editor: any;
@@ -12,6 +12,7 @@ import {
12
12
  getCellsInRow,
13
13
  getCellsInTable,
14
14
  } from '@atlaskit/editor-tables/utils';
15
+ // eslint-disable-next-line import/no-extraneous-dependencies
15
16
  import type { LightEditorPlugin } from '@atlaskit/editor-test-helpers/create-prosemirror-editor';
16
17
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
17
18
  import {
@@ -30,7 +31,6 @@ import {
30
31
  // eslint-disable-next-line import/no-extraneous-dependencies -- Removed import for fixing circular dependencies
31
32
  import { selectColumns } from '@atlaskit/editor-test-helpers/table';
32
33
 
33
- import tablePlugin from '../../plugins/table-plugin';
34
34
  import {
35
35
  clearHoverSelection,
36
36
  hoverColumns,
@@ -41,6 +41,7 @@ import { getDecorations } from '../../plugins/table/pm-plugins/decorations/plugi
41
41
  import { pluginKey } from '../../plugins/table/pm-plugins/plugin-key';
42
42
  import type { TablePluginState } from '../../plugins/table/types';
43
43
  import { TableDecorations } from '../../plugins/table/types';
44
+ import tablePlugin from '../../plugins/table-plugin';
44
45
 
45
46
  describe('table hover selection plugin', () => {
46
47
  const createEditor = createProsemirrorEditorFactory();