@atlaskit/editor-plugin-table 7.16.18 → 7.17.0

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 (147) hide show
  1. package/CHANGELOG.md +21 -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/ui/TableFloatingControls/index.js +4 -1
  26. package/dist/cjs/utils/drag-menu.js +5 -4
  27. package/dist/es2019/commands/column-resize.js +4 -3
  28. package/dist/es2019/commands/delete.js +2 -2
  29. package/dist/es2019/commands/insert.js +8 -8
  30. package/dist/es2019/commands-with-analytics.js +9 -8
  31. package/dist/es2019/event-handlers.js +2 -2
  32. package/dist/es2019/nodeviews/TableComponent.js +28 -17
  33. package/dist/es2019/nodeviews/TableContainer.js +4 -0
  34. package/dist/es2019/nodeviews/TableResizer.js +3 -2
  35. package/dist/es2019/nodeviews/table.js +5 -4
  36. package/dist/es2019/plugin.js +9 -6
  37. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +7 -10
  38. package/dist/es2019/pm-plugins/keymap.js +9 -9
  39. package/dist/es2019/pm-plugins/main.js +4 -1
  40. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +10 -9
  41. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +4 -4
  42. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +4 -4
  43. package/dist/es2019/toolbar.js +25 -22
  44. package/dist/es2019/transforms/column-width.js +2 -3
  45. package/dist/es2019/transforms/delete-columns.js +2 -2
  46. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +12 -7
  47. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -2
  48. package/dist/es2019/ui/FloatingDragMenu/index.js +5 -3
  49. package/dist/es2019/ui/FloatingInsertButton/index.js +6 -8
  50. package/dist/es2019/ui/TableFloatingControls/index.js +5 -1
  51. package/dist/es2019/utils/drag-menu.js +4 -4
  52. package/dist/esm/commands/column-resize.js +4 -3
  53. package/dist/esm/commands/delete.js +3 -2
  54. package/dist/esm/commands/insert.js +12 -8
  55. package/dist/esm/commands-with-analytics.js +10 -7
  56. package/dist/esm/event-handlers.js +3 -2
  57. package/dist/esm/nodeviews/TableComponent.js +32 -19
  58. package/dist/esm/nodeviews/TableContainer.js +4 -0
  59. package/dist/esm/nodeviews/TableResizer.js +3 -2
  60. package/dist/esm/nodeviews/table.js +6 -4
  61. package/dist/esm/plugin.js +9 -6
  62. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +12 -13
  63. package/dist/esm/pm-plugins/keymap.js +11 -9
  64. package/dist/esm/pm-plugins/main.js +4 -1
  65. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +10 -9
  66. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +4 -3
  67. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +4 -3
  68. package/dist/esm/toolbar.js +29 -20
  69. package/dist/esm/transforms/column-width.js +3 -3
  70. package/dist/esm/transforms/delete-columns.js +3 -2
  71. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +21 -15
  72. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -2
  73. package/dist/esm/ui/FloatingDragMenu/index.js +6 -3
  74. package/dist/esm/ui/FloatingInsertButton/index.js +7 -8
  75. package/dist/esm/ui/TableFloatingControls/index.js +4 -1
  76. package/dist/esm/utils/drag-menu.js +5 -4
  77. package/dist/types/commands/column-resize.d.ts +2 -1
  78. package/dist/types/commands/delete.d.ts +1 -1
  79. package/dist/types/commands/insert.d.ts +4 -4
  80. package/dist/types/commands-with-analytics.d.ts +4 -4
  81. package/dist/types/event-handlers.d.ts +1 -1
  82. package/dist/types/nodeviews/TableContainer.d.ts +4 -2
  83. package/dist/types/nodeviews/TableResizer.d.ts +2 -1
  84. package/dist/types/nodeviews/table.d.ts +1 -0
  85. package/dist/types/plugin.d.ts +3 -1
  86. package/dist/types/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
  87. package/dist/types/pm-plugins/keymap.d.ts +1 -1
  88. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  89. package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
  90. package/dist/types/toolbar.d.ts +5 -5
  91. package/dist/types/transforms/column-width.d.ts +1 -1
  92. package/dist/types/transforms/delete-columns.d.ts +1 -1
  93. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  94. package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -0
  95. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +8 -2
  96. package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +16 -4
  97. package/dist/types/ui/TableFloatingControls/index.d.ts +8 -2
  98. package/dist/types/utils/drag-menu.d.ts +1 -1
  99. package/dist/types-ts4.5/commands/column-resize.d.ts +2 -1
  100. package/dist/types-ts4.5/commands/delete.d.ts +1 -1
  101. package/dist/types-ts4.5/commands/insert.d.ts +4 -4
  102. package/dist/types-ts4.5/commands-with-analytics.d.ts +4 -4
  103. package/dist/types-ts4.5/event-handlers.d.ts +1 -1
  104. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
  105. package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +2 -1
  106. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -0
  107. package/dist/types-ts4.5/plugin.d.ts +3 -1
  108. package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin.d.ts +1 -1
  109. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
  110. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  111. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
  112. package/dist/types-ts4.5/toolbar.d.ts +5 -5
  113. package/dist/types-ts4.5/transforms/column-width.d.ts +1 -1
  114. package/dist/types-ts4.5/transforms/delete-columns.d.ts +1 -1
  115. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -1
  116. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -0
  117. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +10 -2
  118. package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +20 -4
  119. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +10 -2
  120. package/dist/types-ts4.5/utils/drag-menu.d.ts +1 -1
  121. package/package.json +3 -9
  122. package/src/commands/column-resize.ts +6 -6
  123. package/src/commands/delete.ts +7 -1
  124. package/src/commands/insert.ts +33 -5
  125. package/src/commands-with-analytics.ts +14 -2
  126. package/src/event-handlers.ts +2 -0
  127. package/src/nodeviews/TableComponent.tsx +28 -28
  128. package/src/nodeviews/TableContainer.tsx +6 -0
  129. package/src/nodeviews/TableResizer.tsx +4 -0
  130. package/src/nodeviews/table.tsx +4 -2
  131. package/src/plugin.tsx +19 -7
  132. package/src/pm-plugins/drag-and-drop/plugin.ts +26 -13
  133. package/src/pm-plugins/keymap.ts +30 -4
  134. package/src/pm-plugins/main.ts +2 -0
  135. package/src/pm-plugins/table-resizing/event-handlers.ts +12 -14
  136. package/src/pm-plugins/table-resizing/utils/resize-state.ts +5 -5
  137. package/src/pm-plugins/table-resizing/utils/scale-table.ts +6 -4
  138. package/src/toolbar.tsx +46 -12
  139. package/src/transforms/column-width.ts +7 -3
  140. package/src/transforms/delete-columns.ts +6 -2
  141. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +12 -4
  142. package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -0
  143. package/src/ui/FloatingDragMenu/index.tsx +4 -4
  144. package/src/ui/FloatingInsertButton/index.tsx +12 -9
  145. package/src/ui/TableFloatingControls/index.tsx +4 -1
  146. package/src/utils/drag-menu.ts +13 -4
  147. package/tsconfig.app.json +3 -0
