@atlaskit/editor-plugin-table 7.16.18 → 7.16.19

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 (134) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/commands/column-resize.js +4 -3
  3. package/dist/cjs/commands/delete.js +3 -2
  4. package/dist/cjs/commands/insert.js +12 -8
  5. package/dist/cjs/commands-with-analytics.js +10 -7
  6. package/dist/cjs/event-handlers.js +3 -2
  7. package/dist/cjs/nodeviews/TableComponent.js +32 -19
  8. package/dist/cjs/nodeviews/TableContainer.js +4 -0
  9. package/dist/cjs/nodeviews/TableResizer.js +3 -2
  10. package/dist/cjs/nodeviews/table.js +6 -4
  11. package/dist/cjs/plugin.js +9 -6
  12. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +12 -13
  13. package/dist/cjs/pm-plugins/keymap.js +11 -9
  14. package/dist/cjs/pm-plugins/main.js +4 -1
  15. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +10 -9
  16. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +4 -3
  17. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +4 -3
  18. package/dist/cjs/toolbar.js +29 -20
  19. package/dist/cjs/transforms/column-width.js +3 -3
  20. package/dist/cjs/transforms/delete-columns.js +3 -2
  21. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +21 -15
  22. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -2
  23. package/dist/cjs/ui/FloatingDragMenu/index.js +6 -3
  24. package/dist/cjs/ui/FloatingInsertButton/index.js +7 -8
  25. package/dist/cjs/utils/drag-menu.js +5 -4
  26. package/dist/es2019/commands/column-resize.js +4 -3
  27. package/dist/es2019/commands/delete.js +2 -2
  28. package/dist/es2019/commands/insert.js +8 -8
  29. package/dist/es2019/commands-with-analytics.js +9 -8
  30. package/dist/es2019/event-handlers.js +2 -2
  31. package/dist/es2019/nodeviews/TableComponent.js +28 -17
  32. package/dist/es2019/nodeviews/TableContainer.js +4 -0
  33. package/dist/es2019/nodeviews/TableResizer.js +3 -2
  34. package/dist/es2019/nodeviews/table.js +5 -4
  35. package/dist/es2019/plugin.js +9 -6
  36. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +7 -10
  37. package/dist/es2019/pm-plugins/keymap.js +9 -9
  38. package/dist/es2019/pm-plugins/main.js +4 -1
  39. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +10 -9
  40. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  41. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -4
  42. package/dist/es2019/toolbar.js +25 -22
  43. package/dist/es2019/transforms/column-width.js +2 -3
  44. package/dist/es2019/transforms/delete-columns.js +2 -2
  45. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +12 -7
  46. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
  47. package/dist/es2019/ui/FloatingDragMenu/index.js +5 -3
  48. package/dist/es2019/ui/FloatingInsertButton/index.js +6 -8
  49. package/dist/es2019/utils/drag-menu.js +4 -4
  50. package/dist/esm/commands/column-resize.js +4 -3
  51. package/dist/esm/commands/delete.js +3 -2
  52. package/dist/esm/commands/insert.js +12 -8
  53. package/dist/esm/commands-with-analytics.js +10 -7
  54. package/dist/esm/event-handlers.js +3 -2
  55. package/dist/esm/nodeviews/TableComponent.js +32 -19
  56. package/dist/esm/nodeviews/TableContainer.js +4 -0
  57. package/dist/esm/nodeviews/TableResizer.js +3 -2
  58. package/dist/esm/nodeviews/table.js +6 -4
  59. package/dist/esm/plugin.js +9 -6
  60. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +12 -13
  61. package/dist/esm/pm-plugins/keymap.js +11 -9
  62. package/dist/esm/pm-plugins/main.js +4 -1
  63. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +10 -9
  64. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +4 -3
  65. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +4 -3
  66. package/dist/esm/toolbar.js +29 -20
  67. package/dist/esm/transforms/column-width.js +3 -3
  68. package/dist/esm/transforms/delete-columns.js +3 -2
  69. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +21 -15
  70. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
  71. package/dist/esm/ui/FloatingDragMenu/index.js +6 -3
  72. package/dist/esm/ui/FloatingInsertButton/index.js +7 -8
  73. package/dist/esm/utils/drag-menu.js +5 -4
  74. package/dist/types/commands/column-resize.d.ts +2 -1
  75. package/dist/types/commands/delete.d.ts +1 -1
  76. package/dist/types/commands/insert.d.ts +4 -4
  77. package/dist/types/commands-with-analytics.d.ts +4 -4
  78. package/dist/types/event-handlers.d.ts +1 -1
  79. package/dist/types/nodeviews/TableContainer.d.ts +4 -2
  80. package/dist/types/nodeviews/TableResizer.d.ts +2 -1
  81. package/dist/types/nodeviews/table.d.ts +1 -0
  82. package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
  83. package/dist/types/pm-plugins/keymap.d.ts +1 -1
  84. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  85. package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
  86. package/dist/types/toolbar.d.ts +5 -5
  87. package/dist/types/transforms/column-width.d.ts +1 -1
  88. package/dist/types/transforms/delete-columns.d.ts +1 -1
  89. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  90. package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -0
  91. package/dist/types/utils/drag-menu.d.ts +1 -1
  92. package/dist/types-ts4.5/commands/column-resize.d.ts +2 -1
  93. package/dist/types-ts4.5/commands/delete.d.ts +1 -1
  94. package/dist/types-ts4.5/commands/insert.d.ts +4 -4
  95. package/dist/types-ts4.5/commands-with-analytics.d.ts +4 -4
  96. package/dist/types-ts4.5/event-handlers.d.ts +1 -1
  97. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
  98. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
  99. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -0
  100. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
  101. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
  102. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  103. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
  104. package/dist/types-ts4.5/toolbar.d.ts +5 -5
  105. package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
  106. package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
  107. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  108. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -0
  109. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  110. package/package.json +2 -5
  111. package/src/commands/column-resize.ts +6 -6
  112. package/src/commands/delete.ts +7 -1
  113. package/src/commands/insert.ts +33 -5
  114. package/src/commands-with-analytics.ts +14 -2
  115. package/src/event-handlers.ts +2 -0
  116. package/src/nodeviews/TableComponent.tsx +28 -28
  117. package/src/nodeviews/TableContainer.tsx +6 -0
  118. package/src/nodeviews/TableResizer.tsx +4 -0
  119. package/src/nodeviews/table.tsx +4 -2
  120. package/src/plugin.tsx +17 -7
  121. package/src/pm-plugins/drag-and-drop/plugin.ts +26 -13
  122. package/src/pm-plugins/keymap.ts +30 -4
  123. package/src/pm-plugins/main.ts +2 -0
  124. package/src/pm-plugins/table-resizing/event-handlers.ts +12 -14
  125. package/src/pm-plugins/table-resizing/utils/resize-state.ts +5 -5
  126. package/src/pm-plugins/table-resizing/utils/scale-table.ts +6 -4
  127. package/src/toolbar.tsx +46 -12
  128. package/src/transforms/column-width.ts +7 -3
  129. package/src/transforms/delete-columns.ts +6 -2
  130. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +12 -4
  131. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
  132. package/src/ui/FloatingDragMenu/index.tsx +4 -4
  133. package/src/ui/FloatingInsertButton/index.tsx +12 -9
  134. package/src/utils/drag-menu.ts +13 -4
