@atlaskit/editor-plugin-table 7.23.0 → 7.24.1

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 (93) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/cjs/nodeviews/TableComponent.js +6 -3
  3. package/dist/cjs/nodeviews/TableContainer.js +4 -2
  4. package/dist/cjs/nodeviews/lazy-node-views.js +4 -3
  5. package/dist/cjs/nodeviews/table.js +3 -2
  6. package/dist/cjs/plugin.js +5 -3
  7. package/dist/cjs/pm-plugins/main.js +4 -7
  8. package/dist/cjs/pm-plugins/table-resizing/utils/resize-column.js +34 -19
  9. package/dist/cjs/pm-plugins/table-resizing/utils/resize-logic.js +3 -0
  10. package/dist/cjs/toolbar.js +15 -12
  11. package/dist/cjs/types.js +2 -0
  12. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +14 -8
  13. package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +6 -5
  14. package/dist/cjs/ui/FloatingInsertButton/index.js +5 -3
  15. package/dist/cjs/ui/TableFloatingColumnControls/index.js +4 -3
  16. package/dist/cjs/ui/TableFloatingControls/index.js +3 -2
  17. package/dist/cjs/ui/common-styles.js +1 -1
  18. package/dist/cjs/ui/ui-styles.js +1 -1
  19. package/dist/es2019/nodeviews/TableComponent.js +6 -3
  20. package/dist/es2019/nodeviews/TableContainer.js +4 -2
  21. package/dist/es2019/nodeviews/lazy-node-views.js +4 -3
  22. package/dist/es2019/nodeviews/table.js +3 -2
  23. package/dist/es2019/plugin.js +5 -3
  24. package/dist/es2019/pm-plugins/main.js +4 -7
  25. package/dist/es2019/pm-plugins/table-resizing/utils/resize-column.js +41 -25
  26. package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +1 -0
  27. package/dist/es2019/toolbar.js +15 -12
  28. package/dist/es2019/types.js +2 -0
  29. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +14 -8
  30. package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +8 -6
  31. package/dist/es2019/ui/FloatingInsertButton/index.js +6 -4
  32. package/dist/es2019/ui/TableFloatingColumnControls/index.js +5 -4
  33. package/dist/es2019/ui/TableFloatingControls/index.js +3 -2
  34. package/dist/es2019/ui/common-styles.js +8 -0
  35. package/dist/es2019/ui/ui-styles.js +4 -0
  36. package/dist/esm/nodeviews/TableComponent.js +6 -3
  37. package/dist/esm/nodeviews/TableContainer.js +4 -2
  38. package/dist/esm/nodeviews/lazy-node-views.js +4 -3
  39. package/dist/esm/nodeviews/table.js +3 -2
  40. package/dist/esm/plugin.js +5 -3
  41. package/dist/esm/pm-plugins/main.js +4 -7
  42. package/dist/esm/pm-plugins/table-resizing/utils/resize-column.js +35 -21
  43. package/dist/esm/pm-plugins/table-resizing/utils/resize-logic.js +3 -0
  44. package/dist/esm/toolbar.js +15 -12
  45. package/dist/esm/types.js +2 -0
  46. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +14 -8
  47. package/dist/esm/ui/FloatingInsertButton/InsertButton.js +6 -5
  48. package/dist/esm/ui/FloatingInsertButton/index.js +6 -4
  49. package/dist/esm/ui/TableFloatingColumnControls/index.js +5 -4
  50. package/dist/esm/ui/TableFloatingControls/index.js +3 -2
  51. package/dist/esm/ui/common-styles.js +1 -1
  52. package/dist/esm/ui/ui-styles.js +1 -1
  53. package/dist/types/nodeviews/TableContainer.d.ts +2 -1
  54. package/dist/types/nodeviews/lazy-node-views.d.ts +1 -0
  55. package/dist/types/nodeviews/table.d.ts +1 -1
  56. package/dist/types/nodeviews/types.d.ts +1 -0
  57. package/dist/types/plugin.d.ts +1 -0
  58. package/dist/types/pm-plugins/main.d.ts +1 -1
  59. package/dist/types/types.d.ts +2 -0
  60. package/dist/types/ui/FloatingInsertButton/InsertButton.d.ts +2 -1
  61. package/dist/types/ui/FloatingInsertButton/index.d.ts +1 -0
  62. package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -1
  63. package/dist/types/ui/TableFloatingControls/index.d.ts +2 -1
  64. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +2 -1
  65. package/dist/types-ts4.5/nodeviews/lazy-node-views.d.ts +1 -0
  66. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
  67. package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
  68. package/dist/types-ts4.5/plugin.d.ts +1 -0
  69. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  70. package/dist/types-ts4.5/types.d.ts +2 -0
  71. package/dist/types-ts4.5/ui/FloatingInsertButton/InsertButton.d.ts +2 -1
  72. package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +1 -0
  73. package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -1
  74. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +2 -1
  75. package/package.json +6 -6
  76. package/src/nodeviews/TableComponent.tsx +3 -0
  77. package/src/nodeviews/TableContainer.tsx +3 -0
  78. package/src/nodeviews/lazy-node-views.ts +4 -0
  79. package/src/nodeviews/table.tsx +2 -0
  80. package/src/nodeviews/types.ts +1 -0
  81. package/src/plugin.tsx +4 -0
  82. package/src/pm-plugins/main.ts +3 -4
  83. package/src/pm-plugins/table-resizing/utils/resize-column.ts +59 -31
  84. package/src/pm-plugins/table-resizing/utils/resize-logic.ts +1 -0
  85. package/src/toolbar.tsx +19 -14
  86. package/src/types.ts +2 -0
  87. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +20 -7
  88. package/src/ui/FloatingInsertButton/InsertButton.tsx +12 -4
  89. package/src/ui/FloatingInsertButton/index.tsx +5 -2
  90. package/src/ui/TableFloatingColumnControls/index.tsx +8 -3
  91. package/src/ui/TableFloatingControls/index.tsx +5 -1
  92. package/src/ui/common-styles.ts +8 -0
  93. package/src/ui/ui-styles.ts +4 -0