@@ -155,7 +155,11 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
155
155
  };
156
156
  }, {
157
157
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
158
- } | undefined>>
158
+ } | undefined>>,
159
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
160
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
161
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
162
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
159
163
  ];
160
164
  }, import("../../../plugin").TablePluginOptions | undefined>,
161
165
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
@@ -281,7 +285,11 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
281
285
  };
282
286
  }, {
283
287
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
284
- } | undefined>>
288
+ } | undefined>>,
289
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
290
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
291
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
292
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
285
293
  ]> | undefined;
286
294
  }) => JSX.Element;
287
295
  export default ColumnControls;
@@ -136,7 +136,11 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
136
136
  };
137
137
  }, {
138
138
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
139
- } | undefined>>
139
+ } | undefined>>,
140
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
141
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
142
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
143
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
140
144
  ];
141
145
  }, import("../../../plugin").TablePluginOptions | undefined>,
142
146
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
@@ -262,7 +266,11 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
262
266
  };
263
267
  }, {
264
268
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
265
- } | undefined>>
269
+ } | undefined>>,
270
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
271
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
272
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
273
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
266
274
  ]> | undefined;
267
275
  }>> & {
268
276
  WrappedComponent: React.ComponentType<CornerControlProps & WrappedComponentProps & {
@@ -400,7 +408,11 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
400
408
  };
401
409
  }, {
402
410
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
403
- } | undefined>>
411
+ } | undefined>>,
412
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
413
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
414
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
415
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
404
416
  ];
405
417
  }, import("../../../plugin").TablePluginOptions | undefined>,
406
418
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
@@ -526,7 +538,11 @@ export declare const DragCornerControlsWithSelection: React.FC<import("react-int
526
538
  };