package/src/toolbar.tsx CHANGED
@@ -157,6 +157,9 @@ export const getToolbarMenuConfig = (
157
157
  },
158
158
  ];
159
159
 
160
+ const tableOptionsDropdownWidth = isTableScalingWithFixedColumnWidthsOptionShown
161
+ ? 192
162
+ : undefined;
160
163
  if (state.isDragAndDropEnabled) {
161
164
  return {
162
165
  id: 'editor.table.tableOptions',
@@ -166,7 +169,7 @@ export const getToolbarMenuConfig = (
166
169
  title: formatMessage(messages.tableOptions),
167
170
  hidden: options.every((option) => option.hidden),
168
171
  options,
169
- dropdownWidth: isTableScalingWithFixedColumnWidthsOptionShown ? 192 : undefined,
172
+ dropdownWidth: tableOptionsDropdownWidth,
170
173
  };
171
174
  } else {
172
175
  return {
@@ -176,7 +179,7 @@ export const getToolbarMenuConfig = (
176
179
  title: formatMessage(messages.tableOptions),
177
180
  hidden: options.every((option) => option.hidden),
178
181
  options,
179
- dropdownWidth: isTableScalingWithFixedColumnWidthsOptionShown ? 192 : undefined,
182
+ dropdownWidth: tableOptionsDropdownWidth,
180
183
  };
181
184
  }
182
185
  };
@@ -192,6 +195,8 @@ export const getToolbarCellOptionsConfig = (
192
195
  getEditorContainerWidth: GetEditorContainerWidth,
193
196
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
194
197
  isTableScalingEnabled = false,
198
+ isCellBackgroundDuplicated = false,
199
+ isTableFixedColumnWidthsOptionEnabled = false,
195
200
  shouldUseIncreasedScalingPercent = false,
196
201
  ): FloatingToolbarDropdown<Command> => {
197
202
  const { top, bottom, right, left } = initialSelectionRect;
@@ -210,6 +215,8 @@ export const getToolbarCellOptionsConfig = (
210
215
  insertColumnWithAnalytics(
211
216
  editorAnalyticsAPI,
212
217
  isTableScalingEnabled,
218
+ isCellBackgroundDuplicated,
219
+ isTableFixedColumnWidthsOptionEnabled,
213
220
  shouldUseIncreasedScalingPercent,
214
221
  )(INPUT_METHOD.FLOATING_TB, index)(state, dispatch, view);
215
222
  }
@@ -248,6 +255,7 @@ export const getToolbarCellOptionsConfig = (
248
255
  deleteColumnsWithAnalytics(
249
256
  editorAnalyticsAPI,
250
257
  isTableScalingEnabled,
258
+ isTableFixedColumnWidthsOptionEnabled,
251
259
  shouldUseIncreasedScalingPercent,
252
260
  )(INPUT_METHOD.FLOATING_TB, selectionRect)(state, dispatch, view);
253
261
  }
@@ -307,6 +315,7 @@ export const getToolbarCellOptionsConfig = (
307
315
  editorView.domAtPos.bind(editorView),
308
316
  getEditorContainerWidth,
309
317
  isTableScalingEnabled,
318
+ isTableFixedColumnWidthsOptionEnabled,
310
319
  )
311
320
  : undefined;
312
321
  const wouldChange = newResizeStateWithAnalytics?.changed ?? false;
@@ -446,7 +455,7 @@ export const getToolbarConfig =
446
455
  getEditorFeatureFlags: GetEditorFeatureFlags,
447
456
  getEditorView: () => EditorView | null,
448
457
  options?: TablePluginOptions,
449
- isTableScalingWithFixedColumnWidthsOptionEnabled = false,
458
+ isTableFixedColumnWidthsOptionEnabled = false,
450
459
  shouldUseIncreasedScalingPercent = false,
451
460
  ) =>
452
461
  (config: PluginConfig): FloatingToolbarHandler =>
@@ -455,6 +464,7 @@ export const getToolbarConfig =
455
464
  const pluginState = getPluginState(state);
456
465
  const resizeState = tableResizingPluginKey.getState(state);
457
466
  const tableWidthState = tableWidthPluginKey.getState(state);
467
+ const isTableScalingEnabled = options?.isTableScalingEnabled || false;
458
468
 
459
469
  // We don't want to show floating toolbar while resizing the table
460
470
  const isWidthResizing = tableWidthState?.resizing;
@@ -463,7 +473,7 @@ export const getToolbarConfig =
463
473
  const nodeType = state.schema.nodes.table;
464
474
  const isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
465
475
  const isTableScalingWithFixedColumnWidthsOptionShown =
466
- isTableScalingWithFixedColumnWidthsOptionEnabled && !isNested;
476
+ isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled && !isNested;
467
477
  const areTableColumWidthsFixed = tableObject.node.attrs.displayMode === 'fixed';
468
478
  const editorView = getEditorView();
469
479
 
@@ -501,9 +511,13 @@ export const getToolbarConfig =
501
511
  getEditorContainerWidth,
502
512
  getDomRef,
503
513
  editorView,
514
+ shouldUseIncreasedScalingPercent,
504
515
  )
