@atlaskit/editor-plugin-table 10.3.3 → 10.4.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 (103) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/cjs/nodeviews/TableRow.js +2 -4
  3. package/dist/cjs/nodeviews/lazy-node-views.js +1 -1
  4. package/dist/cjs/nodeviews/table.js +0 -2
  5. package/dist/cjs/pm-plugins/drag-and-drop/commands.js +1 -1
  6. package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +2 -2
  7. package/dist/cjs/pm-plugins/main.js +1 -1
  8. package/dist/cjs/pm-plugins/table-resizing/utils/content-width.js +2 -2
  9. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -1
  10. package/dist/cjs/pm-plugins/table-resizing/utils/resize-logic.js +1 -1
  11. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +1 -1
  12. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +1 -2
  13. package/dist/cjs/pm-plugins/table-selection-keymap.js +6 -4
  14. package/dist/cjs/pm-plugins/transforms/delete-columns.js +1 -1
  15. package/dist/cjs/pm-plugins/transforms/fix-tables.js +2 -3
  16. package/dist/cjs/pm-plugins/utils/paste.js +1 -1
  17. package/dist/cjs/pm-plugins/view-mode-sort/index.js +3 -3
  18. package/dist/cjs/pm-plugins/view-mode-sort/utils.js +1 -1
  19. package/dist/cjs/tablePlugin.js +1 -1
  20. package/dist/cjs/ui/FloatingInsertButton/index.js +2 -2
  21. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -1
  22. package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +6 -1
  23. package/dist/cjs/ui/TableFloatingControls/index.js +0 -2
  24. package/dist/cjs/ui/common-styles.js +2 -2
  25. package/dist/cjs/ui/consts.js +2 -2
  26. package/dist/cjs/ui/toolbar.js +1 -1
  27. package/dist/es2019/nodeviews/TableRow.js +2 -4
  28. package/dist/es2019/nodeviews/lazy-node-views.js +1 -1
  29. package/dist/es2019/nodeviews/table.js +0 -2
  30. package/dist/es2019/pm-plugins/drag-and-drop/commands.js +1 -1
  31. package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +2 -2
  32. package/dist/es2019/pm-plugins/main.js +1 -1
  33. package/dist/es2019/pm-plugins/table-resizing/utils/content-width.js +2 -2
  34. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +1 -1
  35. package/dist/es2019/pm-plugins/table-resizing/utils/resize-logic.js +1 -1
  36. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +1 -1
  37. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +1 -2
  38. package/dist/es2019/pm-plugins/table-selection-keymap.js +6 -4
  39. package/dist/es2019/pm-plugins/transforms/delete-columns.js +1 -1
  40. package/dist/es2019/pm-plugins/transforms/fix-tables.js +2 -3
  41. package/dist/es2019/pm-plugins/utils/paste.js +1 -1
  42. package/dist/es2019/pm-plugins/view-mode-sort/index.js +3 -3
  43. package/dist/es2019/pm-plugins/view-mode-sort/utils.js +1 -1
  44. package/dist/es2019/tablePlugin.js +1 -1
  45. package/dist/es2019/ui/FloatingInsertButton/index.js +2 -2
  46. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -1
  47. package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +6 -1
  48. package/dist/es2019/ui/TableFloatingControls/index.js +0 -2
  49. package/dist/es2019/ui/common-styles.js +8 -14
  50. package/dist/es2019/ui/consts.js +2 -2
  51. package/dist/es2019/ui/toolbar.js +1 -1
  52. package/dist/esm/nodeviews/TableRow.js +2 -4
  53. package/dist/esm/nodeviews/lazy-node-views.js +1 -1
  54. package/dist/esm/nodeviews/table.js +0 -2
  55. package/dist/esm/pm-plugins/drag-and-drop/commands.js +1 -1
  56. package/dist/esm/pm-plugins/drag-and-drop/plugin.js +2 -2
  57. package/dist/esm/pm-plugins/main.js +1 -1
  58. package/dist/esm/pm-plugins/table-resizing/utils/content-width.js +2 -2
  59. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +1 -1
  60. package/dist/esm/pm-plugins/table-resizing/utils/resize-logic.js +1 -1
  61. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +1 -1
  62. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +1 -2
  63. package/dist/esm/pm-plugins/table-selection-keymap.js +6 -4
  64. package/dist/esm/pm-plugins/transforms/delete-columns.js +1 -1
  65. package/dist/esm/pm-plugins/transforms/fix-tables.js +2 -3
  66. package/dist/esm/pm-plugins/utils/paste.js +1 -1
  67. package/dist/esm/pm-plugins/view-mode-sort/index.js +3 -3
  68. package/dist/esm/pm-plugins/view-mode-sort/utils.js +1 -1
  69. package/dist/esm/tablePlugin.js +1 -1
  70. package/dist/esm/ui/FloatingInsertButton/index.js +2 -2
  71. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +1 -1
  72. package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +6 -1
  73. package/dist/esm/ui/TableFloatingControls/index.js +0 -2
  74. package/dist/esm/ui/common-styles.js +2 -2
  75. package/dist/esm/ui/consts.js +2 -2
  76. package/dist/esm/ui/toolbar.js +1 -1
  77. package/package.json +9 -6
  78. package/src/nodeviews/TableRow.ts +2 -3
  79. package/src/nodeviews/lazy-node-views.ts +1 -1
  80. package/src/nodeviews/table.tsx +0 -2
  81. package/src/pm-plugins/drag-and-drop/commands.ts +1 -1
  82. package/src/pm-plugins/drag-and-drop/plugin.ts +2 -2
  83. package/src/pm-plugins/main.ts +1 -1
  84. package/src/pm-plugins/table-resizing/utils/content-width.ts +2 -2
  85. package/src/pm-plugins/table-resizing/utils/misc.ts +1 -1
  86. package/src/pm-plugins/table-resizing/utils/resize-logic.ts +1 -1
  87. package/src/pm-plugins/table-resizing/utils/resize-state.ts +1 -1
  88. package/src/pm-plugins/table-resizing/utils/scale-table.ts +1 -2
  89. package/src/pm-plugins/table-selection-keymap.ts +6 -3
  90. package/src/pm-plugins/transforms/delete-columns.ts +1 -1
  91. package/src/pm-plugins/transforms/fix-tables.ts +2 -3
  92. package/src/pm-plugins/utils/paste.ts +3 -1
  93. package/src/pm-plugins/view-mode-sort/index.ts +3 -3
  94. package/src/pm-plugins/view-mode-sort/utils.ts +1 -1
  95. package/src/tablePlugin.tsx +1 -1
  96. package/src/tablePluginType.ts +2 -2
  97. package/src/ui/FloatingInsertButton/index.tsx +2 -2
  98. package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +1 -1
  99. package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +10 -1
  100. package/src/ui/TableFloatingControls/index.tsx +0 -2
  101. package/src/ui/common-styles.ts +26 -14
  102. package/src/ui/consts.ts +2 -2
  103. package/src/ui/toolbar.tsx +1 -1
