@atlaskit/editor-plugin-table 7.21.2 → 7.21.4

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 (95) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/commands/insert.js +6 -3
  3. package/dist/cjs/nodeviews/TableComponent.js +26 -10
  4. package/dist/cjs/nodeviews/TableContainer.js +9 -6
  5. package/dist/cjs/nodeviews/lazy-node-views.js +4 -3
  6. package/dist/cjs/nodeviews/table.js +8 -3
  7. package/dist/cjs/plugin.js +16 -7
  8. package/dist/cjs/pm-plugins/keymap.js +3 -1
  9. package/dist/cjs/pm-plugins/main.js +4 -3
  10. package/dist/cjs/toolbar.js +4 -1
  11. package/dist/cjs/ui/ColumnResizeWidget/index.js +4 -1
  12. package/dist/cjs/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +4 -1
  13. package/dist/cjs/ui/FloatingContextualButton/index.js +4 -1
  14. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +4 -1
  15. package/dist/cjs/ui/FloatingContextualMenu/index.js +4 -1
  16. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +4 -1
  17. package/dist/cjs/utils/create.js +6 -1
  18. package/dist/es2019/commands/insert.js +6 -3
  19. package/dist/es2019/nodeviews/TableComponent.js +27 -11
  20. package/dist/es2019/nodeviews/TableContainer.js +9 -6
  21. package/dist/es2019/nodeviews/lazy-node-views.js +4 -3
  22. package/dist/es2019/nodeviews/table.js +8 -3
  23. package/dist/es2019/plugin.js +14 -7
  24. package/dist/es2019/pm-plugins/keymap.js +2 -2
  25. package/dist/es2019/pm-plugins/main.js +4 -3
  26. package/dist/es2019/toolbar.js +4 -1
  27. package/dist/es2019/ui/ColumnResizeWidget/index.js +4 -1
  28. package/dist/es2019/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +4 -1
  29. package/dist/es2019/ui/FloatingContextualButton/index.js +4 -1
  30. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +4 -1
  31. package/dist/es2019/ui/FloatingContextualMenu/index.js +4 -1
  32. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +4 -1
  33. package/dist/es2019/utils/create.js +6 -1
  34. package/dist/esm/commands/insert.js +6 -3
  35. package/dist/esm/nodeviews/TableComponent.js +27 -11
  36. package/dist/esm/nodeviews/TableContainer.js +9 -6
  37. package/dist/esm/nodeviews/lazy-node-views.js +4 -3
  38. package/dist/esm/nodeviews/table.js +8 -3
  39. package/dist/esm/plugin.js +16 -7
  40. package/dist/esm/pm-plugins/keymap.js +3 -1
  41. package/dist/esm/pm-plugins/main.js +4 -3
  42. package/dist/esm/toolbar.js +4 -1
  43. package/dist/esm/ui/ColumnResizeWidget/index.js +4 -1
  44. package/dist/esm/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +4 -1
  45. package/dist/esm/ui/FloatingContextualButton/index.js +4 -1
  46. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +4 -1
  47. package/dist/esm/ui/FloatingContextualMenu/index.js +4 -1
  48. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +4 -1
  49. package/dist/esm/utils/create.js +6 -1
  50. package/dist/types/commands/insert.d.ts +2 -2
  51. package/dist/types/nodeviews/TableContainer.d.ts +4 -2
  52. package/dist/types/nodeviews/lazy-node-views.d.ts +1 -0
  53. package/dist/types/nodeviews/table.d.ts +1 -1
  54. package/dist/types/nodeviews/types.d.ts +1 -0
  55. package/dist/types/plugin.d.ts +1 -0
  56. package/dist/types/pm-plugins/keymap.d.ts +1 -1
  57. package/dist/types/pm-plugins/main.d.ts +1 -1
  58. package/dist/types/ui/ColumnResizeWidget/index.d.ts +4 -1
  59. package/dist/types/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +4 -1
  60. package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +4 -1
  61. package/dist/types/ui/FloatingContextualMenu/index.d.ts +4 -1
  62. package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +4 -1
  63. package/dist/types/utils/create.d.ts +3 -1
  64. package/dist/types-ts4.5/commands/insert.d.ts +2 -2
  65. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
  66. package/dist/types-ts4.5/nodeviews/lazy-node-views.d.ts +1 -0
  67. package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
  68. package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
  69. package/dist/types-ts4.5/plugin.d.ts +1 -0
  70. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
  71. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  72. package/dist/types-ts4.5/ui/ColumnResizeWidget/index.d.ts +4 -1
  73. package/dist/types-ts4.5/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.d.ts +4 -1
  74. package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +4 -1
  75. package/dist/types-ts4.5/ui/FloatingContextualMenu/index.d.ts +4 -1
  76. package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +4 -1
  77. package/dist/types-ts4.5/utils/create.d.ts +3 -1
  78. package/package.json +6 -3
  79. package/src/commands/insert.ts +6 -0
  80. package/src/nodeviews/TableComponent.tsx +23 -8
  81. package/src/nodeviews/TableContainer.tsx +15 -3
  82. package/src/nodeviews/lazy-node-views.ts +4 -0
  83. package/src/nodeviews/table.tsx +7 -1
  84. package/src/nodeviews/types.ts +1 -0
  85. package/src/plugin.tsx +12 -1
  86. package/src/pm-plugins/keymap.ts +4 -0
  87. package/src/pm-plugins/main.ts +5 -1
  88. package/src/toolbar.tsx +4 -1
  89. package/src/ui/ColumnResizeWidget/index.tsx +4 -1
  90. package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +4 -1
  91. package/src/ui/FloatingContextualButton/index.tsx +4 -1
  92. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +4 -1
  93. package/src/ui/FloatingContextualMenu/index.tsx +4 -1
  94. package/src/ui/FloatingDragMenu/DragMenu.tsx +4 -1
  95. package/src/utils/create.ts +9 -2