505
516
  : [];
506
517
 
518
+ const isCellBackgroundDuplicated =
519
+ getEditorFeatureFlags().tableDuplicateCellColouring || false;
520
+
507
521
  const cellItems = pluginState.isDragAndDropEnabled
508
522
  ? []
509
523
  : getCellItems(
@@ -512,7 +526,9 @@ export const getToolbarConfig =
512
526
  intl,
513
527
  getEditorContainerWidth,
514
528
  editorAnalyticsAPI,
515
- options?.isTableScalingEnabled,
529
+ isTableScalingEnabled,
530
+ isCellBackgroundDuplicated,
531
+ isTableFixedColumnWidthsOptionEnabled,
516
532
  shouldUseIncreasedScalingPercent,
517
533
  );
518
534
 
@@ -523,7 +539,8 @@ export const getToolbarConfig =
523
539
  intl,
524
540
  getEditorContainerWidth,
525
541
  editorAnalyticsAPI,
526
- options?.isTableScalingEnabled,
542
+ isTableScalingEnabled,
543
+ isTableFixedColumnWidthsOptionEnabled,
527
544
  )
528
545
  : [];
529
546
  const colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView);
@@ -621,6 +638,8 @@ const getCellItems = (
621
638
  getEditorContainerWidth: GetEditorContainerWidth,
622
639
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
623
640
  isTableScalingEnabled = false,
641
+ isCellBackgroundDuplicated = false,
642
+ isTableFixedColumnWidthsOptionEnabled = false,
624
643
  shouldUseIncreasedScalingPercent = false,
625
644
  ): Array<FloatingToolbarItem<Command>> => {
626
645
  const initialSelectionRect = getClosestSelectionRect(state);
@@ -633,6 +652,8 @@ const getCellItems = (
633
652
  getEditorContainerWidth,
634
653
  editorAnalyticsAPI,
635
654
  isTableScalingEnabled,
655
+ isCellBackgroundDuplicated,
656
+ isTableFixedColumnWidthsOptionEnabled,
636
657
  shouldUseIncreasedScalingPercent,
637
658
  );
638
659
  return [cellOptions, separator(cellOptions.hidden!)];
@@ -645,18 +666,21 @@ export const getDistributeConfig =
645
666
  getEditorContainerWidth: GetEditorContainerWidth,
646
667
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
647
668
  isTableScalingEnabled = false,
669
+ isTableFixedColumnWidthsOptionEnabled = false,
648
670
  ): Command =>