package/src/plugin.tsx CHANGED
@@ -98,6 +98,7 @@ export interface TablePluginOptions {
98
98
  isTableAlignmentEnabled?: boolean;
99
99
  isNewColumnResizingEnabled?: boolean;
100
100
  isCommentEditor?: boolean;
101
+ isChromelessEditor?: boolean;
101
102
  }
102
103
 
103
104
  type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
@@ -329,6 +330,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
329
330
  isTableScalingEnabled,
330
331
  isTableAlignmentEnabled,
331
332
  isCommentEditor,
333
+ isChromelessEditor,
332
334
  } = options || ({} as TablePluginOptions);
333
335
 
334
336
  return createPlugin(
@@ -350,6 +352,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
350
352
  isTableAlignmentEnabled,
351
353
  shouldUseIncreasedScalingPercent,
352
354
  isCommentEditor,
355
+ isChromelessEditor,
353
356
  );
354
357
  },
355
358
  },
@@ -632,6 +635,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
632
635
  getEditorFeatureFlags={
633
636
  options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags
634
637
  }
638
+ isChromelessEditor={options?.isChromelessEditor}
635
639
  />
636
640
  )}
637
641
  {options?.allowContextualMenu && (
@@ -97,6 +97,7 @@ export const createPlugin = (
97
97
  isTableAlignmentEnabled?: boolean,
98
98
  shouldUseIncreasedScalingPercent?: boolean,
99
99
  isCommentEditor?: boolean,
100
+ isChromelessEditor?: boolean,
100
101
  ) => {
101
102
  const state = createPluginState(dispatch, {
102
103
  pluginConfig,
@@ -294,10 +295,7 @@ export const createPlugin = (
294
295
  slice = transformSliceRemoveCellBackgroundColor(slice, schema);
295
296
  }
296
297
 
297
- // If a partial paste of nested expand, paste only nested-expand's content */
298
- if (fg('platform.editor.transform-slice-for-nested-expand')) {
299
- slice = transformSliceToRemoveOpenNestedExpand(slice, schema);
300
- }
298
+ slice = transformSliceToRemoveOpenNestedExpand(slice, schema);
301
299
 
302
300
  return slice;
303
301
  },
@@ -363,6 +361,7 @@ export const createPlugin = (
363
361
  pluginInjectionApi,
364
362
  isTableAlignmentEnabled,
365
363
  isCommentEditor,
364
+ isChromelessEditor,
366
365
  }),
367
366
  tableRow: lazyTableRowView({ eventDispatcher }),
368
367
  tableCell: lazyTableCellView({ eventDispatcher }),
@@ -1,9 +1,11 @@
1
1
  // Resize a given column by an amount from the current state
2
+ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
3
  import { type EditorContainerWidth } from '@atlaskit/editor-common/types';
3
4
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
4
5
  import {
5
6
  akEditorFullWidthLayoutWidth,
6
7
  akEditorGutterPaddingDynamic,
8
+ akEditorTableNumberColumnWidth,
7
9
  } from '@atlaskit/editor-shared-styles';
8
10
 
9
11
  import { TableCssClassName as ClassName } from '../../../types';
@@ -86,12 +88,13 @@ export const resizeColumnAndTable = ({
86
88
  }: ResizeColumnAndTable): ResizeState => {
87
89
  const editorContainerWidth = getEditorContainerWidth(editorWidth);
88
90
  const isTableLeftAligned = tableNode.attrs.layout === ALIGN_START;
91
+ const isNumberColumnEnabled = tableNode.attrs.isNumberColumnEnabled;
92
+ const isOverflow = resizeState.tableWidth > resizeState.maxSize;
89
93
  let resizeAmount = isTableLeftAligned ? amount : amount * 2;
90
-
91
94
  const willTableHitEditorEdge = resizeState.maxSize + resizeAmount > editorContainerWidth;
92
95
 
93
96
  const willResizedTableStayInOverflow =
94
- resizeState.overflow && resizeState.tableWidth + resizeAmount / 2 > resizeState.maxSize;
97
+ isOverflow && resizeState.tableWidth + resizeAmount / 2 > resizeState.maxSize;
95
98
 
96
99
  // STEP 1: Update col width
97
100
  if (willTableHitEditorEdge || willResizedTableStayInOverflow) {
@@ -100,54 +103,58 @@ export const resizeColumnAndTable = ({
100
103
  amount < 0
101
104
  ? amount
102
105
  : resizeAmount - (resizeState.maxSize + resizeAmount - tableContainerWidth!) / 2;
103
- }
104
-
105
- if (!willResizedTableStayInOverflow && !willTableHitEditorEdge) {
106
+ } else {
106
107
  const diff = -(resizeState.tableWidth - resizeState.maxSize);
107
108
  const rest = amount - diff;
108
109
  const final = isTableLeftAligned ? diff + rest : diff + rest * 2;
109
110
  resizeAmount = final;
110
111
  }
111
112
 
112
- let newState = updateAffectedColumn(resizeState, colIndex, resizeAmount);
113
+ const newState = updateAffectedColumn(resizeState, colIndex, resizeAmount);
113
114
 
114
115
  // STEP 2: Update table container width
115
116
  // columns have a min width, so delta !== resizeAmount when this is reached, use this for calculations
116
117
  const delta = newState.cols[colIndex].width - resizeState.cols[colIndex].width;
117
118
 
118
119
  newState.maxSize = Math.round(
119
- resizeState.overflow
120
+ isOverflow
120
121
  ? willResizedTableStayInOverflow
121
122
  ? // CASE 1A: table will stay in overflow
122
123
  // do not grow the table because resize is happening in the overflow region
123
124
  // and the overall table container needs to be retained
124
- resizeState.maxSize
125
+ isNumberColumnEnabled
126
+ ? resizeState.maxSize + akEditorTableNumberColumnWidth
127
+ : resizeState.maxSize
125
128
  : // CASE 1B: table will no longer be in overflow, so adjust container width
126
129
  // ensure the table is resized without any 'big jumps' by working out
127
130
  // the difference between the new table width and the max size and adding the resize
128
- resizeState.maxSize + (resizeState.tableWidth - resizeState.maxSize + delta)
131
+ isNumberColumnEnabled
132
+ ? resizeState.maxSize +
133
+ akEditorTableNumberColumnWidth +
134
+ (resizeState.tableWidth - resizeState.maxSize + akEditorTableNumberColumnWidth + delta)
135
+ : resizeState.maxSize + (resizeState.tableWidth - resizeState.maxSize + delta)
129
136
  : willTableHitEditorEdge
130
137
  ? // CASE 2: table will hit editor edge
131
138
  editorContainerWidth
132
139
  : // CASE 3: table is being resized from a non-overflow state
133
- resizeState.maxSize + delta,
140
+ isNumberColumnEnabled
141
+ ? resizeState.maxSize + akEditorTableNumberColumnWidth + delta
142
+ : resizeState.maxSize + delta,
134
143
  );
135
144
 
136
145
  // do not apply scaling logic because resize state is already scaled
137
146
  updateColgroup(newState, tableRef, tableNode, false, false);
138
147
 
139
- if (!willTableHitEditorEdge && !willResizedTableStayInOverflow) {
140
- updateTablePreview(
141
- tableRef,
148
+ updateTablePreview(
149
+ tableRef,
150
+ newState.maxSize,
151
+ shouldChangeAlignmentToCenterResized(
152
+ isTableAlignmentEnabled,
153
+ tableNode,
154
+ lineLength,
142
155
  newState.maxSize,
143
- shouldChangeAlignmentToCenterResized(
144
- isTableAlignmentEnabled,
145
- tableNode,
146
- lineLength,
147
- newState.maxSize,
148
- ),
149
- );
150
- }
156
+ ),
157
+ );
151
158
 
152
159
  return newState;
153
160
  };
@@ -184,34 +191,55 @@ export const scaleResizeState = ({
184
191
  tableNode,
185
192
  editorWidth,
186
193
  }: TableReferences & { resizeState: ResizeState; editorWidth: number }): ResizeState => {
187
- // check if table is scaled, if not then avoid applying scaling values down
188
- if (resizeState.maxSize < getEditorContainerWidth(editorWidth)) {
194
+ const isNumberColumnEnabled = tableNode.attrs.isNumberColumnEnabled;
195
+ const isTableScaled =
196
+ isNumberColumnEnabled || resizeState.maxSize > getEditorContainerWidth(editorWidth);
197
+
198
+ // Tables with number column can cause the table to be in two different states:
199
+ // 1. The table sum of col widths will be smaller than the max size, which is incorrect. For this
200
+ // avoid scaling and take the document width
201
+ // 2. The table sum of col widths will be the same size as max width, which happens when the table
202
+ // is scaled using preserve table width logic, for this apply a scaled width
203
+ // return early if table isn't scaled
204
+ if (!isTableScaled || (isNumberColumnEnabled && resizeState.maxSize > resizeState.tableWidth)) {
189
205
  return resizeState;
190
206
  }
191
207
 
192
208
  const scalePercent = getTableScalingPercent(tableNode, tableRef);
193
- let cols = resizeState.cols.map((col) => ({
194
- ...col,
195
- width: Math.round(Math.max(col.width * scalePercent, col.minWidth)),
196
- }));
197
-
198
209
  const scaledTableWidth = Math.round(resizeState.tableWidth * scalePercent);
210
+ let cols = resizeState.cols.map((col) => {
211
+ return {
212
+ ...col,
213
+ minWidth: tableCellMinWidth,
214
+ width: Math.max(Math.round(col.width * scalePercent), tableCellMinWidth),
215
+ };
216
+ });
217
+
199
218
  const calculatedTableWidth = cols.reduce((prev, curr) => prev + curr.width, 0);
200
219
 
201
220
  // using Math.round can cause the sum of col widths to be larger than the table width
202
- // distribute the difference to the smallest column
221
+ // distribute the difference to the first column
203
222
  if (calculatedTableWidth > scaledTableWidth) {
204
223
  const diff = calculatedTableWidth - scaledTableWidth;
224
+ let hasDiffBeenDistributed = false;
205
225
  cols = cols.map((col) => {
206
- return col.width - diff >= col.minWidth ? { ...col, width: col.width - diff } : col;
226
+ if (!hasDiffBeenDistributed && col.width - diff >= col.minWidth) {
227
+ hasDiffBeenDistributed = true;
228
+ return { ...col, width: col.width - diff };
229
+ }
230
+ return col;
207
231
  });
208
232
  }
209
233
 
234
+ const maxSize = isNumberColumnEnabled
235
+ ? Math.round((resizeState.maxSize + akEditorTableNumberColumnWidth) * scalePercent)
236
+ : Math.round(resizeState.maxSize * scalePercent);
237
+
210
238
  return {
211
239
  ...resizeState,
212
240
  widths: cols.map((col) => col.width),
213
241
  tableWidth: scaledTableWidth,
214
- maxSize: Math.round(resizeState.maxSize * scalePercent),
242
+ maxSize,
215
243
  cols,
216
244
  };
217
245
  };
@@ -283,6 +283,7 @@ export function updateAffectedColumn(
283
283
 
284
284
  return {
285
285
  ...resizeState,
286
+ tableWidth: updatedCols.reduce((acc, col) => acc + col.width, 0),
286
287
  cols: updatedCols,
287
288
  };
288
289
  }
package/src/toolbar.tsx CHANGED
@@ -292,22 +292,27 @@ export const getToolbarCellOptionsConfig = (
292
292
  selected: false,
293
293
  disabled: false,
294
294
  },
295
- {
296
- id: 'editor.table.mergeCells',
297
- title: formatMessage(messages.mergeCells),
298
- onClick: mergeCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB),
299
- selected: false,
300
- disabled: !canMergeCells(editorState.tr),
301
- },
302
- {
303
- id: 'editor.table.splitCell',
304
- title: formatMessage(messages.splitCell),
305
- onClick: splitCellWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB),
306
- selected: false,
307
- disabled: !splitCell(editorState),
308
- },
309
295
  ];
310
296
 
297
+ if (pluginState.pluginConfig.allowMergeCells) {
298
+ options.push(
299
+ {
300
+ id: 'editor.table.mergeCells',
301
+ title: formatMessage(messages.mergeCells),
302
+ onClick: mergeCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB),
303
+ selected: false,
304
+ disabled: !canMergeCells(editorState.tr),
305
+ },
306
+ {
307
+ id: 'editor.table.splitCell',
308
+ title: formatMessage(messages.splitCell),
309
+ onClick: splitCellWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB),
310
+ selected: false,
311
+ disabled: !splitCell(editorState),
312
+ },
313
+ );
314
+ }
315
+
311
316
  if (pluginState?.pluginConfig?.allowDistributeColumns) {
312
317
  const newResizeStateWithAnalytics = editorView
313
318
  ? getNewResizeStateFromSelectedColumns(
package/src/types.ts CHANGED
@@ -369,6 +369,7 @@ export const TableCssClassName = {
369
369
  DRAG_CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__drag-insert-button-inner`,
370
370
  DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: `${tablePrefixSelector}-controls__drag-insert-button-inner-column`,
371
371
  DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW: `${tablePrefixSelector}-controls__drag-insert-button-inner-row`,
372
+ DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS: `${tablePrefixSelector}-controls__drag-insert-button-inner-row-chromeless`,
372
373
  DRAG_CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__drag-insert-button-wrap`,
373
374
 
374
375
  CONTROLS_INSERT_MARKER: `${tablePrefixSelector}-controls__insert-marker`,
@@ -388,6 +389,7 @@ export const TableCssClassName = {
388
389
  /** drag and drop controls */
389
390
  DRAG_ROW_CONTROLS_WRAPPER: `${tablePrefixSelector}-drag-row-controls-wrapper`,
390
391
  DRAG_ROW_CONTROLS: `${tablePrefixSelector}-drag-row-controls`,
392
+ DRAG_CONTROLS_CHROMELESS: `drag-controls-chromeless`,
391
393
  DRAG_ROW_FLOATING_INSERT_DOT_WRAPPER: `${tablePrefixSelector}-drag-row-floating-insert-dot-wrapper`,
392
394
  DRAG_ROW_FLOATING_INSERT_DOT: `${tablePrefixSelector}-drag-row-floating-insert-dot`,
393
395
 
@@ -370,11 +370,12 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
370
370
  editorView,
371
371
  } = this.props;
372
372
  const { isDragAndDropEnabled } = getPluginState(editorView.state);
373
+ const content = formatMessage(
374
+ isDragAndDropEnabled ? messages.addColumnRight : messages.insertColumn,
375
+ );
373
376
 
374
377
  return {
375
- content: formatMessage(
376
- isDragAndDropEnabled ? messages.addColumnRight : messages.insertColumn,
377
- ),
378
+ content,
378
379
  value: { name: 'insert_column' },
379
380
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
380
381
  elemAfter: <div css={shortcutStyle}>{tooltip(addColumnAfter)}</div>,
@@ -384,6 +385,9 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
384
385
  <AddColRightIcon />
385
386
  </span>
386
387
  ) : undefined,
388
+ 'aria-label': fg('platform_editor_announce_cell_options_hotkeys')
389
+ ? tooltip(addColumnAfter, String(content))
390
+ : undefined,
387
391
  } as MenuItem;
388
392
  };
389
393
 
@@ -393,9 +397,10 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
393
397
  editorView,
394
398
  } = this.props;
395
399
  const { isDragAndDropEnabled } = getPluginState(editorView.state);
400
+ const content = formatMessage(isDragAndDropEnabled ? messages.addRowBelow : messages.insertRow);
396
401
 
397
402
  return {
398
- content: formatMessage(isDragAndDropEnabled ? messages.addRowBelow : messages.insertRow),
403
+ content,
399
404
  value: { name: 'insert_row' },
400
405
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
401
406
  elemAfter: <div css={shortcutStyle}>{tooltip(addRowAfter)}</div>,
@@ -405,6 +410,9 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
405
410
  <AddRowBelowIcon />
406
411
  </span>
407
412
  ) : undefined,
413
+ 'aria-label': fg('platform_editor_announce_cell_options_hotkeys')
414
+ ? tooltip(addRowAfter, String(content))
415
+ : undefined,
408
416
  } as MenuItem;