527
539
  }, {
528
540
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
529
- } | undefined>>
541
+ } | undefined>>,
542
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
543
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
544
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
545
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
530
546
  ]> | undefined;
531
547
  }>;
532
548
  };
@@ -164,7 +164,11 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
164
164
  };
165
165
  }, {
166
166
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
167
- } | undefined>>
167
+ } | undefined>>,
168
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
169
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
170
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
171
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
168
172
  ];
169
173
  }, import("../../plugin").TablePluginOptions | undefined>,
170
174
  import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
@@ -290,7 +294,11 @@ export declare const TableFloatingControls: ({ editorView, tableRef, tableNode,
290
294
  };
291
295
  }, {
292
296
  mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
293
- } | undefined>>
297
+ } | undefined>>,
298
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
299
+ pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
300
+ sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
301
+ }, import("@atlaskit/editor-common/types").FeatureFlags>>
294
302
  ]> | undefined;
295
303
  }) => JSX.Element | null;
296
304
  export default TableFloatingControls;
@@ -13,4 +13,4 @@ export interface DragMenuConfig extends DropdownOptionT<Command> {
13
13
  icon?: React.ComponentType<React.PropsWithChildren<IconProps>>;
14
14
  keymap?: string;
15
15
  }
16
- export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, shouldUseIncreasedScalingPercent?: boolean) => DragMenuConfig[];
16
+ export declare const getDragMenuConfig: (direction: TableDirection, getEditorContainerWidth: GetEditorContainerWidth, canDrag: boolean, hasMergedCellsInTable: boolean, editorView: EditorView, tableMap?: TableMap, index?: number, targetCellPosition?: number, selectionRect?: Rect, editorAnalyticsAPI?: EditorAnalyticsAPI, isHeaderRowRequired?: boolean, isTableScalingEnabled?: boolean, tableDuplicateCellColouring?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean) => DragMenuConfig[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.16.18",
3
+ "version": "7.17.0",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/adf-schema": "^36.10.7",
32
32
  "@atlaskit/button": "^17.17.0",
33
33
  "@atlaskit/custom-steps": "^0.2.0",
34
- "@atlaskit/editor-common": "^82.1.0",
34
+ "@atlaskit/editor-common": "^82.3.0",
35
35
  "@atlaskit/editor-palette": "1.6.0",
36
36
  "@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/primitives": "^7.0.0",
53
53
  "@atlaskit/theme": "^12.9.0",
54
54
  "@atlaskit/toggle": "^13.1.0",
55
- "@atlaskit/tokens": "^1.49.0",
55
+ "@atlaskit/tokens": "^1.50.0",
56
56
  "@atlaskit/tooltip": "^18.4.0",
57
57
  "@babel/runtime": "^7.0.0",
58
58
  "@emotion/react": "^11.7.1",
@@ -123,9 +123,6 @@
123
123
  "platform.editor.table.cmd-a-select-table": {
124
124
  "type": "boolean"
125
125
  },
126
- "platform.editor.table.preserve-widths-with-lock-button": {
127
- "type": "boolean"
128
- },
129
126
  "platform.editor.table.use-shared-state-hook": {
130
127
  "type": "boolean"
131
128
  },
@@ -146,9 +143,6 @@
146
143
  },
147
144
  "platform.editor.table.editor-num-col-style-changes": {
148
145
  "type": "boolean"
149
- },
150
- "platform.editor.drag-and-drop_wmv9t": {
151
- "type": "boolean"
152
146
  }
153
147
  }
154
148
  }
@@ -257,12 +257,14 @@ export const changeColumnWidthByStep =
257
257
  stepSize,
258
258
  getEditorContainerWidth,
259
259
  isTableScalingEnabled,
260
+ isTableFixedColumnWidthsOptionEnabled,
260
261
  ariaNotify,
261
262
  getIntl,
262
263
  }: {
263
264
  stepSize: number;
264
265
  getEditorContainerWidth: GetEditorContainerWidth;
265
266
  isTableScalingEnabled: boolean;
267
+ isTableFixedColumnWidthsOptionEnabled: boolean;
266
268
  ariaNotify?: (message: string, ariaLiveElementAttributes?: AriaLiveElementAttributes) => void;
267
269
  getIntl?: () => IntlShape;
268
270
  originalTr?: Transaction;
@@ -326,15 +328,13 @@ export const changeColumnWidthByStep =
326
328
  });
327
329
 
328
330
  let isTableScalingEnabledOnCurrentTable = isTableScalingEnabled;
