@atlaskit/editor-plugin-table 7.25.15 → 7.25.16

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.25.16
4
+
5
+ ### Patch Changes
6
+
7
+ - [#135342](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/135342)
8
+ [`7310995594ece`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/7310995594ece) -
9
+ [ED-24636] Group Table Resizing Steps into a single custom step
10
+
3
11
  ## 7.25.15
4
12
 
5
13
  ### Patch Changes
@@ -36,6 +36,9 @@
36
36
  {
37
37
  "path": "../../editor-plugin-analytics/afm-cc/tsconfig.json"
38
38
  },
39
+ {
40
+ "path": "../../editor-plugin-batch-attribute-updates/afm-cc/tsconfig.json"
41
+ },
39
42
  {
40
43
  "path": "../../editor-plugin-content-insertion/afm-cc/tsconfig.json"
41
44
  },
@@ -35,6 +35,9 @@
35
35
  {
36
36
  "path": "../../editor-plugin-analytics/afm-jira/tsconfig.json"
37
37
  },
38
+ {
39
+ "path": "../../editor-plugin-batch-attribute-updates/afm-jira/tsconfig.json"
40
+ },
38
41
  {
39
42
  "path": "../../editor-plugin-content-insertion/afm-jira/tsconfig.json"
40
43
  },
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _styles = require("@atlaskit/editor-common/styles");
10
10
  var _transform = require("@atlaskit/editor-prosemirror/transform");
11
11
  var _tableMap = require("@atlaskit/editor-tables/table-map");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _utils = require("../pm-plugins/table-resizing/utils");
13
14
  var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
14
15
  var _resizeState = require("../pm-plugins/table-resizing/utils/resize-state");
@@ -22,10 +23,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
22
23
  * @param start
23
24
  * @returns
24
25
  */
25
- var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(resizeState, table, start, _api) {
26
+ var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(resizeState, table, start, api) {
26
27
  return function (tr) {
27
28
  var map = _tableMap.TableMap.get(table);
28
29
  var updatedCellsAttrs = {};
30
+ var steps = [];
29
31
 
30
32
  // calculating new attributes for each cell
31
33
  for (var columnIndex = 0; columnIndex < map.width; columnIndex++) {
@@ -75,12 +77,23 @@ var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidth
75
77
  var cell = table.nodeAt(pos);
76
78
  if (!seen[pos] && cell) {
77
79
  if (updatedCellsAttrs[pos]) {
78
- tr.step(new _transform.AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
80
+ steps.push(new _transform.AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
79
81
  }
80
82
  seen[pos] = true;
81
83
  }
82
84
  }
83
85
  }
86
+ if (api !== null && api !== void 0 && api.batchAttributeUpdates && (0, _platformFeatureFlags.fg)('platform_editor_batch_steps_table')) {
87
+ var batchStep = api.batchAttributeUpdates.actions.batchSteps({
88
+ steps: steps,
89
+ doc: tr.doc
90
+ });
91
+ tr.step(batchStep);
92
+ } else {
93
+ steps.forEach(function (s) {
94
+ tr.step(s);
95
+ });
96
+ }
84
97
  return tr;
85
98
  };
86
99
  };
@@ -1,6 +1,7 @@
1
1
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
2
  import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
3
3
  import { TableMap } from '@atlaskit/editor-tables/table-map';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { getTableContainerElementWidth, getTableElementWidth, hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
5
6
  import { isMinCellWidthTable } from '../pm-plugins/table-resizing/utils/colgroup';
6
7
  import { getResizeState } from '../pm-plugins/table-resizing/utils/resize-state';
@@ -12,9 +13,10 @@ import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
12
13
  * @param start
13
14
  * @returns
14
15
  */
15
- export const updateColumnWidths = (resizeState, table, start, _api) => tr => {
16
+ export const updateColumnWidths = (resizeState, table, start, api) => tr => {
16
17
  const map = TableMap.get(table);
17
18
  const updatedCellsAttrs = {};
19
+ const steps = [];
18
20
 
19
21
  // calculating new attributes for each cell
20
22
  for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
@@ -67,12 +69,23 @@ export const updateColumnWidths = (resizeState, table, start, _api) => tr => {
67
69
  const cell = table.nodeAt(pos);
68
70
  if (!seen[pos] && cell) {
69
71
  if (updatedCellsAttrs[pos]) {
70
- tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
72
+ steps.push(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
71
73
  }
72
74
  seen[pos] = true;
73
75
  }
74
76
  }
75
77
  }
78
+ if (api !== null && api !== void 0 && api.batchAttributeUpdates && fg('platform_editor_batch_steps_table')) {
79
+ const batchStep = api.batchAttributeUpdates.actions.batchSteps({
80
+ steps,
81
+ doc: tr.doc
82
+ });
83
+ tr.step(batchStep);
84
+ } else {
85
+ steps.forEach(s => {
86
+ tr.step(s);
87
+ });
88
+ }
76
89
  return tr;
77
90
  };
78
91
 
@@ -4,6 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
5
5
  import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
6
6
  import { TableMap } from '@atlaskit/editor-tables/table-map';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { getTableContainerElementWidth, getTableElementWidth, hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
8
9
  import { isMinCellWidthTable } from '../pm-plugins/table-resizing/utils/colgroup';
9
10
  import { getResizeState } from '../pm-plugins/table-resizing/utils/resize-state';
@@ -15,10 +16,11 @@ import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
15
16
  * @param start
16
17
  * @returns
17
18
  */
18
- export var updateColumnWidths = function updateColumnWidths(resizeState, table, start, _api) {
19
+ export var updateColumnWidths = function updateColumnWidths(resizeState, table, start, api) {
19
20
  return function (tr) {
20
21
  var map = TableMap.get(table);
21
22
  var updatedCellsAttrs = {};
23
+ var steps = [];
22
24
 
23
25
  // calculating new attributes for each cell
24
26
  for (var columnIndex = 0; columnIndex < map.width; columnIndex++) {
@@ -68,12 +70,23 @@ export var updateColumnWidths = function updateColumnWidths(resizeState, table,
68
70
  var cell = table.nodeAt(pos);
69
71
  if (!seen[pos] && cell) {
70
72
  if (updatedCellsAttrs[pos]) {
71
- tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
73
+ steps.push(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
72
74
  }
73
75
  seen[pos] = true;
74
76
  }
75
77
  }
76
78
  }
79
+ if (api !== null && api !== void 0 && api.batchAttributeUpdates && fg('platform_editor_batch_steps_table')) {
80
+ var batchStep = api.batchAttributeUpdates.actions.batchSteps({
81
+ steps: steps,
82
+ doc: tr.doc
83
+ });
84
+ tr.step(batchStep);
85
+ } else {
86
+ steps.forEach(function (s) {
87
+ tr.step(s);
88
+ });
89
+ }
77
90
  return tr;
78
91
  };
79
92
  };
@@ -3,6 +3,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import type { Command, EditorCommand, GetEditorFeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import type { AccessibilityUtilsPlugin } from '@atlaskit/editor-plugin-accessibility-utils';
5
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { BatchAttributeUpdatesPlugin } from '@atlaskit/editor-plugin-batch-attribute-updates';
6
7
  import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
7
8
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
8
9
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
@@ -46,6 +47,7 @@ export type TablePlugin = NextEditorPlugin<'table', {
46
47
  WidthPlugin,
47
48
  GuidelinePlugin,
48
49
  SelectionPlugin,
50
+ OptionalPlugin<BatchAttributeUpdatesPlugin>,
49
51
  OptionalPlugin<AccessibilityUtilsPlugin>,
50
52
  OptionalPlugin<MediaPlugin>,
51
53
  OptionalPlugin<EditorViewModePlugin>,
@@ -11,7 +11,7 @@ import type { PluginInjectionAPI } from '../types';
11
11
  * @param start
12
12
  * @returns
13
13
  */
14
- export declare const updateColumnWidths: (resizeState: ResizeState, table: PMNode, start: number, _api: PluginInjectionAPI | undefined | null) => (tr: Transaction) => Transaction;
14
+ export declare const updateColumnWidths: (resizeState: ResizeState, table: PMNode, start: number, api: PluginInjectionAPI | undefined | null) => (tr: Transaction) => Transaction;
15
15
  /**
16
16
  * This function is called when user inserts/deletes a column in a table to;
17
17
  * - rescale all columns (if the table did not overflow before the insertion)
@@ -74,7 +74,11 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
74
74
  displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
75
75
  };
76
76
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
77
- }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
77
+ }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"batchAttributeUpdates", {
78
+ actions: {
79
+ batchSteps: import("@atlaskit/editor-plugin-batch-attribute-updates").BatchStepsAction;
80
+ };
81
+ }, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
78
82
  dependencies: [];
79
83
  actions: {
80
84
  ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
@@ -55,7 +55,11 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
55
55
  displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
56
56
  };
57
57
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
58
- }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
58
+ }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"batchAttributeUpdates", {
59
+ actions: {
60
+ batchSteps: import("@atlaskit/editor-plugin-batch-attribute-updates").BatchStepsAction;
61
+ };
62
+ }, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
59
63
  dependencies: [];
60
64
  actions: {
61
65
  ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
@@ -137,7 +141,11 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
137
141
  displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
138
142
  };
139
143
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
140
- }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
144
+ }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"batchAttributeUpdates", {
145
+ actions: {
146
+ batchSteps: import("@atlaskit/editor-plugin-batch-attribute-updates").BatchStepsAction;
147
+ };
148
+ }, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
141
149
  dependencies: [];
142
150
  actions: {
143
151
  ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
@@ -84,7 +84,11 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
84
84
  displayGapCursor: (toggle: boolean) => import("@atlaskit/editor-common/types").EditorCommand;
85
85
  };
86
86
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
87
- }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
87
+ }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"batchAttributeUpdates", {
88
+ actions: {
89
+ batchSteps: import("@atlaskit/editor-plugin-batch-attribute-updates").BatchStepsAction;
90
+ };
91
+ }, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
88
92
  dependencies: [];
89
93
  actions: {
90
94
  ariaNotify: (message: string, ariaLiveElementAttributes?: import("@atlaskit/editor-plugin-accessibility-utils").AriaLiveElementAttributes | undefined) => void;
@@ -3,6 +3,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
3
  import type { Command, EditorCommand, GetEditorFeatureFlags, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
4
4
  import type { AccessibilityUtilsPlugin } from '@atlaskit/editor-plugin-accessibility-utils';
5
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { BatchAttributeUpdatesPlugin } from '@atlaskit/editor-plugin-batch-attribute-updates';
6
7
  import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
7
8
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
8
9
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
@@ -46,6 +47,7 @@ export type TablePlugin = NextEditorPlugin<'table', {
46
47
  WidthPlugin,
47
48
  GuidelinePlugin,
48
49
  SelectionPlugin,
50
+ OptionalPlugin<BatchAttributeUpdatesPlugin>,
49
51
  OptionalPlugin<AccessibilityUtilsPlugin>,
50
52
  OptionalPlugin<MediaPlugin>,
51
53
  OptionalPlugin<EditorViewModePlugin>,
@@ -11,7 +11,7 @@ import type { PluginInjectionAPI } from '../types';
11
11
  * @param start
12
12
  * @returns
13
13
  */
14
- export declare const updateColumnWidths: (resizeState: ResizeState, table: PMNode, start: number, _api: PluginInjectionAPI | undefined | null) => (tr: Transaction) => Transaction;
14
+ export declare const updateColumnWidths: (resizeState: ResizeState, table: PMNode, start: number, api: PluginInjectionAPI | undefined | null) => (tr: Transaction) => Transaction;
15
15
  /**
16
16
  * This function is called when user inserts/deletes a column in a table to;
17
17
  * - rescale all columns (if the table did not overflow before the insertion)
@@ -88,6 +88,11 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
88
88
  };
89
89
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
90
90
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
91
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"batchAttributeUpdates", {
92
+ actions: {
93
+ batchSteps: import("@atlaskit/editor-plugin-batch-attribute-updates").BatchStepsAction;
94
+ };
95
+ }, undefined>>,
91
96
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
92
97
  dependencies: [
93
98
  ];
@@ -69,6 +69,11 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
69
69
  };
70
70
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
71
71
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
72
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"batchAttributeUpdates", {
73
+ actions: {
74
+ batchSteps: import("@atlaskit/editor-plugin-batch-attribute-updates").BatchStepsAction;
75
+ };
76
+ }, undefined>>,
72
77
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
73
78
  dependencies: [
74
79
  ];
@@ -171,6 +176,11 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
171
176
  };
172
177
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
173
178
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
179
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"batchAttributeUpdates", {
180
+ actions: {
181
+ batchSteps: import("@atlaskit/editor-plugin-batch-attribute-updates").BatchStepsAction;
182
+ };
183
+ }, undefined>>,
174
184
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
175
185
  dependencies: [
176
186
  ];
@@ -98,6 +98,11 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
98
98
  };
99
99
  sharedState: import("@atlaskit/editor-common/selection").SelectionSharedState;
100
100
  }, import("@atlaskit/editor-plugin-selection/types").SelectionPluginOptions | undefined>,
101
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"batchAttributeUpdates", {
102
+ actions: {
103
+ batchSteps: import("@atlaskit/editor-plugin-batch-attribute-updates").BatchStepsAction;
104
+ };
105
+ }, undefined>>,
101
106
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
102
107
  dependencies: [
103
108
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.25.15",
3
+ "version": "7.25.16",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,10 +31,11 @@
31
31
  "@atlaskit/adf-schema": "^40.9.0",
32
32
  "@atlaskit/button": "^20.1.0",
33
33
  "@atlaskit/custom-steps": "^0.7.0",
34
- "@atlaskit/editor-common": "^88.4.0",
34
+ "@atlaskit/editor-common": "^88.5.0",
35
35
  "@atlaskit/editor-palette": "1.6.0",
36
36
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.8.0",
38
+ "@atlaskit/editor-plugin-batch-attribute-updates": "1.0.0",
38
39
  "@atlaskit/editor-plugin-content-insertion": "^1.8.0",
39
40
  "@atlaskit/editor-plugin-editor-viewmode": "^2.1.0",
40
41
  "@atlaskit/editor-plugin-guideline": "^1.2.0",
@@ -111,6 +112,9 @@
111
112
  "platform.editor.table.use-increased-scaling-percent": {
112
113
  "type": "boolean"
113
114
  },
115
+ "platform_editor_batch_steps_table": {
116
+ "type": "boolean"
117
+ },
114
118
  "platform_editor_dark_mode_cell_header_color_fix": {
115
119
  "type": "boolean"
116
120
  },
package/src/plugin.tsx CHANGED
@@ -28,6 +28,7 @@ import { browser } from '@atlaskit/editor-common/utils';
28
28
  import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
29
29
  import type { AccessibilityUtilsPlugin } from '@atlaskit/editor-plugin-accessibility-utils';
30
30
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
31
+ import type { BatchAttributeUpdatesPlugin } from '@atlaskit/editor-plugin-batch-attribute-updates';
31
32
  import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
32
33
  import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
33
34
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
@@ -136,6 +137,7 @@ export type TablePlugin = NextEditorPlugin<
136
137
  WidthPlugin,
137
138
  GuidelinePlugin,
138
139
  SelectionPlugin,
140
+ OptionalPlugin<BatchAttributeUpdatesPlugin>,
139
141
  OptionalPlugin<AccessibilityUtilsPlugin>,
140
142
  OptionalPlugin<MediaPlugin>,
141
143
  OptionalPlugin<EditorViewModePlugin>,
@@ -6,6 +6,7 @@ import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
6
6
  import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
8
  import { TableMap } from '@atlaskit/editor-tables/table-map';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
 
10
11
  import type { ResizeState } from '../pm-plugins/table-resizing/utils';
11
12
  import {
@@ -30,12 +31,12 @@ export const updateColumnWidths =
30
31
  resizeState: ResizeState,
31
32
  table: PMNode,
32
33
  start: number,
33
- // TODO: ED-24636 To be used in a follow up change
34
- _api: PluginInjectionAPI | undefined | null,
34
+ api: PluginInjectionAPI | undefined | null,
35
35
  ) =>
36
36
  (tr: Transaction): Transaction => {
37
37
  const map = TableMap.get(table);
38
38
  const updatedCellsAttrs: { [key: number]: CellAttributes } = {};
39
+ const steps: Array<AttrStep> = [];
39
40
 
40
41
  // calculating new attributes for each cell
41
42
  for (let columnIndex = 0; columnIndex < map.width; columnIndex++) {
@@ -89,13 +90,22 @@ export const updateColumnWidths =
89
90
  const cell = table.nodeAt(pos);
90
91
  if (!seen[pos] && cell) {
91
92
  if (updatedCellsAttrs[pos]) {
92
- tr.step(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
93
+ steps.push(new AttrStep(pos + start, 'colwidth', updatedCellsAttrs[pos].colwidth));
93
94
  }
94
95
  seen[pos] = true;
95
96
  }
96
97
  }
97
98
  }
98
99
 
100
+ if (api?.batchAttributeUpdates && fg('platform_editor_batch_steps_table')) {
101
+ const batchStep = api.batchAttributeUpdates.actions.batchSteps({ steps, doc: tr.doc });
102
+ tr.step(batchStep);
103
+ } else {
104
+ steps.forEach((s) => {
105
+ tr.step(s);
106
+ });
107
+ }
108
+
99
109
  return tr;
100
110
  };
101
111
 
package/tsconfig.app.json CHANGED
@@ -51,6 +51,9 @@
51
51
  {
52
52
  "path": "../editor-plugin-analytics/tsconfig.app.json"
53
53
  },
54
+ {
55
+ "path": "../editor-plugin-batch-attribute-updates/tsconfig.app.json"
56
+ },
54
57
  {
55
58
  "path": "../editor-plugin-content-insertion/tsconfig.app.json"
56
59
  },