409
417
  };
410
418
 
@@ -419,10 +427,12 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
419
427
  const noOfColumns = right - left;
420
428
  const noOfRows = bottom - top;
421
429
 
430
+ const content = formatMessage(messages.clearCells, {
431
+ 0: Math.max(noOfColumns, noOfRows),
432
+ });
433
+
422
434
  return {
423
- content: formatMessage(messages.clearCells, {
424
- 0: Math.max(noOfColumns, noOfRows),
425
- }),
435
+ content,
426
436
  value: { name: 'clear' },
427
437
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
428
438
  elemAfter: <div css={shortcutStyle}>{tooltip(backspace)}</div>,
@@ -436,6 +446,9 @@ export class ContextualMenu extends Component<Props & WrappedComponentProps, Sta
436
446
  />
437
447
  </span>
438
448
  ) : undefined,
449
+ 'aria-label': fg('platform_editor_announce_cell_options_hotkeys')
450
+ ? tooltip(backspace, String(content))
451
+ : undefined,
439
452
  } as MenuItem;
440
453
  };
441
454
 
@@ -23,6 +23,7 @@ export interface ButtonProps {
23
23
  tableRef: HTMLElement;
24
24
  onMouseDown: (event: SyntheticEvent<HTMLButtonElement>) => void;
25
25
  hasStickyHeaders: boolean;
26
+ isChromelessEditor?: boolean;
26
27
  }