@@ -456,7 +456,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
456
456
  )
457
457
  : undefined,
458
458
  },
459
- // TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
459
+ // TODO: ED-26961 - should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
460
460
  {
461
461
  name: 'tableOverflowAnalyticsPlugin',
462
462
  plugin: ({ dispatch, dispatchAnalyticsEvent }) =>
@@ -25,7 +25,7 @@ export interface TablePluginOptions {
25
25
  // this option will eventually be removed, and enabled by default
26
26
  isTableScalingEnabled?: boolean;
27
27
  allowContextualMenu?: boolean;
28
- // TODO these two need to be rethought
28
+ // TODO: ED-26961 - these two need to be rethought
29
29
  fullWidthEnabled?: boolean;
30
30
  wasFullWidthEnabled?: boolean;
31
31
  getEditorFeatureFlags?: GetEditorFeatureFlags;
@@ -35,7 +35,7 @@ export interface TablePluginOptions {
35
35
 
36
36
  type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
37
37
 
38
- // TODO: duplicating type instead of importing media plugin causing a circular dependency
38
+ // TODO: ED-26961 - duplicating type instead of importing media plugin causing a circular dependency
39
39
  type MediaPlugin = NextEditorPlugin<
40
40
  'media',
41
41
  {
@@ -87,7 +87,7 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
87
87
  isChromelessEditor,
88
88
  } = this.props;
89
89
 
90
- // TODO: temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
90
+ // TODO: ED-26961 - temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
91
91
  if (isDragAndDropEnabled && (insertColumnButtonIndex === 0 || insertRowButtonIndex === 0)) {
92
92
  return null;
93
93
  }
@@ -182,7 +182,7 @@ export class FloatingInsertButton extends React.Component<Props & WrappedCompone
182
182
 
183
183
  const hasNumberedColumns = checkIfNumberColumnEnabled(editorView.state.selection);
184
184
 
185
- // ED-19336: Fixed the 'add column button' not visible issue when sticky header is enabled
185
+ // Fixed the 'add column button' not visible issue when sticky header is enabled
186
186
  // By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
187
187
  // Only when inserting a column, otherwise set to undefined
188
188
  // Need to set z-index in the Popup, set z-index in the <InsertButton /> will not work
@@ -86,7 +86,7 @@ export const ColumnControls = ({
86
86
  width ? (stickyTop ? `${width - 2}px` : `${width - 1}px`) : '0px',
87
87
  )
88
88
  .join(' ') ?? '0px';
89
- // TODO: reusing getRowsParams here because it's generic enough to work for columns -> rename
89
+ // TODO: ED-26961 - reusing getRowsParams here because it's generic enough to work for columns -> rename
90
90
  const columnParams = getRowsParams(colWidths ?? []);
91
91
  const colIndex = hoveredCell?.colIndex;
92
92
  const selectedColIndexes = getSelectedColumns(
@@ -6,6 +6,7 @@ import { injectIntl } from 'react-intl-next';
6
6
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
7
7
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
8
8
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
 
10
11
  import { clearHoverSelection } from '../../../pm-plugins/commands';
11
12
  import type { RowParams } from '../../../pm-plugins/utils/row-controls';
@@ -86,7 +87,15 @@ class RowControlsComponent extends Component<Props & WrappedComponentProps> {
86
87
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
87
88
  top: thisRowSticky ? `3px` : undefined,
88
89
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
89
- paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined,
90
+ paddingTop: thisRowSticky
91
+ ? `${
92
+ fg('platform_editor_number_column_sticky_header_bug')
93
+ ? // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
94
+ tableControlsSpacing - 2
95
+ : // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
96
+ tableControlsSpacing
97
+ }px`
98
+ : undefined,
90
99
  }}
91
100
  >
92
101
  <button
@@ -75,7 +75,6 @@ export const TableFloatingControls = ({
75
75
  const _selectRow = useCallback(
76
76
  (row: number, expand: boolean) => {
77
77
  const { state, dispatch } = editorView;
78
- // fix for issue ED-4665
79
78
  if (browser.ie_version === 11) {
80
79
  // Ignored via go/ees005
81
80
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -89,7 +88,6 @@ export const TableFloatingControls = ({
89
88
  const _selectRows = useCallback(
90
89
  (rowIndexes: number[]) => {
91
90
  const { state, dispatch } = editorView;
92
- // fix for issue ED-4665
93
91
  if (browser.ie_version === 11) {
94
92
  // Ignored via go/ees005
95
93
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -329,8 +329,6 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
329
329
  td.${ClassName.TABLE_CELL} {
330
330
  background-color: ${tableCellBackgroundColor};
331
331
 
332
- // ED-15246: Trello card is visible through a border of a table border
333
- // This fixes a border issue caused by relative positioned table cells
334
332
  &::after {
335
333
  height: 100%;
336
334
  content: '';
@@ -367,7 +365,11 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
367
365
  ${fg('platform_editor_nested_tables_sticky_header_bug')
368
366
  ? `
369
367
  .${ClassName.TABLE_STICKY} > .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN} .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
370
- margin-top: ${stickyRowOffsetTop + 2}px;
368
+ margin-top: ${
369
+ fg('platform_editor_number_column_sticky_header_bug')
370
+ ? stickyRowOffsetTop
371
+ : stickyRowOffsetTop + 2
372
+ }px;
371
373
  width: ${akEditorTableNumberColumnWidth}px;
372
374
 
373
375
  position: fixed !important;
@@ -378,8 +380,12 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
378
380
  }
379
381
  `
380
382
  : `
381
- .${ClassName.TABLE_STICKY} .${ClassName.NUMBERED_COLUMN} .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
382
- margin-top: ${stickyRowOffsetTop + 2}px;
383
+ .${ClassName.TABLE_STICKY} .${ClassName.NUMBERED_COLUMN} .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
384
+ margin-top: ${
385
+ fg('platform_editor_number_column_sticky_header_bug')
386
+ ? stickyRowOffsetTop
387
+ : stickyRowOffsetTop + 2
388
+ }px;
383
389
  width: ${akEditorTableNumberColumnWidth}px;
384
390
 
385
391
  position: fixed !important;
@@ -531,20 +537,30 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
531
537
  .${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY} > .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}
532
538
  .${ClassName.NUMBERED_COLUMN}
533
539
  .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
534
- margin-top: ${tableControlsSpacing + 2}px;
540
+ margin-top: ${
541
+ fg('platform_editor_number_column_sticky_header_bug')
542
+ ? tableControlsSpacing
543
+ : tableControlsSpacing + 2
544
+ }px;
535
545
  }
536
546
  `
537
547
  : `
538
548
  .${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY}
539
549
  .${ClassName.NUMBERED_COLUMN}
540
550
  .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
541
- margin-top: ${tableControlsSpacing + 2}px;
551
+ margin-top: ${
552
+ fg('platform_editor_number_column_sticky_header_bug')
553
+ ? tableControlsSpacing
554
+ : tableControlsSpacing + 2
555
+ }px;
542
556
  }
543
557
  `}
544
558
 
545
559
  .${ClassName.CORNER_CONTROLS}.sticky {
546
- border-top: ${tableControlsSpacing - tableToolbarSize + 2}px solid
547
- ${token('elevation.surface', 'white')};
560
+ border-top: ${fg('platform_editor_number_column_sticky_header_bug')
561
+ ? tableControlsSpacing - tableToolbarSize
562
+ : tableControlsSpacing - tableToolbarSize + 2}px
563
+ solid ${token('elevation.surface', 'white')};
548
564
  }
549
565
 
550
566
  ${sentinelStyles}
@@ -1088,10 +1104,6 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
1088
1104
  background: ${tableCellDeleteColor};
1089
1105
  z-index: ${akEditorUnitZIndex * 100};
1090
1106
  }
1091
- // ED-15246: Trello card is visible through a border of a table border
1092
- /* ED-19064: To fix when enable header column in the table,
1093
- and selection the header column, the right border is not tableBorderSelectedColor
1094
- when deleting the header column, the right border is not tableToolbarDeleteColor */
1095
1107
  td.${ClassName.HOVERED_CELL},
1096
1108
  td.${ClassName.SELECTED_CELL},
1097
1109
  th.${ClassName.TABLE_HEADER_CELL}.${ClassName.SELECTED_CELL},
@@ -1175,7 +1187,7 @@ export const baseTableStyles = (props: { featureFlags?: FeatureFlags }) => css`
1175
1187
  }
1176
1188
  `;
1177
1189
 
1178
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4139
1190
+ // TODO: DSP-4139 - Remove this when we have a better solution for the table toolbar
1179
1191
  export const tableStyles = (props: { featureFlags?: FeatureFlags }) => css`
1180
1192
  .ProseMirror {
1181
1193
  ${baseTableStyles(props)}
package/src/ui/consts.ts CHANGED
@@ -22,7 +22,7 @@ import { RESIZE_HANDLE_AREA_DECORATION_GAP } from '../types';
22
22
  * Basic colors added to prevent content overflow in table cells.
23
23
  */
24
24
 
25
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4135
25
+ // TODO: DSP-4135 - Remove these tokens once the new elevation tokens are available
26
26
  export const tableCellBackgroundColor = token('elevation.surface', N0);
27
27
 
28
28
  export const tableHeaderCellBackgroundColor = token(
@@ -35,7 +35,7 @@ export const tableTextColor = token('color.text.subtlest', N200);
35
35
  export const tableBorderColor = token('color.background.accent.gray.subtler', akEditorTableBorder);
36
36
  export const tableFloatingControlsColor = token('color.background.neutral', N20);
37
37
 
38
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4461
38
+ // TODO: DSP-4461 - Remove these tokens once the new elevation tokens are available
39
39
  export const tableCellSelectedColor = token(
40
40
  'color.blanket.selected',
41
41
  akEditorTableCellBlanketSelected,
@@ -647,7 +647,7 @@ export const getToolbarConfig =
647
647
  ...cellItems,
648
648
  ...columnSettingsItems,
649
649
  ...colorPicker,
650
- // TODO: editor controls to move to overflow menu
650
+ // TODO: ED-26961 - editor controls to move to overflow menu
651
651
  {
652
652
  type: 'extensions-placeholder',
653
653
  separator: 'end',