649
671
  (state, dispatch, editorView) => {
650
672
  const selectionOrTableRect = getClosestSelectionOrTableRect(state);
651
673
  if (!editorView || !selectionOrTableRect) {
652
674
  return false;
653
675
  }
676
+
654
677
  const newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(
655
678
  selectionOrTableRect,
656
679
  state,
657
680
  editorView.domAtPos.bind(editorView),
658
681
  getEditorContainerWidth,
659
682
  isTableScalingEnabled,
683
+ isTableFixedColumnWidthsOptionEnabled,
660
684
  );
661
685
 
662
686
  if (newResizeStateWithAnalytics) {
@@ -678,6 +702,7 @@ const getColumnSettingItems = (
678
702
  getEditorContainerWidth: GetEditorContainerWidth,
679
703
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
680
704
  isTableScalingEnabled = false,
705
+ isTableFixedColumnWidthsOptionEnabled = false,
681
706
  ): Array<FloatingToolbarItem<Command>> => {
682
707
  const pluginState = getPluginState(editorState);
683
708
  const selectionOrTableRect = getClosestSelectionOrTableRect(editorState);
@@ -692,6 +717,7 @@ const getColumnSettingItems = (
692
717
  editorView.domAtPos.bind(editorView),
693
718
  getEditorContainerWidth,
694
719
  isTableScalingEnabled,
720
+ isTableFixedColumnWidthsOptionEnabled,
695
721
  );
696
722
 
697
723
  const wouldChange = newResizeStateWithAnalytics?.changed ?? false;
@@ -705,11 +731,12 @@ const getColumnSettingItems = (
705
731
  title: formatMessage(messages.distributeColumns),
706
732
  icon: DistributeColumnIcon,
707
733
  onClick: (state, dispatch, view) =>
708
- getDistributeConfig(getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled)(
709
- state,
710
- dispatch,
711
- view,
712
- ),
734
+ getDistributeConfig(
735
+ getEditorContainerWidth,
736
+ editorAnalyticsAPI,
737
+ isTableScalingEnabled,
738
+ isTableFixedColumnWidthsOptionEnabled,
739
+ )(state, dispatch, view),
713
740
  disabled: !wouldChange,
714
741
  });
715
742
  }
@@ -816,6 +843,7 @@ export const getAlignmentOptionsConfig = (
816
843
  getEditorContainerWidth: GetEditorContainerWidth,
817
844
  getDomRef: (editorView: EditorView) => HTMLElement | undefined,
818
845
  editorView: EditorView | null,
846
+ shouldUseIncreasedScalingPercent: boolean,
819
847
  ): Array<FloatingToolbarDropdown<Command>> => {
820
848
  const tableObject = findTable(editorState.selection);
821
849
 
@@ -863,6 +891,7 @@ export const getAlignmentOptionsConfig = (
863
891
  getEditorContainerWidth,
864
892
  getDomRef,
865
893
  editorView,
894
+ shouldUseIncreasedScalingPercent,
866
895
  ) && {
867
896
  disabled: value !== 'center',
868
897
  }),
@@ -904,6 +933,7 @@ export const isLayoutOptionDisabled = (
904
933
  getEditorContainerWidth: GetEditorContainerWidth,
905
934
  getDomRef: (editorView: EditorView) => HTMLElement | undefined,
906
935
  editorView: EditorView | null,
936
+ shouldUseIncreasedScalingPercent: boolean,
907
937
  ) => {
908
938
  const { lineLength } = getEditorContainerWidth();
909
939
  let tableContainerWidth = getTableContainerWidth(selectedNode);
@@ -912,7 +942,11 @@ export const isLayoutOptionDisabled = (
912
942
  if (editorView) {
913
943
  const tableWrapper = getDomRef(editorView);
914
944
  const tableWrapperWidth = tableWrapper?.clientWidth || tableContainerWidth;
915
- const scalePercent = getStaticTableScalingPercent(selectedNode, tableWrapperWidth);
945
+ const scalePercent = getStaticTableScalingPercent(
946
+ selectedNode,
947
+ tableWrapperWidth,
948
+ shouldUseIncreasedScalingPercent,
949
+ );
916
950
  tableContainerWidth = tableContainerWidth * scalePercent;
917
951
  }
918
952
 
@@ -104,7 +104,11 @@ export const updateColumnWidths =
104
104
  * @returns Updated transaction with rescaled columns for a given table
105
105
  */
106
106
  export const rescaleColumns =
107
- (isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false) =>
107
+ (
108
+ isTableScalingEnabled = false,
109
+ isTableFixedColumnWidthsOptionEnabled = false,
110
+ shouldUseIncreasedScalingPercent = false,
111
+ ) =>
108
112
  (table: ContentNodeWithPos, view: EditorView | undefined) =>
109
113
  (tr: Transaction): Transaction => {
110
114
  if (!view) {
@@ -135,7 +139,8 @@ export const rescaleColumns =
135
139
 
136
140
  const tableDepth = view.state.doc.resolve(table.pos).depth;
137
141
  let shouldScale = isTableScalingEnabled && tableDepth === 0;
138
- if (shouldScale && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')) {
142
+
143
+ if (shouldScale && isTableFixedColumnWidthsOptionEnabled) {
139
144
  shouldScale = newTable.attrs.displayMode !== 'fixed';
140
145
  }
141
146
 
@@ -208,7 +213,6 @@ export const rescaleColumns =
208
213
  isTableScalingEnabled: shouldScale,
209
214
  shouldUseIncreasedScalingPercent,
210
215
  });
211
-
212
216
  // Two scenarios that require scaling:
213
217
  // 1. If the new table width will result in the table going into overflow
214
218
  // we resize the cells to avoid it (e.g. adding a column)
@@ -245,6 +245,7 @@ export const deleteColumns =
245
245
  allowCustomStep: boolean,
246
246
  view?: EditorView,
247
247
  isTableScalingEnabled = false,
248
+ isTableFixedColumnWidthsOptionEnabled = false,
248
249
  shouldUseIncreasedScalingPercent = false,
249
250
  ) =>
250
251
  (tr: Transaction) => {
@@ -259,9 +260,12 @@ export const deleteColumns =
259
260
  updatedTr = deleteColumnsLegacy(rect)(updatedTr);
260
261
  }
261
262
  const table = findTable(updatedTr.selection);
262
-
263
263
  if (table) {
264
- updatedTr = rescaleColumns(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(
264
+ updatedTr = rescaleColumns(
265
+ isTableScalingEnabled,
266
+ isTableFixedColumnWidthsOptionEnabled,
267
+ shouldUseIncreasedScalingPercent,
268
+ )(
265
269
  table,
266
270
  view,
267
271
  )(updatedTr);
@@ -379,6 +379,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
379
379
  intl: { formatMessage },
380
380
  editorView,
381
381
  getEditorContainerWidth,
382
+ getEditorFeatureFlags,
382
383
  } = this.props;
383
384
  const {
384
385
  isDragAndDropEnabled,
@@ -386,12 +387,17 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
386
387
  } = getPluginState(editorView.state);
387
388
  if (allowDistributeColumns && !isDragAndDropEnabled) {
388
389
  const { isTableScalingEnabled = false } = getPluginState(editorView.state);
390
+ const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags
391
+ ? getEditorFeatureFlags()
392
+ : {};
393
+
389
394
  const newResizeState = getNewResizeStateFromSelectedColumns(
390
395
  selectionRect,
391
396
  editorView.state,
392
397
  editorView.domAtPos.bind(editorView),
393
398
  getEditorContainerWidth,
394
399
  isTableScalingEnabled,
400
+ tableWithFixedColumnWidthsOption,
395
401
  );
396
402
 
397
403
  const wouldChange = newResizeState?.changed ?? false;
@@ -507,13 +513,12 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
507
513
  const { state, dispatch } = editorView;
508
514
  const { targetCellPosition, isTableScalingEnabled = false } = getPluginState(state);
509
515
 
510
- const { tableDuplicateCellColouring = false } = getEditorFeatureFlags
511
- ? getEditorFeatureFlags()
512
- : {};
516
+ const { tableDuplicateCellColouring = false, tableWithFixedColumnWidthsOption = false } =
517
+ getEditorFeatureFlags ? getEditorFeatureFlags() : {};
513
518
 
514
519
  const shouldUseIncreasedScalingPercent =
515
520
  isTableScalingEnabled &&
516
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
521
+ tableWithFixedColumnWidthsOption &&
517
522
  getBooleanFF('platform.editor.table.use-increased-scaling-percent');
518
523
 
519
524
  switch (item.value.name) {
@@ -548,6 +553,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
548
553
  editorView.domAtPos.bind(editorView),
549
554
  getEditorContainerWidth,
550
555
  isTableScalingEnabled,
556
+ tableWithFixedColumnWidthsOption,
551
557
  );
552
558
 
553
559
  if (newResizeStateWithAnalytics) {
@@ -570,6 +576,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
570
576
  editorAnalyticsAPI,
571
577
  isTableScalingEnabled,
572
578
  tableDuplicateCellColouring,
579
+ tableWithFixedColumnWidthsOption,
573
580
  shouldUseIncreasedScalingPercent,
574
581
  )(INPUT_METHOD.CONTEXT_MENU, selectionRect.right)(state, dispatch, editorView);
575
582
  this.toggleOpen();
@@ -588,6 +595,7 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
588
595
  deleteColumnsWithAnalytics(
589
596
  editorAnalyticsAPI,
590
597
  isTableScalingEnabled,
598
+ tableWithFixedColumnWidthsOption,
591
599
  shouldUseIncreasedScalingPercent,
592
600
  )(INPUT_METHOD.CONTEXT_MENU, selectionRect)(state, dispatch, editorView);
593
601
  this.toggleOpen();
@@ -94,6 +94,7 @@ type DragMenuProps = {
94
94
  isTableScalingEnabled?: boolean;
95
95
  tableDuplicateCellColouring?: boolean;
96
96
  shouldUseIncreasedScalingPercent?: boolean;
97
+ isTableFixedColumnWidthsOptionEnabled?: boolean;
97
98
  };
98
99
 
99
100
  type PluralOptionType = 'noOfCols' | 'noOfRows' | 'noOfCells' | null;
@@ -263,6 +264,7 @@ export const DragMenu = React.memo(
263
264
  isTableScalingEnabled,
264
265
  tableDuplicateCellColouring,
265
266
  shouldUseIncreasedScalingPercent,
267
+ isTableFixedColumnWidthsOptionEnabled,
266
268
  }: DragMenuProps & WrappedComponentProps) => {
267
269
  const { state, dispatch } = editorView;
268
270
  const { selection } = state;
@@ -303,6 +305,7 @@ export const DragMenu = React.memo(
303
305
  pluginConfig?.isHeaderRowRequired,
304
306
  isTableScalingEnabled,
305
307
  tableDuplicateCellColouring,
308
+ isTableFixedColumnWidthsOptionEnabled,
306
309
  shouldUseIncreasedScalingPercent,
307
310
  );
308
311
 
@@ -70,13 +70,12 @@ const FloatingDragMenu = ({
70
70
  return null;
71
71
  }
72
72
 
73
- const { tableDuplicateCellColouring = false } = getEditorFeatureFlags
74
- ? getEditorFeatureFlags()
75
- : {};
73
+ const { tableDuplicateCellColouring = false, tableWithFixedColumnWidthsOption = false } =
74
+ getEditorFeatureFlags ? getEditorFeatureFlags() : {};
76
75
 
77
76
  const shouldUseIncreasedScalingPercent =
78
77
  isTableScalingEnabled &&
79
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
78
+ tableWithFixedColumnWidthsOption &&
80
79
  getBooleanFF('platform.editor.table.use-increased-scaling-percent');
81
80
 
82
81
  return (
@@ -116,6 +115,7 @@ const FloatingDragMenu = ({
116
115
  isTableScalingEnabled={isTableScalingEnabled}
117
116
  tableDuplicateCellColouring={tableDuplicateCellColouring}
118
117
  shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
118
+ isTableFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
119
119
  />
120
120
  </Popup>
121
121
  );
@@ -28,7 +28,6 @@ import { findTable } from '@atlaskit/editor-tables/utils';
28
28
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
29
29
 
30
30
  import { insertColumnWithAnalytics, insertRowWithAnalytics } from '../../commands-with-analytics';
31
- import { getPluginState } from '../../pm-plugins/plugin-factory';
32
31
  import { TableCssClassName as ClassName } from '../../types';
33
32
  import { checkIfNumberColumnEnabled } from '../../utils';
34
33
 
@@ -45,6 +44,7 @@ export interface Props {
45
44
  isHeaderColumnEnabled?: boolean;
46
45
  isHeaderRowEnabled?: boolean;
47
46
  isDragAndDropEnabled?: boolean;
47
+ isTableScalingEnabled?: boolean;
48
48
  mountPoint?: HTMLElement;
49
49
  boundariesElement?: HTMLElement;
50
50
  scrollableElement?: HTMLElement;
@@ -256,28 +256,31 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
256
256
  }
257
257
 
258
258
  private insertColumn(event: React.SyntheticEvent) {
259
- const { editorView, insertColumnButtonIndex, editorAnalyticsAPI, getEditorFeatureFlags } =
260
- this.props;
259
+ const {
260
+ editorView,
261
+ insertColumnButtonIndex,
262
+ editorAnalyticsAPI,
263
+ getEditorFeatureFlags,
264
+ isTableScalingEnabled,
265
+ } = this.props;
261
266
 
262
267
  if (typeof insertColumnButtonIndex !== 'undefined') {
263
268
  event.preventDefault();
264
269
 
265
- const { isTableScalingEnabled = false } = getPluginState(editorView.state);
270
+ const { tableDuplicateCellColouring = false, tableWithFixedColumnWidthsOption = false } =
271
+ getEditorFeatureFlags ? getEditorFeatureFlags() : {};
266
272
 
267
273
  const shouldUseIncreasedScalingPercent =
268
274
  isTableScalingEnabled &&
269
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
275
+ tableWithFixedColumnWidthsOption &&
270
276
  getBooleanFF('platform.editor.table.use-increased-scaling-percent');
271
277
 
272
- const { tableDuplicateCellColouring = false } = getEditorFeatureFlags
273
- ? getEditorFeatureFlags()
274
- : {};
275
-
276
278
  const { state, dispatch } = editorView;
277
279
  insertColumnWithAnalytics(
278
280
  editorAnalyticsAPI,
279
281
  isTableScalingEnabled,
280
282
  tableDuplicateCellColouring,
283
+ tableWithFixedColumnWidthsOption,
281
284
  shouldUseIncreasedScalingPercent,
282
285
  )(INPUT_METHOD.BUTTON, insertColumnButtonIndex)(state, dispatch, editorView);
283
286
  }
@@ -160,6 +160,7 @@ export const getDragMenuConfig = (
160
160
  isHeaderRowRequired?: boolean,
161
161
  isTableScalingEnabled = false,
162
162
  tableDuplicateCellColouring = false,
163
+ isTableFixedColumnWidthsOptionEnabled = false,
163
164
  shouldUseIncreasedScalingPercent = false,
164
165
  ): DragMenuConfig[] => {
165
166
  const addOptions =
@@ -272,6 +273,7 @@ export const getDragMenuConfig = (
272
273
  editorAnalyticsAPI,
273
274
  isTableScalingEnabled,
274
275
  tableDuplicateCellColouring,
276
+ isTableFixedColumnWidthsOptionEnabled,
275
277
  shouldUseIncreasedScalingPercent,
276
278
  )(INPUT_METHOD.TABLE_CONTEXT_MENU, (index ?? 0) + offset)(state, dispatch, editorView);
277
279
  }
@@ -293,6 +295,7 @@ export const getDragMenuConfig = (
293
295
  editorView.domAtPos.bind(editorView),
294
296
  getEditorContainerWidth,
295
297
  isTableScalingEnabled,
298
+ isTableFixedColumnWidthsOptionEnabled,
296
299
  );
297
300
 
298
301
  if (newResizeState) {
@@ -333,10 +336,16 @@ export const getDragMenuConfig = (
333
336
  !!isHeaderRowRequired,
334
337
  )(state, dispatch);
335
338
  } else {
336
- deleteColumnsWithAnalytics(editorAnalyticsAPI, isTableScalingEnabled)(
337
- INPUT_METHOD.TABLE_CONTEXT_MENU,
338
- selectionRect ?? defaultSelectionRect,
339
- )(state, dispatch, editorView);
339
+ deleteColumnsWithAnalytics(
340
+ editorAnalyticsAPI,
341
+ isTableScalingEnabled,
342
+ isTableFixedColumnWidthsOptionEnabled,
343
+ shouldUseIncreasedScalingPercent,
344
+ )(INPUT_METHOD.TABLE_CONTEXT_MENU, selectionRect ?? defaultSelectionRect)(
345
+ state,
346
+ dispatch,
347
+ editorView,
348
+ );
340
349
  }
341
350
  return true;
342
351
  },