27
28
 
28
29
  const getInsertLineHeight = (
@@ -64,12 +65,16 @@ const getNumberColumnWidth = (tableRef: HTMLElement, isDragAndDropEnabled?: bool
64
65
  return 0;
65
66
  };
66
67
 
67
- const getInsertLineWidth = (tableRef: HTMLElement, isDragAndDropEnabled?: boolean) => {
68
+ const getInsertLineWidth = (
69
+ tableRef: HTMLElement,
70
+ isDragAndDropEnabled?: boolean,
71
+ isChromelessEditor?: boolean,
72
+ ) => {
68
73
  // The line gets width 100% from the table,
69
74
  // but since we have an overflow on the left,
70
75
  // we should add an offset to make up for it.
71
76
  const LINE_OFFSET = 4;
72
- const DRAG_LINE_OFFSET = 6;
77
+ const DRAG_LINE_OFFSET = isChromelessEditor ? 14 : 6;
73
78
  const { parentElement, offsetWidth } = tableRef;
74
79
  const parentOffsetWidth = parentElement!.offsetWidth;
75
80
  const { scrollLeft } = parentElement!;
@@ -97,6 +102,7 @@ export const InsertButtonForDragAndDrop = ({
97
102
  type,
98
103
  intl: { formatMessage },
99
104
  hasStickyHeaders,
105
+ isChromelessEditor,
100
106
  }: ButtonProps & WrappedComponentProps) => {
101
107
  const isRow = type === 'row';
102
108
 
@@ -114,8 +120,10 @@ export const InsertButtonForDragAndDrop = ({
114
120
  <div
115
121
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
116
122
  className={classnames(ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER, {
117
- [ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW]: isRow,
123
+ [ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW]: isRow && !isChromelessEditor,
118
124
  [ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN]: !isRow,
125
+ [ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS]:
126
+ isRow && isChromelessEditor,
119
127
  })}
120
128
  >
121
129
  <button
@@ -147,7 +155,7 @@ export const InsertButtonForDragAndDrop = ({
147
155
  style={
148
156
  type === 'row'
149
157
  ? {
150
- width: getInsertLineWidth(tableRef, true),
158
+ width: getInsertLineWidth(tableRef, true, isChromelessEditor),
151
159
  left: token('space.150', '12px'),
152
160
  }
153
161
  : {
@@ -25,7 +25,7 @@ import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-s
25
25
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
26
26
  import { TableMap } from '@atlaskit/editor-tables/table-map';
27
27
  import { findTable } from '@atlaskit/editor-tables/utils';
28
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
28
+ import { fg } from '@atlaskit/platform-feature-flags';
29
29
 
30
30
  import { insertColumnWithAnalytics, insertRowWithAnalytics } from '../../commands-with-analytics';
31
31
  import { TableCssClassName as ClassName } from '../../types';
@@ -52,6 +52,7 @@ export interface Props {
52
52
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
53
53
  editorAnalyticsAPI?: EditorAnalyticsAPI;
54
54
  getEditorFeatureFlags?: GetEditorFeatureFlags;
55
+ isChromelessEditor?: boolean;
55
56
  }
56
57
 
57
58
  export class FloatingInsertButton extends React.Component<Props & WrappedComponentProps, any> {
@@ -76,6 +77,7 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
76
77
  isHeaderRowEnabled,
77
78
  isDragAndDropEnabled,
78
79
  dispatchAnalyticsEvent,
80
+ isChromelessEditor,
79
81
  } = this.props;
80
82
 
81
83
  // TODO: temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
@@ -199,6 +201,7 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
199
201
  tableRef={tableRef}
200
202
  onMouseDown={type === 'column' ? this.insertColumn : this.insertRow}
201
203
  hasStickyHeaders={this.props.hasStickyHeaders || false}
204
+ isChromelessEditor={isChromelessEditor}
202
205
  />
203
206
  ) : (
204
207
  <InsertButton
@@ -273,7 +276,7 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
273
276
  const shouldUseIncreasedScalingPercent =
274
277
  isTableScalingEnabled &&
275
278
  tableWithFixedColumnWidthsOption &&
276
- getBooleanFF('platform.editor.table.use-increased-scaling-percent');
279
+ fg('platform.editor.table.use-increased-scaling-percent');
277
280
 
278
281
  const { state, dispatch } = editorView;
279
282
  insertColumnWithAnalytics(
@@ -5,7 +5,7 @@ import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
5
5
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
6
6
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
7
7
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
10
10
 
11
11
  import type { RowStickyState } from '../../pm-plugins/sticky-headers';
@@ -37,6 +37,7 @@ export interface Props {
37
37
  getScrollOffset?: () => number;
38
38
  tableWrapperHeight?: number;
39
39
  api?: PluginInjectionAPI;
40
+ isChromelessEditor?: boolean;
40
41
  }
41
42
 
42
43
  export const TableFloatingColumnControls = ({
@@ -56,6 +57,7 @@ export const TableFloatingColumnControls = ({
56
57
  getScrollOffset,
57
58
  tableWrapperHeight,
58
59
  api,
60
+ isChromelessEditor,
59
61
  }: Props) => {
60
62
  const [isDragging, setIsDragging] = useState(false);
61
63
  const containerRef = useRef<HTMLDivElement>(null);
@@ -109,7 +111,10 @@ export const TableFloatingColumnControls = ({
109
111
  <div
110
112
  ref={containerRef}
111
113
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
112
- className={ClassName.DRAG_COLUMN_CONTROLS_WRAPPER}
114
+ className={
115
+ ClassName.DRAG_COLUMN_CONTROLS_WRAPPER +
116
+ (isChromelessEditor ? ' ' + ClassName.DRAG_CONTROLS_CHROMELESS : '')
117
+ }
113
118
  data-testid="table-floating-column-controls-wrapper"
114
119
  >
115
120
  <ColumnControls
@@ -128,7 +133,7 @@ export const TableFloatingColumnControls = ({
128
133
  isNumberColumnEnabled={isNumberColumnEnabled}
129
134
  isDragging={isDragging}
130
135
  getScrollOffset={getScrollOffset}
131
- api={getBooleanFF('platform.editor.table.use-shared-state-hook') ? api : undefined}
136
+ api={fg('platform.editor.table.use-shared-state-hook') ? api : undefined}
132
137
  />
133
138
  {isDragging && (
134
139
  <ColumnDropTargets
@@ -47,6 +47,7 @@ export interface TableFloatingControlsProps {
47
47
  stickyHeader?: RowStickyState;
48
48
  insertRowButtonIndex?: number;
49
49
  tableWrapperWidth?: number;
50
+ isChromelessEditor?: boolean;
50
51
  }
51
52
 
52
53
  export const TableFloatingControls = ({
@@ -67,6 +68,7 @@ export const TableFloatingControls = ({
67
68
  isTableHovered,
68
69
  tableWrapperWidth,
69
70
  api,
71
+ isChromelessEditor,
70
72
  }: TableFloatingControlsProps & { api?: ExtractInjectionAPI<TablePlugin> }) => {
71
73
  const _selectRow = useCallback(
72
74
  (row: number, expand: boolean) => {
@@ -126,7 +128,9 @@ export const TableFloatingControls = ({
126
128
  stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
127
129
 
128
130
  const wrapperClassName = isDragAndDropEnabled
129
- ? ClassName.DRAG_ROW_CONTROLS_WRAPPER
131
+ ? isChromelessEditor
132
+ ? ClassName.DRAG_ROW_CONTROLS_WRAPPER + ' ' + ClassName.DRAG_CONTROLS_CHROMELESS
133
+ : ClassName.DRAG_ROW_CONTROLS_WRAPPER
130
134
  : ClassName.ROW_CONTROLS_WRAPPER;
131
135
 
132
136
  const tablePos = findTable(editorView.state.selection)?.pos;
@@ -514,10 +514,18 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
514
514
  }
515
515
  }
516
516
 
517
+ .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}.${ClassName.DRAG_CONTROLS_CHROMELESS} {
518
+ left: -4px;
519
+ }
520
+
517
521
  .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER} {
518
522
  padding: 0 ${tablePadding}px;
519
523
  }
520
524
 
525
+ .${ClassName.DRAG_COLUMN_CONTROLS_WRAPPER}.${ClassName.DRAG_CONTROLS_CHROMELESS} {
526
+ left: -8px;
527
+ }
528
+
521
529
  &.${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
522
530
  padding-left: ${akEditorTableNumberColumnWidth + tablePadding - 1}px;
523
531
  }
@@ -198,6 +198,10 @@ export const dragInsertButtonWrapper = () => css`
198
198
  left: -3px;
199
199
  bottom: -2px;
200
200
  }
201
+ .${ClassName.DRAG_CONTROLS_INSERT_BUTTON_INNER_ROW_CHROMELESS} {
202
+ left: 6px;
203
+ bottom: -2px;
204
+ }
201
205
 
202
206
  .${ClassName.DRAG_CONTROLS_INSERT_BUTTON} {
203
207
  ${Button(`