@@ -231,12 +231,16 @@ export const createTable =
231
231
  isTableAlignmentEnabled?: boolean,
232
232
  isFullWidthModeEnabled?: boolean,
233
233
  editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null,
234
+ isCommentEditor?: boolean,
235
+ isTableResizingEnabled?: boolean,
234
236
  ): Command =>
235
237
  (state, dispatch) => {
236
238
  const table = createTableWithWidth({
237
239
  isTableScalingEnabled,
238
240
  isTableAlignmentEnabled,
239
241
  isFullWidthModeEnabled,
242
+ isCommentEditor,
243
+ isTableResizingEnabled,
240
244
  })(state.schema);
241
245
 
242
246
  if (dispatch) {
@@ -262,6 +266,7 @@ export const insertTableWithSize =
262
266
  isTableScalingEnabled?: boolean,
263
267
  isTableAlignmentEnabled?: boolean,
264
268
  editorAnalyticsAPI?: EditorAnalyticsAPI,
269
+ isCommentEditor?: boolean,
265
270
  ) =>
266
271
  (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER): EditorCommand => {
267
272
  return ({ tr }) => {
@@ -269,6 +274,7 @@ export const insertTableWithSize =
269
274
  isTableScalingEnabled,
270
275
  isFullWidthModeEnabled,
271
276
  isTableAlignmentEnabled,
277
+ isCommentEditor,
272
278
  createTableProps: {
273
279
  rowsCount: rowsCount,
274
280
  colsCount: colsCount,
@@ -20,12 +20,13 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
20
20
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
21
21
  import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
22
22
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
23
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
23
+ import { fg } from '@atlaskit/platform-feature-flags';
24
24
  import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
25
25
  import type { CleanupFn } from '@atlaskit/pragmatic-drag-and-drop/types';
26
26
  import { token } from '@atlaskit/tokens';
27
27
 
28
28
  import { autoSizeTable, clearHoverSelection } from '../commands';
29
+ import { handleMouseOut, isTableInFocus } from '../event-handlers';
29
30
  import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
30
31
  import { getPluginState } from '../pm-plugins/plugin-factory';
31
32
  import type { RowStickyState, StickyPluginState } from '../pm-plugins/sticky-headers';
@@ -186,6 +187,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
186
187
  }
187
188
  }
188
189
 
190
+ private handleMouseOut = (event: Event) => {
191
+ if (!isTableInFocus(this.props.view)) {
192
+ return false;
193
+ }
194
+ return handleMouseOut(this.props.view, event);
195
+ };
196
+
189
197
  componentDidMount() {
190
198
  const {
191
199
  allowColumnResizing,
@@ -197,13 +205,16 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
197
205
  isTableScalingEnabled,
198
206
  } = this.props;
199
207
 
200
- if (getBooleanFF('platform.editor.table.live-pages-sorting_4malx')) {
208
+ if (fg('platform.editor.table.live-pages-sorting_4malx')) {
201
209
  const { mode } =
202
210
  this.props.pluginInjectionApi?.editorViewMode?.sharedState.currentState() || {};
203
211
  if (mode === 'view') {
204
212
  this?.table?.addEventListener('mouseenter', this.handleMouseEnter);
205
213
  }
206
214
  }
215
+ if (fg('editor_react_18_fix_table_delete_col_decorations')) {
216
+ this?.table?.addEventListener('mouseout', this.handleMouseOut);
217
+ }
207
218
 
208
219
  const { tableWithFixedColumnWidthsOption = false, stickyScrollbar } = getEditorFeatureFlags();
209
220
 
@@ -305,9 +316,12 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
305
316
  window.removeEventListener('resize', this.handleWindowResizeDebounced);
306
317
  }
307
318
 
308
- if (getBooleanFF('platform.editor.table.live-pages-sorting_4malx')) {
319
+ if (fg('platform.editor.table.live-pages-sorting_4malx')) {
309
320
  this?.table?.removeEventListener('mouseenter', this.handleMouseEnter);
310
321
  }
322
+ if (fg('editor_react_18_fix_table_delete_col_decorations')) {
323
+ this?.table?.removeEventListener('mouseout', this.handleMouseOut);
324
+ }
311
325
 
312
326
  if (this.overflowShadowsObserver) {
313
327
  this.overflowShadowsObserver.dispose();
@@ -388,7 +402,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
388
402
 
389
403
  const shouldUseIncreasedScalingPercent =
390
404
  (isTableScalingWithFixedColumnWidthsOptionEnabled &&
391
- getBooleanFF('platform.editor.table.use-increased-scaling-percent')) ||
405
+ fg('platform.editor.table.use-increased-scaling-percent')) ||
392
406
  false;
393
407
 
394
408
  if (force || (!isResizing && shouldUpdateColgroup)) {
@@ -448,7 +462,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
448
462
 
449
463
  const table = findTable(view.state.selection);
450
464
 
451
- if (!getBooleanFF('platform.editor.table.use-shared-state-hook')) {
465
+ if (!fg('platform.editor.table.use-shared-state-hook')) {
452
466
  const pluginState = getPluginState(view.state);
453
467
  isInDanger = pluginState.isInDanger;
454
468
  }
@@ -466,7 +480,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
466
480
  isTableScalingEnabled && tableWithFixedColumnWidthsOption;
467
481
  const shouldUseIncreasedScalingPercent =
468
482
  isTableScalingWithFixedColumnWidthsOptionEnabled &&
469
- getBooleanFF('platform.editor.table.use-increased-scaling-percent');
483
+ fg('platform.editor.table.use-increased-scaling-percent');
470
484
 
471
485
  if (
472
486
  isTableScalingWithFixedColumnWidthsOptionEnabled &&
@@ -651,7 +665,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
651
665
  const { showBeforeShadow, showAfterShadow } = this.state;
652
666
  const node = getNode();
653
667
 
654
- if (!getBooleanFF('platform.editor.table.use-shared-state-hook')) {
668
+ if (!fg('platform.editor.table.use-shared-state-hook')) {
655
669
  const pluginState = getPluginState(view.state);
656
670
  isInDanger = pluginState.isInDanger;
657
671
  hoveredRows = pluginState.hoveredRows;
@@ -748,7 +762,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
748
762
  const shouldUseIncreasedScalingPercent =
749
763
  isTableScalingEnabled &&
750
764
  tableWithFixedColumnWidthsOption &&
751
- getBooleanFF('platform.editor.table.use-increased-scaling-percent');
765
+ fg('platform.editor.table.use-increased-scaling-percent');
752
766
 
753
767
  return (
754
768
  <TableContainer
@@ -774,6 +788,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
774
788
  isWholeTableInDanger={isWholeTableInDanger}
775
789
  isTableAlignmentEnabled={isTableAlignmentEnabled}
776
790
  shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
791
+ isCommentEditor={options?.isCommentEditor}
777
792
  >
778
793
  <div
779
794
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
@@ -174,6 +174,7 @@ type ResizableTableContainerProps = {
174
174
  isTableWithFixedColumnWidthsOptionEnabled?: boolean;
175
175
  isTableAlignmentEnabled?: boolean;
176
176
  shouldUseIncreasedScalingPercent?: boolean;
177
+ isCommentEditor?: boolean;
177
178
  };
178
179
 
179
180
  export const ResizableTableContainer = React.memo(
@@ -194,6 +195,7 @@ export const ResizableTableContainer = React.memo(
194
195
  isTableWithFixedColumnWidthsOptionEnabled,
195
196
  isTableAlignmentEnabled,
196
197
  shouldUseIncreasedScalingPercent,
198
+ isCommentEditor,
197
199
  }: PropsWithChildren<ResizableTableContainerProps>) => {
198
200
  const containerRef = useRef<HTMLDivElement | null>(null);
199
201
  const tableWidthRef = useRef<number>(akEditorDefaultLayoutWidth);
@@ -296,14 +298,21 @@ export const ResizableTableContainer = React.memo(
296
298
  // padding left = padding right = akEditorGutterPadding = 32
297
299
  responsiveContainerWidth = isTableScalingEnabled
298
300
  ? containerWidth - akEditorGutterPaddingDynamic() * 2
299
- : containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
301
+ : containerWidth -
302
+ akEditorGutterPaddingDynamic() * 2 -
303
+ (isCommentEditor ? 0 : resizeHandleSpacing);
300
304
  }
301
- let width = Math.min(tableWidth, responsiveContainerWidth);
305
+ let width =
306
+ !node.attrs.width && isCommentEditor
307
+ ? responsiveContainerWidth
308
+ : Math.min(tableWidth, responsiveContainerWidth);
302
309
 
303
310
  if (!isResizing) {
304
311
  tableWidthRef.current = width;
305
312
  }
306
- const maxResizerWidth = Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
313
+ const maxResizerWidth = isCommentEditor
314
+ ? responsiveContainerWidth
315
+ : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
307
316
 
308
317
  const tableResizerProps = {
309
318
  width,
@@ -391,6 +400,7 @@ type TableContainerProps = {
391
400
  isTableWithFixedColumnWidthsOptionEnabled?: boolean;
392
401
  isTableAlignmentEnabled?: boolean;
393
402
  shouldUseIncreasedScalingPercent?: boolean;
403
+ isCommentEditor?: boolean;
394
404
  };
395
405
 
396
406
  export const TableContainer = ({
@@ -411,6 +421,7 @@ export const TableContainer = ({
411
421
  isTableWithFixedColumnWidthsOptionEnabled,
412
422
  isTableAlignmentEnabled,
413
423
  shouldUseIncreasedScalingPercent,
424
+ isCommentEditor,
414
425
  }: PropsWithChildren<TableContainerProps>) => {
415
426
  if (isTableResizingEnabled && !isNested) {
416
427
  return (
@@ -431,6 +442,7 @@ export const TableContainer = ({
431
442
  isWholeTableInDanger={isWholeTableInDanger}
432
443
  isTableAlignmentEnabled={isTableAlignmentEnabled}
433
444
  shouldUseIncreasedScalingPercent={shouldUseIncreasedScalingPercent}
445
+ isCommentEditor={isCommentEditor}
434
446
  >
435
447
  {children}
436
448
  </ResizableTableContainer>
@@ -22,6 +22,7 @@ type TableViewOptions = {
22
22
  dispatchAnalyticsEvent: DispatchAnalyticsEvent;
23
23
  pluginInjectionApi?: PluginInjectionAPI;
24
24
  isTableAlignmentEnabled?: boolean;
25
+ isCommentEditor?: boolean;
25
26
  };
26
27
 
27
28
  export const lazyTableView = (options: TableViewOptions) => {
@@ -38,6 +39,7 @@ export const lazyTableView = (options: TableViewOptions) => {
38
39
  options.dispatchAnalyticsEvent,
39
40
  options.pluginInjectionApi,
40
41
  options.isTableAlignmentEnabled,
42
+ options.isCommentEditor,
41
43
  );
42
44
  };
43
45
  }
@@ -62,6 +64,7 @@ export const lazyTableView = (options: TableViewOptions) => {
62
64
  dispatchAnalyticsEvent,
63
65
  pluginInjectionApi,
64
66
  isTableAlignmentEnabled,
67
+ isCommentEditor,
65
68
  } = getNodeViewOptions();
66
69
 
67
70
  return createTableView(
@@ -75,6 +78,7 @@ export const lazyTableView = (options: TableViewOptions) => {
75
78
  dispatchAnalyticsEvent,
76
79
  pluginInjectionApi,
77
80
  isTableAlignmentEnabled,
81
+ isCommentEditor,
78
82
  );
79
83
  };
80
84
  });
@@ -43,7 +43,7 @@ const tableAttributes = (node: PmNode) => {
43
43
  'data-layout': node.attrs.layout,
44
44
  'data-autosize': node.attrs.__autoSize,
45
45
  'data-table-local-id': node.attrs.localId || '',
46
- 'data-table-width': node.attrs.width,
46
+ 'data-table-width': node.attrs.width || 'inherit',
47
47
  'data-table-display-mode': node.attrs.displayMode,
48
48
  };
49
49
  };
@@ -54,6 +54,10 @@ const getInlineWidth = (
54
54
  state: EditorState,
55
55
  pos: number | undefined,
56
56
  ): number | undefined => {
57
+ if (!node.attrs.width && options?.isCommentEditor && options?.isTableResizingEnabled) {
58
+ return;
59
+ }
60
+
57
61
  // provide a width for tables when custom table width is supported
58
62
  // this is to ensure 'responsive' tables (colgroup widths are undefined) become fixed to
59
63
  // support screen size adjustments
@@ -360,6 +364,7 @@ export const createTableView = (
360
364
  dispatchAnalyticsEvent: DispatchAnalyticsEvent,
361
365
  pluginInjectionApi?: PluginInjectionAPI,
362
366
  isTableAlignmentEnabled?: boolean,
367
+ isCommentEditor?: boolean,
363
368
  ): NodeView => {
364
369
  const {
365
370
  pluginConfig,
@@ -386,6 +391,7 @@ export const createTableView = (
386
391
  isDragAndDropEnabled,
387
392
  isTableScalingEnabled, // same as options.isTableScalingEnabled
388
393
  isTableAlignmentEnabled,
394
+ isCommentEditor,
389
395
  },
390
396
  getEditorContainerWidth,
391
397
  getEditorFeatureFlags,
@@ -14,6 +14,7 @@ export type TableOptions = {
14
14
  isDragAndDropEnabled?: boolean;
15
15
  isTableScalingEnabled?: boolean;
16
16
  isTableAlignmentEnabled?: boolean;
17
+ isCommentEditor?: boolean;
17
18
  };
18
19
 
19
20
  export interface Props {
package/src/plugin.tsx CHANGED
@@ -97,6 +97,7 @@ export interface TablePluginOptions {
97
97
  isTableScalingEnabled?: boolean;
98
98
  isTableAlignmentEnabled?: boolean;
99
99
  isNewColumnResizingEnabled?: boolean;
100
+ isCommentEditor?: boolean;
100
101
  }
101
102
 
102
103
  type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
@@ -262,6 +263,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
262
263
  isTableScalingEnabled: options?.isTableScalingEnabled,
263
264
  isTableAlignmentEnabled: options?.isTableAlignmentEnabled,
264
265
  isFullWidthModeEnabled: options?.fullWidthEnabled,
266
+ isCommentEditor: options?.isCommentEditor,
267
+ isTableResizingEnabled: options?.tableResizingEnabled,
265
268
  })(state.schema);
266
269
 
267
270
  return (
@@ -324,6 +327,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
324
327
  dragAndDropEnabled,
325
328
  isTableScalingEnabled,
326
329
  isTableAlignmentEnabled,
330
+ isCommentEditor,
327
331
  } = options || ({} as TablePluginOptions);
328
332
 
329
333
  return createPlugin(
@@ -344,6 +348,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
344
348
  isTableScalingEnabled,
345
349
  isTableAlignmentEnabled,
346
350
  shouldUseIncreasedScalingPercent,
351
+ isCommentEditor,
347
352
  );
348
353
  },
349
354
  },
@@ -386,6 +391,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
386
391
  isTableScalingEnabled = false,
387
392
  isTableAlignmentEnabled = false,
388
393
  fullWidthEnabled = false,
394
+ isCommentEditor = false,
395
+ tableResizingEnabled = false,
389
396
  } = options || ({} as TablePluginOptions);
390
397
 
391
398
  return keymapPlugin(
@@ -400,6 +407,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
400
407
  isCellBackgroundDuplicated,
401
408
  isTableFixedColumnWidthsOptionEnabled,
402
409
  shouldUseIncreasedScalingPercent,
410
+ isCommentEditor,
411
+ tableResizingEnabled,
403
412
  );
404
413
  },
405
414
  },
@@ -463,7 +472,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
463
472
  {
464
473
  name: 'tableWidth',
465
474
  plugin: ({ dispatchAnalyticsEvent, dispatch }) =>
466
- options?.tableResizingEnabled
475
+ options?.tableResizingEnabled && !options?.isCommentEditor
467
476
  ? createTableWidthPlugin(
468
477
  dispatch,
469
478
  dispatchAnalyticsEvent,
@@ -717,6 +726,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
717
726
  isTableScalingEnabled: options?.isTableScalingEnabled,
718
727
  isTableAlignmentEnabled: options?.isTableAlignmentEnabled,
719
728
  isFullWidthModeEnabled: tableState?.isFullWidthModeEnabled,
729
+ isCommentEditor: options?.isCommentEditor,
730
+ isTableResizingEnabled: options?.tableResizingEnabled,
720
731
  })(state.schema);
721
732
 
722
733
  const tr = insert(tableNode);
@@ -69,6 +69,8 @@ export function keymapPlugin(
69
69
  isCellBackgroundDuplicated = false,
70
70
  isTableFixedColumnWidthsOptionEnabled = false,
71
71
  shouldUseIncreasedScalingPercent?: boolean,
72
+ isCommentEditor?: boolean,
73
+ isTableResizingEnabled?: boolean,
72
74
  ): SafePlugin {
73
75
  const list = {};
74
76
 
@@ -91,6 +93,8 @@ export function keymapPlugin(
91
93
  isTableAlignmentEnabled,
92
94
  !!isFullWidthEnabled,
93
95
  editorAnalyticsAPI,
96
+ isCommentEditor,
97
+ isTableResizingEnabled,
94
98
  ),
95
99
  list,
96
100
  );
@@ -96,6 +96,7 @@ export const createPlugin = (
96
96
  isTableScalingEnabled?: boolean,
97
97
  isTableAlignmentEnabled?: boolean,
98
98
  shouldUseIncreasedScalingPercent?: boolean,
99
+ isCommentEditor?: boolean,
99
100
  ) => {
100
101
  const state = createPluginState(dispatch, {
101
102
  pluginConfig,
@@ -361,6 +362,7 @@ export const createPlugin = (
361
362
  dispatchAnalyticsEvent,
362
363
  pluginInjectionApi,
363
364
  isTableAlignmentEnabled,
365
+ isCommentEditor,
364
366
  }),
365
367
  tableRow: lazyTableRowView({ eventDispatcher }),
366
368
  tableCell: lazyTableCellView({ eventDispatcher }),
@@ -372,7 +374,9 @@ export const createPlugin = (
372
374
  mousedown: withCellTracking(handleMouseDown),
373
375
  mouseover: withCellTracking(whenTableInFocus(handleMouseOver)),
374
376
  mouseleave: handleMouseLeave,
375
- mouseout: whenTableInFocus(handleMouseOut),
377
+ mouseout: fg('editor_react_18_fix_table_delete_col_decorations')
378
+ ? undefined
379
+ : whenTableInFocus(handleMouseOut),
376
380
  mousemove: whenTableInFocus(handleMouseMove),
377
381
  mouseenter: handleMouseEnter,
378
382
  mouseup: whenTableInFocus(handleMouseUp),
package/src/toolbar.tsx CHANGED
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { jsx } from '@emotion/react';
4
7
 
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { jsx } from '@emotion/react';
4
7
  import { useIntl } from 'react-intl-next';
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { jsx } from '@emotion/react';
4
7
 
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  import React, { useEffect } from 'react';
3
6
 
4
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
@@ -1,5 +1,8 @@
1
1
  /* eslint-disable @atlaskit/design-system/prefer-primitives */
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
  import React, { Component } from 'react';
4
7
  import type { PointerEvent } from 'react';
5
8
 
@@ -1,4 +1,7 @@
1
- /** @jsx jsx */
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
2
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
3
6
  import { jsx } from '@emotion/react';
4
7
 
@@ -1,5 +1,8 @@
1
1
  /* eslint-disable @atlaskit/design-system/prefer-primitives */
2
- /** @jsx jsx */
2
+ /**
3
+ * @jsxRuntime classic
4
+ * @jsx jsx
5
+ */
3
6
  /** @jsxFrag */
4
7
  import React, { useEffect, useState } from 'react';
5
8
 
@@ -5,7 +5,7 @@ import { createTable } from '@atlaskit/editor-tables/utils';
5
5
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
6
6
 
7
7
  type CreateTableOverrides = {
8
- tableWidth?: TableAttributes['width'];
8
+ tableWidth?: TableAttributes['width'] | 'inherit';
9
9
  layout?: TableAttributes['layout'];
10
10
  };
11
11
 
@@ -14,11 +14,15 @@ export const createTableWithWidth =
14
14
  isTableScalingEnabled,
15
15
  isTableAlignmentEnabled,
16
16
  isFullWidthModeEnabled,
17
+ isCommentEditor,
18
+ isTableResizingEnabled,
17
19
  createTableProps,
18
20
  }: {
19
21
  isTableScalingEnabled?: boolean;
20
22
  isTableAlignmentEnabled?: boolean;
21
23
  isFullWidthModeEnabled?: boolean;
24
+ isCommentEditor?: boolean;
25
+ isTableResizingEnabled?: boolean;
22
26
  createTableProps?: {
23
27
  rowsCount?: number;
24
28
  colsCount?: number;
@@ -26,12 +30,15 @@ export const createTableWithWidth =
26
30
  }) =>
27
31
  (schema: Schema) => {
28
32
  const attrsOverrides: CreateTableOverrides = {};
29
- if (isTableScalingEnabled && isFullWidthModeEnabled) {
33
+ if (isTableScalingEnabled && isFullWidthModeEnabled && !isCommentEditor) {
30
34
  attrsOverrides.tableWidth = TABLE_MAX_WIDTH;
31
35
  }
32
36
  if (isTableAlignmentEnabled && isFullWidthModeEnabled) {
33
37
  attrsOverrides.layout = 'align-start';
34
38
  }
39
+ if (isCommentEditor && isTableResizingEnabled) {
40
+ attrsOverrides.tableWidth = 'inherit';
41
+ }
35
42
 
36
43
  return createTable({
37
44
  schema,