329
- const isTableScalingEnabledWithLockButton =
330
- isTableScalingEnabled &&
331
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
332
- if (isTableScalingEnabledWithLockButton) {
331
+ const isTableScalingWithFixedColumnWidthsOptionEnabled =
332
+ isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled;
333
+ if (isTableScalingWithFixedColumnWidthsOptionEnabled) {
333
334
  isTableScalingEnabledOnCurrentTable = originalTable.attrs.displayMode !== 'fixed';
334
335
  }
335
-
336
336
  const shouldUseIncreasedScalingPercent =
337
- isTableScalingEnabledWithLockButton &&
337
+ isTableScalingWithFixedColumnWidthsOptionEnabled &&
338
338
  getBooleanFF('platform.editor.table.use-increased-scaling-percent');
339
339
 
340
340
  const initialResizeState = getResizeState({
@@ -5,13 +5,19 @@ import { deleteColumns } from '../transforms/delete-columns';
5
5
  import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
6
6
 
7
7
  export const deleteColumnsCommand =
8
- (rect: Rect, isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false): Command =>
8
+ (
9
+ rect: Rect,
10
+ isTableScalingEnabled = false,
11
+ isTableFixedColumnWidthsOptionEnabled = false,
12
+ shouldUseIncreasedScalingPercent = false,
13
+ ): Command =>
9
14
  (state, dispatch, view) => {
10
15
  const tr = deleteColumns(
11
16
  rect,
12
17
  getAllowAddColumnCustomStep(state),
13
18
  view,
14
19
  isTableScalingEnabled,
20
+ isTableFixedColumnWidthsOptionEnabled,
15
21
  shouldUseIncreasedScalingPercent,
16
22
  )(state.tr);
17
23
  if (dispatch) {
@@ -41,6 +41,7 @@ function addColumnAtCustomStep(column: number) {
41
41
  export function addColumnAt(
42
42
  isTableScalingEnabled = false,
43
43
  isCellBackgroundDuplicated?: boolean,
44
+ isTableFixedColumnWidthsOptionEnabled?: boolean,
44
45
  shouldUseIncreasedScalingPercent?: boolean,
45
46
  ) {
46
47
  return (
@@ -58,7 +59,11 @@ export function addColumnAt(
58
59
  const table = findTable(updatedTr.selection);
59
60
  if (table) {
60
61
  // [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
61
- updatedTr = rescaleColumns(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(
62
+ updatedTr = rescaleColumns(
63
+ isTableScalingEnabled,
64
+ isTableFixedColumnWidthsOptionEnabled,
65
+ shouldUseIncreasedScalingPercent,
66
+ )(
62
67
  table,
63
68
  view,
64
69
  )(updatedTr);
@@ -83,7 +88,12 @@ export function addColumnAt(
83
88
  // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
84
89
  // Command to add a column before the column with the selection.
85
90
  export const addColumnBefore =
86
- (isTableScalingEnabled = false, shouldUseIncreasedScalingPercent = false): Command =>
91
+ (
92
+ isTableScalingEnabled = false,
93
+ isCellBackgroundDuplicated = false,
94
+ isTableFixedColumnWidthsOptionEnabled = false,
95
+ shouldUseIncreasedScalingPercent = false,
96
+ ): Command =>
87
97
  (state, dispatch, view) => {
88
98
  const table = findTable(state.selection);
89
99
  if (!table) {
@@ -92,7 +102,12 @@ export const addColumnBefore =
92
102
  if (dispatch) {
93
103
  let rect = selectedRect(state);
94
104
  dispatch(
95
- addColumnAt(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(
105
+ addColumnAt(
106
+ isTableScalingEnabled,
107
+ isCellBackgroundDuplicated,
108
+ isTableFixedColumnWidthsOptionEnabled,
109
+ shouldUseIncreasedScalingPercent,
110
+ )(
96
111
  rect.left,
97
112
  getAllowAddColumnCustomStep(state),
98
113
  view,
@@ -105,16 +120,27 @@ export const addColumnBefore =
105
120
  // :: (EditorState, dispatch: ?(tr: Transaction)) → bool
106
121
  // Command to add a column after the column with the selection.
107
122
  export const addColumnAfter =
108
- (isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean): Command =>
123
+ (
124
+ isTableScalingEnabled?: boolean,
125
+ isCellBackgroundDuplicated?: boolean,
126
+ isTableFixedColumnWidthsOptionEnabled?: boolean,
127
+ shouldUseIncreasedScalingPercent?: boolean,
128
+ ): Command =>
109
129
  (state, dispatch, view) => {
110
130
  const table = findTable(state.selection);
111
131
  if (!table) {
112
132
  return false;
113
133
  }
134
+
114
135
  if (dispatch) {
115
136
  let rect = selectedRect(state);
116
137
  dispatch(
117
- addColumnAt(isTableScalingEnabled, shouldUseIncreasedScalingPercent)(
138
+ addColumnAt(
139
+ isTableScalingEnabled,
140
+ isCellBackgroundDuplicated,
141
+ isTableFixedColumnWidthsOptionEnabled,
142
+ shouldUseIncreasedScalingPercent,
143
+ )(
118
144
  rect.right,
119
145
  getAllowAddColumnCustomStep(state),
120
146
  view,
@@ -128,6 +154,7 @@ export const insertColumn =
128
154
  (
129
155
  isTableScalingEnabled = false,
130
156
  isCellBackgroundDuplicated?: boolean,
157
+ isTableFixedColumnWidthsOptionEnabled?: boolean,
131
158
  shouldUseIncreasedScalingPercent?: boolean,
132
159
  ) =>
133
160
  (column: number): Command =>
@@ -135,6 +162,7 @@ export const insertColumn =
135
162
  let tr = addColumnAt(
136
163
  isTableScalingEnabled,
137
164
  isCellBackgroundDuplicated,
165
+ isTableFixedColumnWidthsOptionEnabled,
138
166
  shouldUseIncreasedScalingPercent,
139
167
  )(
140
168
  column,
@@ -240,6 +240,7 @@ export const changeColumnWidthByStepWithAnalytics =
240
240
  stepSize: number,
241
241
  getEditorContainerWidth: GetEditorContainerWidth,
242
242
  isTableScalingEnabled: boolean,
243
+ isTableFixedColumnWidthsOptionEnabled: boolean,
243
244
  inputMethod: INPUT_METHOD.SHORTCUT,
244
245
  ariaNotify?: (message: string) => void,
245
246
  getIntl?: () => IntlShape,
@@ -268,7 +269,8 @@ export const changeColumnWidthByStepWithAnalytics =
268
269
  changeColumnWidthByStep({
269
270
  stepSize: stepSize,
270
271
  getEditorContainerWidth: getEditorContainerWidth,
271
- isTableScalingEnabled: isTableScalingEnabled,
272
+ isTableScalingEnabled,
273
+ isTableFixedColumnWidthsOptionEnabled,
272
274
  ariaNotify: ariaNotify,
273
275
  getIntl: getIntl,
274
276
  }),
@@ -279,6 +281,7 @@ export const insertColumnWithAnalytics =
279
281
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
280
282
  isTableScalingEnabled = false,
281
283
  isCellbackgroundDuplicated = false,
284
+ isTableFixedColumnWidthsOptionEnabled = false,
282
285
  shouldUseIncreasedScalingPercent = false,
283
286
  ) =>
284
287
  (
@@ -308,6 +311,7 @@ export const insertColumnWithAnalytics =
308
311
  insertColumn(
309
312
  isTableScalingEnabled,
310
313
  isCellbackgroundDuplicated,
314
+ isTableFixedColumnWidthsOptionEnabled,
311
315
  shouldUseIncreasedScalingPercent,
312
316
  )(position),
313
317
  );
@@ -351,6 +355,7 @@ export const deleteColumnsWithAnalytics =
351
355
  (
352
356
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
353
357
  isTableScalingEnabled = false,
358
+ isTableFixedColumnWidthsOptionEnabled = false,
354
359
  shouldUseIncreasedScalingPercent = false,
355
360
  ) =>
356
361
  (
@@ -379,13 +384,19 @@ export const deleteColumnsWithAnalytics =
379
384
  eventType: EVENT_TYPE.TRACK,
380
385
  };
381
386
  })(editorAnalyticsAPI)(
382
- deleteColumnsCommand(rect, isTableScalingEnabled, shouldUseIncreasedScalingPercent),
387
+ deleteColumnsCommand(
388
+ rect,
389
+ isTableScalingEnabled,
390
+ isTableFixedColumnWidthsOptionEnabled,
391
+ shouldUseIncreasedScalingPercent,
392
+ ),
383
393
  );
384
394
 
385
395
  export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
386
396
  (
387
397
  editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
388
398
  isTableScalingEnabled?: boolean,
399
+ isTableFixedColumnWidthsOptionEnabled?: boolean,
389
400
  shouldUseIncreasedScalingPercent?: boolean,
390
401
  ): Command =>
391
402
  (state, dispatch) => {
@@ -414,6 +425,7 @@ export const deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut =
414
425
  return deleteColumnsWithAnalytics(
415
426
  editorAnalyticsAPI,
416
427
  isTableScalingEnabled,
428
+ isTableFixedColumnWidthsOptionEnabled,
417
429
  shouldUseIncreasedScalingPercent,
418
430
  )(INPUT_METHOD.SHORTCUT, rect)(state, dispatch);
419
431
  } else {
@@ -477,6 +477,7 @@ export const handleCut = (
477
477
  editorAnalyticsAPI?: EditorAnalyticsAPI,
478
478
  editorView?: EditorView,
479
479
  isTableScalingEnabled = false,
480
+ isTableFixedColumnWidthsOptionEnabled = false,
480
481
  shouldUseIncreasedScalingPercent = false,
481
482
  ): Transaction => {
482
483
  const oldSelection = oldState.tr.selection;
@@ -525,6 +526,7 @@ export const handleCut = (
525
526
  getAllowAddColumnCustomStep(oldState),
526
527
  editorView,
527
528
  isTableScalingEnabled,
529
+ isTableFixedColumnWidthsOptionEnabled,
528
530
  shouldUseIncreasedScalingPercent,
529
531
  )(tr);
530
532
  }
@@ -204,16 +204,15 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
204
204
  }
205
205
  }
206
206
 
207
- if (
208
- isTableScalingEnabled &&
209
- !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
210
- ) {
207
+ const { tableWithFixedColumnWidthsOption = false, stickyScrollbar } = getEditorFeatureFlags();
208
+
209
+ if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
211
210
  this.handleColgroupUpdates(true);
212
211
  }
213
212
 
214
213
  if (
215
214
  isTableScalingEnabled &&
216
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
215
+ tableWithFixedColumnWidthsOption &&
217
216
  getNode().attrs.displayMode !== 'fixed'
218
217
  ) {
219
218
  this.handleColgroupUpdates(true);
@@ -224,8 +223,6 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
224
223
  passive: true,
225
224
  });
226
225
 
227
- const { stickyScrollbar } = getEditorFeatureFlags();
228
-
229
226
  if (stickyScrollbar) {
230
227
  if (this.table) {
231
228
  this.stickyScrollbar = new TableStickyScrollbar(this.wrapper, this.props.view);
@@ -332,7 +329,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
332
329
  };
333
330
 
334
331
  handleColgroupUpdates(force = false) {
335
- const { getNode, containerWidth, isResizing, view, getPos } = this.props;
332
+ const { getNode, containerWidth, isResizing, view, getPos, getEditorFeatureFlags } = this.props;
336
333
 
337
334
  if (!this.table) {
338
335
  return;
@@ -383,12 +380,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
383
380
  isNumberColumnChanged ||
384
381
  isNumberOfColumnsChanged;
385
382
 
386
- const isTableScalingEnabledWithLockButton =
387
- this.props.options?.isTableScalingEnabled &&
388
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
383
+ const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
384
+
385
+ const isTableScalingWithFixedColumnWidthsOptionEnabled =
386
+ this.props.options?.isTableScalingEnabled && tableWithFixedColumnWidthsOption;
389
387
 
390
388
  const shouldUseIncreasedScalingPercent =
391
- (isTableScalingEnabledWithLockButton &&
389
+ (isTableScalingWithFixedColumnWidthsOptionEnabled &&
392
390
  getBooleanFF('platform.editor.table.use-increased-scaling-percent')) ||
393
391
  false;
394
392
 
@@ -405,14 +403,14 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
405
403
  });
406
404
 
407
405
  let shouldScaleOnColgroupUpdate = false;
408
- if (
409
- this.props.options?.isTableScalingEnabled &&
410
- !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
411
- ) {
406
+ if (this.props.options?.isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
412
407
  shouldScaleOnColgroupUpdate = true;
413
408
  }
414
409
 
415
- if (isTableScalingEnabledWithLockButton && tableNode.attrs.displayMode !== 'fixed') {
410
+ if (
411
+ isTableScalingWithFixedColumnWidthsOptionEnabled &&
412
+ tableNode.attrs.displayMode !== 'fixed'
413
+ ) {
416
414
  shouldScaleOnColgroupUpdate = true;
417
415
  }
418
416
 
@@ -443,6 +441,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
443
441
  options,
444
442
  isTableScalingEnabled, // we could use options.isTableScalingEnabled here
445
443
  getPos,
444
+ getEditorFeatureFlags,
446
445
  } = this.props;
447
446
  let { isInDanger } = this.props;
448
447
 
@@ -455,23 +454,23 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
455
454
 
456
455
  let shouldScale = false;
457
456
  let shouldHandleColgroupUpdates = false;
457
+ const { tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
458
458
 
459
- if (
460
- isTableScalingEnabled &&
461
- !getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
462
- ) {
459
+ if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
463
460
  shouldScale = true;
464
461
  shouldHandleColgroupUpdates = true;
465
462
  }
466
463
 
467
- const isTableScalingEnabledWithLockButton =
468
- isTableScalingEnabled &&
469
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
464
+ const isTableScalingWithFixedColumnWidthsOptionEnabled =
465
+ isTableScalingEnabled && tableWithFixedColumnWidthsOption;
470
466
  const shouldUseIncreasedScalingPercent =
471
- isTableScalingEnabledWithLockButton &&
467
+ isTableScalingWithFixedColumnWidthsOptionEnabled &&
472
468
  getBooleanFF('platform.editor.table.use-increased-scaling-percent');
473
469
 
474
- if (isTableScalingEnabledWithLockButton && getNode().attrs.displayMode !== 'fixed') {
470
+ if (
471
+ isTableScalingWithFixedColumnWidthsOptionEnabled &&
472
+ getNode().attrs.displayMode !== 'fixed'
473
+ ) {
475
474
  shouldScale = true;
476
475
  shouldHandleColgroupUpdates = true;
477
476
  }
@@ -743,11 +742,11 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
743
742
  : this.state.stickyHeader &&
744
743
  this.state.stickyHeader.top + this.state.stickyHeader.padding + shadowPadding + 2;
745
744
 
746
- const { stickyScrollbar } = getEditorFeatureFlags();
745
+ const { stickyScrollbar, tableWithFixedColumnWidthsOption = false } = getEditorFeatureFlags();
747
746
 
748
747
  const shouldUseIncreasedScalingPercent =
749
748
  isTableScalingEnabled &&
750
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
749
+ tableWithFixedColumnWidthsOption &&
751
750
  getBooleanFF('platform.editor.table.use-increased-scaling-percent');
752
751
 
753
752
  return (
@@ -770,6 +769,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
770
769
  isTableResizingEnabled={options?.isTableResizingEnabled}
771
770
  isResizing={isResizing}
772
771
  isTableScalingEnabled={isTableScalingEnabled}
772
+ isTableWithFixedColumnWidthsOptionEnabled={tableWithFixedColumnWidthsOption}
773
773
  isWholeTableInDanger={isWholeTableInDanger}
774
774
  isTableAlignmentEnabled={isTableAlignmentEnabled}
775
775
  shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
@@ -171,6 +171,7 @@ type ResizableTableContainerProps = {
171
171
  isWholeTableInDanger?: boolean;
172
172
 
173
173
  isTableScalingEnabled?: boolean;
174
+ isTableWithFixedColumnWidthsOptionEnabled?: boolean;
174
175
  isTableAlignmentEnabled?: boolean;
175
176
  shouldUseIncreasedScalingPercent?: boolean;
176
177
  };
@@ -190,6 +191,7 @@ export const ResizableTableContainer = React.memo(
190
191
  tableWrapperHeight,
191
192
  isWholeTableInDanger,
192
193
  isTableScalingEnabled,
194
+ isTableWithFixedColumnWidthsOptionEnabled,
193
195
  isTableAlignmentEnabled,
194
196
  shouldUseIncreasedScalingPercent,
195
197
  }: PropsWithChildren<ResizableTableContainerProps>) => {
@@ -319,6 +321,7 @@ export const ResizableTableContainer = React.memo(
319
321
  isTableAlignmentEnabled,
320
322
  isFullWidthModeEnabled,
321
323
  isTableScalingEnabled,
324
+ isTableWithFixedColumnWidthsOptionEnabled,
322
325
  isWholeTableInDanger,
323
326
  shouldUseIncreasedScalingPercent,
324
327
  pluginInjectionApi,
@@ -385,6 +388,7 @@ type TableContainerProps = {
385
388
 
386
389
  isTableResizingEnabled: boolean | undefined;
387
390
  isTableScalingEnabled?: boolean;
391
+ isTableWithFixedColumnWidthsOptionEnabled?: boolean;
388
392
  isTableAlignmentEnabled?: boolean;
389
393
  shouldUseIncreasedScalingPercent?: boolean;
390
394
  };
@@ -404,6 +408,7 @@ export const TableContainer = ({
404
408
  isWholeTableInDanger,
405
409
  isTableResizingEnabled,
406
410
  isTableScalingEnabled,
411
+ isTableWithFixedColumnWidthsOptionEnabled,
407
412
  isTableAlignmentEnabled,
408
413
  shouldUseIncreasedScalingPercent,
409
414
  }: PropsWithChildren<TableContainerProps>) => {
@@ -422,6 +427,7 @@ export const TableContainer = ({
422
427
  isResizing={isResizing}
423
428
  pluginInjectionApi={pluginInjectionApi}
424
429
  isTableScalingEnabled={isTableScalingEnabled}
430
+ isTableWithFixedColumnWidthsOptionEnabled={isTableWithFixedColumnWidthsOptionEnabled}
425
431
  isWholeTableInDanger={isWholeTableInDanger}
426
432
  isTableAlignmentEnabled={isTableAlignmentEnabled}
427
433
  shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
@@ -78,6 +78,7 @@ interface TableResizerProps {
78
78
  displayGapCursor: (toggle: boolean) => boolean;
79
79
  pluginInjectionApi?: PluginInjectionAPI;
80
80
  isTableScalingEnabled?: boolean;
81
+ isTableWithFixedColumnWidthsOptionEnabled?: boolean;
81
82
  isTableAlignmentEnabled?: boolean;
82
83
  isWholeTableInDanger?: boolean;
83
84
  isFullWidthModeEnabled?: boolean;
@@ -193,6 +194,7 @@ export const TableResizer = ({
193
194
  attachAnalyticsEvent,
194
195
  displayGapCursor,
195
196
  isTableScalingEnabled,
197
+ isTableWithFixedColumnWidthsOptionEnabled,
196
198
  isTableAlignmentEnabled,
197
199
  isWholeTableInDanger,
198
200
  shouldUseIncreasedScalingPercent,
@@ -413,6 +415,7 @@ export const TableResizer = ({
413
415
  },
414
416
  editorView.domAtPos.bind(editorView),
415
417
  isTableScalingEnabled,
418
+ isTableWithFixedColumnWidthsOptionEnabled,
416
419
  );
417
420
 
418
421
  const editorContainerWidth = isFullWidthModeEnabled
@@ -470,6 +473,7 @@ export const TableResizer = ({
470
473
  [
471
474
  countFrames,
472
475
  isTableScalingEnabled,
476
+ isTableWithFixedColumnWidthsOptionEnabled,
473
477
  isFullWidthModeEnabled,
474
478
  excludeGuidelineConfig,
475
479
  tableRef,
@@ -92,6 +92,7 @@ export default class TableView extends ReactNodeView<Props> {
92
92
  eventDispatcher?: EventDispatcher;
93
93
  getPos: getPosHandlerNode;
94
94
  options;
95
+ getEditorFeatureFlags;
95
96
 
96
97
  constructor(props: Props) {
97
98
  super(
@@ -109,6 +110,7 @@ export default class TableView extends ReactNodeView<Props> {
109
110
  this.getPos = props.getPos;
110
111
  this.eventDispatcher = props.eventDispatcher;
111
112
  this.options = props.options;
113
+ this.getEditorFeatureFlags = props.getEditorFeatureFlags;
112
114
  }
113
115
 
114
116
  getContentDOM() {
@@ -126,7 +128,7 @@ export default class TableView extends ReactNodeView<Props> {
126
128
  if (
127
129
  !this.options?.isTableScalingEnabled ||
128
130
  (this.options?.isTableScalingEnabled &&
129
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
131
+ this.getEditorFeatureFlags?.().tableWithFixedColumnWidthsOption &&
130
132
  this.node.attrs.displayMode === 'fixed')
131
133
  ) {
132
134
  const tableInlineWidth = getInlineWidth(
@@ -157,7 +159,7 @@ export default class TableView extends ReactNodeView<Props> {
157
159
  if (
158
160
  !this.options?.isTableScalingEnabled ||
159
161
  (this.options?.isTableScalingEnabled &&
160
- getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') &&
162
+ this.getEditorFeatureFlags?.().tableWithFixedColumnWidthsOption &&
161
163
  node.attrs.displayMode === 'fixed')
162
164
  ) {
163
165
  // handle inline style when table been resized