@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
@@ -123,7 +123,6 @@ export default class TableView extends ReactNodeView {
123
123
  });
124
124
  }
125
125
 
126
- // TODO: ED-15663
127
126
  // Please, do not copy or use this kind of code below
128
127
  // @ts-ignore
129
128
  const fakePluginKey = {
@@ -135,7 +134,6 @@ export default class TableView extends ReactNodeView {
135
134
  }
136
135
  };
137
136
 
138
- // TODO: ED-15663
139
137
  // Please, do not copy or use this kind of code below
140
138
  // @ts-ignore
141
139
  const fakeMediaPluginKey = {
@@ -6,7 +6,7 @@ import { DragAndDropActionType } from './actions';
6
6
  import { DropTargetType } from './consts';
7
7
  import { createCommand, getPluginState } from './plugin-factory';
8
8
  import { pluginKey } from './plugin-key';
9
- // TODO: This command is a placeholder example. Please replace this if required.
9
+ // TODO: ED-26961 - This command is a placeholder example. Please replace this if required.
10
10
  const getDecorations = state => {
11
11
  var _pluginKey$getState;
12
12
  return ((_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet) || DecorationSet.empty;
@@ -88,7 +88,7 @@ const destroyFn = (editorView, editorAnalyticsAPI, isTableScalingEnabled, isTabl
88
88
  return;
89
89
  }
90
90
 
91
- // TODO: as we drag an element around we are going to want to update the state to acurately reflect the current
91
+ // TODO: ED-26961 - as we drag an element around we are going to want to update the state to acurately reflect the current
92
92
  // insert location as to where the draggable will most likely be go. For example;
93
93
  const {
94
94
  sourceType,
@@ -245,7 +245,7 @@ export const createPlugin = (dispatch, editorAnalyticsAPI, isTableScalingEnabled
245
245
  };
246
246
  if (newTargetCellPosition !== undefined) {
247
247
  const cells = getCellsInRow(dragMenuIndex)(tr.selection);
248
- // ED-20673 check if it is a cell selection,
248
+ // TODO: ED-20673 - check if it is a cell selection,
249
249
  // when true, a drag handle is clicked and isDragMenuOpen is true here
250
250
  // should not close the drag menu.
251
251
  const isCellSelection = tr.selection instanceof CellSelection;
@@ -170,7 +170,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
170
170
  slice = transformSliceToAddTableHeaders(slice, schema);
171
171
  }
172
172
 
173
- // fix for when pasting a table with default layout into comment editor
173
+ // This fixes pasting a table with default layout into comment editor
174
174
  // table lose width and expand to full width
175
175
  if (!insideTable(editorState) && isCommentEditor && pluginConfig.allowTableAlignment && isTableScalingEnabled) {
176
176
  slice = transformSliceTableLayoutDefaultToCenter(slice, schema);
@@ -32,11 +32,11 @@ function calcContentWidth(elem, container, canvas, colWidths) {
32
32
  // If the text isn't meant to wrap, we should set that as a hard limit.
33
33
  if (parentStyle.whiteSpace === 'nowrap') {
34
34
  // + 3 is for date offset plus cursor
35
- // TODO There should be a programmatic way to get this.
35
+ // TODO: ED-26961 - There should be a programmatic way to get this.
36
36
  colWidths.push(parent.offsetWidth + 3);
37
37
  }
38
38
  } else {
39
- // FIXME: doesn't quite work right with spacing
39
+ // TODO: ED-26961 - doesn't quite work right with spacing
40
40
  const style = getComputedStyle(child);
41
41
  if (style.minWidth && style.minWidth.endsWith('px') && style.minWidth !== '0px') {
42
42
  colWidths.push(unitToNumber(style.minWidth));
@@ -72,7 +72,7 @@ export const getTableMaxWidth = ({
72
72
  */
73
73
  export const getTableElementWidth = table => {
74
74
  if (hasTableBeenResized(table)) {
75
- // TODO: is there a scenario where ADF columns are SMALLER than container width?
75
+ // TODO: ED-26961 - is there a scenario where ADF columns are SMALLER than container width?
76
76
  return calcTableColumnWidths(table).reduce((sum, width) => sum + width, 0);
77
77
  }
78
78
  return getTableContainerElementWidth(table);
@@ -83,7 +83,7 @@ var ColType = /*#__PURE__*/function (ColType) {
83
83
  ColType["SOURCE"] = "src";
84
84
  ColType["DEST"] = "dest";
85
85
  return ColType;
86
- }(ColType || {}); // TODO: should handle when destIdx:
86
+ }(ColType || {}); // TODO: ED-26961 - should handle when destIdx:
87
87
  // - is beyond the range, and then not give it back
88
88
  function moveSpaceFrom(state, srcIdx, destIdx, amount, useFreeSpace = true) {
89
89
  const srcCol = state.cols[srcIdx];
@@ -257,7 +257,7 @@ export const bulkColumnsResize = (resizeState, columnsIndexes, sourceColumnIndex
257
257
  }
258
258
  }
259
259
 
260
- // fix total table widths by adding missing pixels to columns widths here and there
260
+ // fixes total table widths by adding missing pixels to columns widths here and there
261
261
  return adjustColumnsWidths(newState, resizeState.maxSize);
262
262
  };
263
263
 
@@ -171,8 +171,7 @@ export const scaleTable = (tableRef, options, domAtPos, api, isTableScalingEnabl
171
171
  }
172
172
  if (tr.docChanged) {
173
173
  tr.setMeta('scrollIntoView', false);
174
- // TODO: ED-8995
175
- // We need to do this check to reduce the number of race conditions when working with tables.
174
+ // TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
176
175
  // This metadata is been used in the sendTransaction function in the Collab plugin
177
176
  /* Added !layoutChanged check here to solve unnecessary scroll bar after publish when click on breakout button multiple times and publish
178
177
  scaleTable is only called once every time a breakout button is clicked, so it is safe not to add the meta 'scaleTable' to the tr.
@@ -1,5 +1,6 @@
1
1
  import { bindKeymapArrayWithCommand, bindKeymapWithCommand, moveLeft, moveRight, selectColumn, selectRow, selectTable, shiftArrowUp } from '@atlaskit/editor-common/keymaps';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  import { arrowLeftFromTable, arrowRightFromTable, modASelectTable, selectColumns, selectRows, shiftArrowUpFromTable } from './commands/selection';
4
5
  export function tableSelectionKeymapPlugin(pluginInjectionApi, getIntl) {
5
6
  var _pluginInjectionApi$a;
@@ -20,9 +21,10 @@ export function tableSelectionKeymapPlugin(pluginInjectionApi, getIntl) {
20
21
  // Ignored via go/ees005
21
22
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
22
23
  bindKeymapWithCommand(shiftArrowUp.common, shiftArrowUpFromTable(editorSelectionAPI)(), list);
23
-
24
- // Ignored via go/ees005
25
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
26
- bindKeymapWithCommand(selectTable.common, modASelectTable(editorSelectionAPI)(), list);
24
+ if (editorExperiment('platform_editor_cmd_a_progressively_select_nodes', false)) {
25
+ // Ignored via go/ees005
26
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
27
+ bindKeymapWithCommand(selectTable.common, modASelectTable(editorSelectionAPI)(), list);
28
+ }
27
29
  return keymap(list);
28
30
  }
@@ -14,7 +14,7 @@ const deleteColumnsCustomStep = rect => tr => {
14
14
 
15
15
  // Need to split all the merge in the ranges (this is the current behaviour)
16
16
  // Maybe is better to split only the last column?
17
- // TODO: After talking with Roto about this behaviour, he likes when we dont split the columns, I am keeping this for consistency of the current implementation.
17
+ // TODO: ED-26961 - After talking with Roto about this behaviour, he likes when we dont split the columns, I am keeping this for consistency of the current implementation.
18
18
  splitCellsInColumns(tr, table.pos, rect.left, rect.right);
19
19
 
20
20
  // Delete the columns
@@ -155,7 +155,7 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
155
155
  return cols;
156
156
  }
157
157
 
158
- // TODO: move to prosemirror-utils
158
+ // TODO: ED-26961 - move to prosemirror-utils
159
159
  const replaceCells = (tr, table, tablePos, modifyCell) => {
160
160
  const rows = [];
161
161
  let modifiedCells = 0;
@@ -165,8 +165,7 @@ const replaceCells = (tr, table, tablePos, modifyCell) => {
165
165
  for (let colIndex = 0; colIndex < row.childCount; colIndex++) {
166
166
  const cell = row.child(colIndex);
167
167
 
168
- // FIXME
169
- // The rowIndex and colIndex are not accurate in a merged cell scenario
168
+ // TODO: ED-26961 - The rowIndex and colIndex are not accurate in a merged cell scenario
170
169
  // e.g. table with 5 columns might have only one cell in a row, colIndex will be 1, where it should be 4
171
170
  const node = modifyCell(cell, rowIndex, colIndex);
172
171
  if (node.sameMarkup(cell) === false) {
@@ -80,7 +80,7 @@ export const transformSliceToRemoveNestedTables = (slice, schema, selection) =>
80
80
  var _slice$content$firstC, _slice$content$lastCh;
81
81
  const isPasteInTable = hasParentNodeOfType([table, tableCell, tableHeader])(selection);
82
82
  const isPasteInNestedTable = getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1;
83
- const isCellPaste = isPasteInTable && slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === table;
83
+ const isCellPaste = isPasteInTable && slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === table && slice.openStart !== 0 && slice.openEnd !== 0;
84
84
 
85
85
  // if nesting is allowed we bump up the default nesting allowance to 2 to support
86
86
  // two levels of nesting in nodes that support table nesting already such as layoutSection and expands
@@ -27,7 +27,7 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
27
27
  }),
28
28
  apply(tr, pluginState, oldState) {
29
29
  var _api$editorViewMode;
30
- // TODO - move this mode check to plugin creation if possible. Right now it's here because the initial state
30
+ // TODO: ED-26961 - move this mode check to plugin creation if possible. Right now it's here because the initial state
31
31
  // does not appear correct when the plugin is created.
32
32
  const {
33
33
  mode
@@ -74,7 +74,7 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
74
74
  const decs = [];
75
75
  const sortingDecorations = pluginState.decorations.find(undefined, undefined, spec => spec.tableId === tableId && spec.type === 'sorting-decoration');
76
76
 
77
- // TODO - add support for keyboard only users
77
+ // TODO: ED-26961 - add support for keyboard only users
78
78
  if (hoverTableMeta && !isTableInState || sortMeta || isTableInState && !sortingDecorations.length && fg('platform_editor_sort_decoration_fix_on_live_page')) {
79
79
  allTables.forEach(table => {
80
80
  const [tableId, _node, pos] = table;
@@ -235,7 +235,7 @@ export const createPlugin = (api, nodeViewPortalProviderAPI) => {
235
235
  props: {
236
236
  handleDOMEvents: {
237
237
  keydown: (view, event) => {
238
- // TODO - fix the focus issue here, where toggling sort with a keypress loses focus
238
+ // TODO: ED-26961 - fix the focus issue here, where toggling sort with a keypress loses focus
239
239
  if (event.key === 'Enter' || event.key === ' ') {
240
240
  var _key$getState2;
241
241
  const pluginState = ((_key$getState2 = key.getState(view.state)) === null || _key$getState2 === void 0 ? void 0 : _key$getState2.sort) || {};
@@ -20,7 +20,7 @@ const getSortOrderFromTable = (tableNode, sortIndex, direction) => {
20
20
  originalIndex: index
21
21
  }));
22
22
  const compareNodesInOrder = createCompareNodes({
23
- // TODO - add inline card support
23
+ // TODO: ED-26961 - add inline card support
24
24
  getInlineCardTextFromStore() {
25
25
  return null;
26
26
  }
@@ -352,7 +352,7 @@ const tablesPlugin = ({
352
352
  return options !== null && options !== void 0 && options.tableOptions.allowTableResizing && options !== null && options !== void 0 && options.isCommentEditor ? createTableWidthInCommentFixPlugin(dispatch, (_options$tableOptions4 = options.tableOptions.allowTableAlignment) !== null && _options$tableOptions4 !== void 0 ? _options$tableOptions4 : false) : undefined;
353
353
  }
354
354
  },
355
- // TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
355
+ // TODO: ED-26961 - should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
356
356
  {
357
357
  name: 'tableOverflowAnalyticsPlugin',
358
358
  plugin: ({
@@ -39,7 +39,7 @@ export class FloatingInsertButton extends React.Component {
39
39
  isChromelessEditor
40
40
  } = this.props;
41
41
 
42
- // TODO: temporarily disable insert button for first column and row https://atlassian.slack.com/archives/C05U8HRQM50/p1698363744682219?thread_ts=1698209039.104909&cid=C05U8HRQM50
42
+ // 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
43
43
  if (isDragAndDropEnabled && (insertColumnButtonIndex === 0 || insertRowButtonIndex === 0)) {
44
44
  return null;
45
45
  }
@@ -113,7 +113,7 @@ export class FloatingInsertButton extends React.Component {
113
113
  const index = type === 'column' ? insertColumnButtonIndex : insertRowButtonIndex;
114
114
  const hasNumberedColumns = checkIfNumberColumnEnabled(editorView.state.selection);
115
115
 
116
- // ED-19336: Fixed the 'add column button' not visible issue when sticky header is enabled
116
+ // Fixed the 'add column button' not visible issue when sticky header is enabled
117
117
  // By setting the Popup z-index higher than the sticky header z-index ( common-styles.ts tr.sticky)
118
118
  // Only when inserting a column, otherwise set to undefined
119
119
  // Need to set z-index in the Popup, set z-index in the <InsertButton /> will not work
@@ -49,7 +49,7 @@ export const ColumnControls = ({
49
49
  // when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
50
50
  // we need to reduce the width by 1px to avoid misalignment of column controls.
51
51
  width ? stickyTop ? `${width - 2}px` : `${width - 1}px` : '0px').join(' ')) !== null && _colWidths$map$join !== void 0 ? _colWidths$map$join : '0px';
52
- // TODO: reusing getRowsParams here because it's generic enough to work for columns -> rename
52
+ // TODO: ED-26961 - reusing getRowsParams here because it's generic enough to work for columns -> rename
53
53
  const columnParams = getRowsParams(colWidths !== null && colWidths !== void 0 ? colWidths : []);
54
54
  const colIndex = hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex;
55
55
  const selectedColIndexes = getSelectedColumns((selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection) || editorView.state.selection);
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React, { Component } from 'react';
3
3
  import { injectIntl } from 'react-intl-next';
4
4
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
5
+ import { fg } from '@atlaskit/platform-feature-flags';
5
6
  import { clearHoverSelection } from '../../../pm-plugins/commands';
6
7
  import { getRowClassNames, getRowHeights, getRowsParams } from '../../../pm-plugins/utils/row-controls';
7
8
  import { TableCssClassName as ClassName } from '../../../types';
@@ -71,7 +72,11 @@ class RowControlsComponent extends Component {
71
72
  // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
72
73
  top: thisRowSticky ? `3px` : undefined,
73
74
  // 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
74
- paddingTop: thisRowSticky ? `${tableControlsSpacing}px` : undefined
75
+ paddingTop: thisRowSticky ? `${fg('platform_editor_number_column_sticky_header_bug') ?
76
+ // 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
77
+ tableControlsSpacing - 2 :
78
+ // 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
79
+ tableControlsSpacing}px` : undefined
75
80
  }
76
81
  }, /*#__PURE__*/React.createElement("button", {
77
82
  "aria-label": formatMessage(messages.rowControl),
@@ -39,7 +39,6 @@ export const TableFloatingControls = ({
39
39
  state,
40
40
  dispatch
41
41
  } = editorView;
42
- // fix for issue ED-4665
43
42
  if (browser.ie_version === 11) {
44
43
  // Ignored via go/ees005
45
44
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -52,7 +51,6 @@ export const TableFloatingControls = ({
52
51
  state,
53
52
  dispatch
54
53
  } = editorView;
55
- // fix for issue ED-4665
56
54
  if (browser.ie_version === 11) {
57
55
  // Ignored via go/ees005
58
56
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
@@ -256,8 +256,6 @@ export const baseTableStyles = props => {
256
256
  td.${ClassName.TABLE_CELL} {
257
257
  background-color: ${tableCellBackgroundColor};
258
258
 
259
- // ED-15246: Trello card is visible through a border of a table border
260
- // This fixes a border issue caused by relative positioned table cells
261
259
  &::after {
262
260
  height: 100%;
263
261
  content: '';
@@ -293,7 +291,7 @@ export const baseTableStyles = props => {
293
291
  /* sticky styles */
294
292
  ${fg('platform_editor_nested_tables_sticky_header_bug') ? `
295
293
  .${ClassName.TABLE_STICKY} > .${ClassName.DRAG_ROW_CONTROLS_WRAPPER} .${ClassName.NUMBERED_COLUMN} .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
296
- margin-top: ${stickyRowOffsetTop + 2}px;
294
+ margin-top: ${fg('platform_editor_number_column_sticky_header_bug') ? stickyRowOffsetTop : stickyRowOffsetTop + 2}px;
297
295
  width: ${akEditorTableNumberColumnWidth}px;
298
296
 
299
297
  position: fixed !important;
@@ -303,8 +301,8 @@ export const baseTableStyles = props => {
303
301
  /* top set by NumberColumn component */
304
302
  }
305
303
  ` : `
306
- .${ClassName.TABLE_STICKY} .${ClassName.NUMBERED_COLUMN} .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
307
- margin-top: ${stickyRowOffsetTop + 2}px;
304
+ .${ClassName.TABLE_STICKY} .${ClassName.NUMBERED_COLUMN} .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
305
+ margin-top: ${fg('platform_editor_number_column_sticky_header_bug') ? stickyRowOffsetTop : stickyRowOffsetTop + 2}px;
308
306
  width: ${akEditorTableNumberColumnWidth}px;
309
307
 
310
308
  position: fixed !important;
@@ -453,19 +451,19 @@ export const baseTableStyles = props => {
453
451
  .${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY} > .${ClassName.DRAG_ROW_CONTROLS_WRAPPER}
454
452
  .${ClassName.NUMBERED_COLUMN}
455
453
  .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
456
- margin-top: ${tableControlsSpacing + 2}px;
454
+ margin-top: ${fg('platform_editor_number_column_sticky_header_bug') ? tableControlsSpacing : tableControlsSpacing + 2}px;
457
455
  }
458
456
  ` : `
459
457
  .${ClassName.WITH_CONTROLS}.${ClassName.TABLE_STICKY}
460
458
  .${ClassName.NUMBERED_COLUMN}
461
459
  .${ClassName.NUMBERED_COLUMN_BUTTON}:first-of-type {
462
- margin-top: ${tableControlsSpacing + 2}px;
460
+ margin-top: ${fg('platform_editor_number_column_sticky_header_bug') ? tableControlsSpacing : tableControlsSpacing + 2}px;
463
461
  }
464
462
  `}
465
463
 
466
464
  .${ClassName.CORNER_CONTROLS}.sticky {
467
- border-top: ${tableControlsSpacing - tableToolbarSize + 2}px solid
468
- ${"var(--ds-surface, white)"};
465
+ border-top: ${fg('platform_editor_number_column_sticky_header_bug') ? tableControlsSpacing - tableToolbarSize : tableControlsSpacing - tableToolbarSize + 2}px
466
+ solid ${"var(--ds-surface, white)"};
469
467
  }
470
468
 
471
469
  ${sentinelStyles}
@@ -996,10 +994,6 @@ export const baseTableStyles = props => {
996
994
  background: ${tableCellDeleteColor};
997
995
  z-index: ${akEditorUnitZIndex * 100};
998
996
  }
999
- // ED-15246: Trello card is visible through a border of a table border
1000
- /* ED-19064: To fix when enable header column in the table,
1001
- and selection the header column, the right border is not tableBorderSelectedColor
1002
- when deleting the header column, the right border is not tableToolbarDeleteColor */
1003
997
  td.${ClassName.HOVERED_CELL},
1004
998
  td.${ClassName.SELECTED_CELL},
1005
999
  th.${ClassName.TABLE_HEADER_CELL}.${ClassName.SELECTED_CELL},
@@ -1080,7 +1074,7 @@ export const baseTableStyles = props => {
1080
1074
  `;
1081
1075
  };
1082
1076
 
1083
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4139
1077
+ // TODO: DSP-4139 - Remove this when we have a better solution for the table toolbar
1084
1078
  export const tableStyles = props => css`
1085
1079
  .ProseMirror {
1086
1080
  ${baseTableStyles(props)}
@@ -10,7 +10,7 @@ import { RESIZE_HANDLE_AREA_DECORATION_GAP } from '../types';
10
10
  * Basic colors added to prevent content overflow in table cells.
11
11
  */
12
12
 
13
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4135
13
+ // TODO: DSP-4135 - Remove these tokens once the new elevation tokens are available
14
14
  export const tableCellBackgroundColor = `var(--ds-surface, ${N0})`;
15
15
  export const tableHeaderCellBackgroundColor = `var(--ds-background-accent-gray-subtlest, ${akEditorTableHeaderCellBackground})`;
16
16
  export const tableToolbarColor = `var(--ds-background-neutral-subtle, ${akEditorTableToolbar})`;
@@ -18,7 +18,7 @@ export const tableTextColor = `var(--ds-text-subtlest, ${N200})`;
18
18
  export const tableBorderColor = `var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`;
19
19
  export const tableFloatingControlsColor = `var(--ds-background-neutral, ${N20})`;
20
20
 
21
- // TODO: https://product-fabric.atlassian.net/browse/DSP-4461
21
+ // TODO: DSP-4461 - Remove these tokens once the new elevation tokens are available
22
22
  export const tableCellSelectedColor = `var(--ds-blanket-selected, ${akEditorTableCellBlanketSelected})`;
23
23
  export const tableToolbarSelectedColor = `var(--ds-background-selected-pressed, ${B200})`;
24
24
  export const tableBorderSelectedColor = `var(--ds-border-focused, ${akEditorTableBorderSelected})`;
@@ -437,7 +437,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
437
437
  zIndex: akEditorFloatingPanelZIndex + 1,
438
438
  // Place the context menu slightly above the others
439
439
  items: [menu, separator(menu.hidden), ...alignmentMenu, separator(alignmentMenu.length === 0), ...cellItems, ...columnSettingsItems, ...colorPicker,
440
- // TODO: editor controls to move to overflow menu
440
+ // TODO: ED-26961 - editor controls to move to overflow menu
441
441
  {
442
442
  type: 'extensions-placeholder',
443
443
  separator: 'end'
@@ -573,7 +573,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
573
573
  var _tbody$firstChild,
574
574
  _this6 = this;
575
575
  // If header row height is more than 50% of viewport height don't do this
576
- // TODO: When cleaning up 'nested_table_control_padding_with_css' FG
576
+ // TODO: ED-26961 - When cleaning up 'nested_table_control_padding_with_css' FG
577
577
  // move this check to the constructor of the TableRow so that we don't subscribe to
578
578
  // clicks and scrolls for nested tables.
579
579
  if (this.isSticky || this.stickyRowHeight && this.stickyRowHeight > window.innerHeight / 2 || this.isInNestedTable) {
@@ -582,7 +582,7 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
582
582
  var table = tree.table,
583
583
  wrapper = tree.wrapper;
584
584
 
585
- // ED-16035 Make sure sticky header is only applied to first row
585
+ // TODO: ED-16035 - Make sure sticky header is only applied to first row
586
586
  var tbody = this.dom.parentElement;
587
587
  var isFirstHeader = tbody === null || tbody === void 0 || (_tbody$firstChild = tbody.firstChild) === null || _tbody$firstChild === void 0 ? void 0 : _tbody$firstChild.isEqualNode(this.dom);
588
588
  if (!isFirstHeader) {
@@ -648,8 +648,6 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
648
648
  value: function getWrapperRefTop(wrapper) {
649
649
  return Math.round(getTop(wrapper)) + this.getWrapperoffset();
650
650
  }
651
-
652
- // TODO: rename!
653
651
  }, {
654
652
  key: "getScrolledTableTop",
655
653
  value: function getScrolledTableTop(wrapper) {
@@ -1,7 +1,7 @@
1
1
  import { withLazyLoading } from '@atlaskit/editor-common/lazy-node-view';
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
3
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
- // TODO: Clean up ED-23976
4
+ // TODO: ED-23976 - Clean up
5
5
  import { createTableView } from './table';
6
6
  import TableCell from './TableCell';
7
7
  import TableRow from './TableRow';
@@ -148,7 +148,6 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
148
148
  });
149
149
  }
150
150
 
151
- // TODO: ED-15663
152
151
  // Please, do not copy or use this kind of code below
153
152
  // @ts-ignore
154
153
  var fakePluginKey = {
@@ -160,7 +159,6 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
160
159
  }
161
160
  };
162
161
 
163
- // TODO: ED-15663
164
162
  // Please, do not copy or use this kind of code below
165
163
  // @ts-ignore
166
164
  var fakeMediaPluginKey = {
@@ -6,7 +6,7 @@ import { DragAndDropActionType } from './actions';
6
6
  import { DropTargetType } from './consts';
7
7
  import { createCommand, getPluginState } from './plugin-factory';
8
8
  import { pluginKey } from './plugin-key';
9
- // TODO: This command is a placeholder example. Please replace this if required.
9
+ // TODO: ED-26961 - This command is a placeholder example. Please replace this if required.
10
10
  var getDecorations = function getDecorations(state) {
11
11
  var _pluginKey$getState;
12
12
  return ((_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet) || DecorationSet.empty;
@@ -80,7 +80,7 @@ var destroyFn = function destroyFn(editorView, editorAnalyticsAPI, isTableScalin
80
80
  return;
81
81
  }
82
82
 
83
- // TODO: as we drag an element around we are going to want to update the state to acurately reflect the current
83
+ // TODO: ED-26961 - as we drag an element around we are going to want to update the state to acurately reflect the current
84
84
  // insert location as to where the draggable will most likely be go. For example;
85
85
  var sourceType = data.sourceType,
86
86
  targetAdjustedIndex = data.targetAdjustedIndex;
@@ -234,7 +234,7 @@ export var createPlugin = function createPlugin(dispatch, editorAnalyticsAPI) {
234
234
  };
235
235
  if (newTargetCellPosition !== undefined) {
236
236
  var cells = getCellsInRow(dragMenuIndex)(tr.selection);
237
- // ED-20673 check if it is a cell selection,
237
+ // TODO: ED-20673 - check if it is a cell selection,
238
238
  // when true, a drag handle is clicked and isDragMenuOpen is true here
239
239
  // should not close the drag menu.
240
240
  var isCellSelection = tr.selection instanceof CellSelection;
@@ -171,7 +171,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
171
171
  slice = transformSliceToAddTableHeaders(slice, schema);
172
172
  }
173
173
 
174
- // fix for when pasting a table with default layout into comment editor
174
+ // This fixes pasting a table with default layout into comment editor
175
175
  // table lose width and expand to full width
176
176
  if (!insideTable(editorState) && isCommentEditor && pluginConfig.allowTableAlignment && isTableScalingEnabled) {
177
177
  slice = transformSliceTableLayoutDefaultToCenter(slice, schema);
@@ -34,11 +34,11 @@ function calcContentWidth(elem, container, canvas, colWidths) {
34
34
  // If the text isn't meant to wrap, we should set that as a hard limit.
35
35
  if (parentStyle.whiteSpace === 'nowrap') {
36
36
  // + 3 is for date offset plus cursor
37
- // TODO There should be a programmatic way to get this.
37
+ // TODO: ED-26961 - There should be a programmatic way to get this.
38
38
  colWidths.push(parent.offsetWidth + 3);
39
39
  }
40
40
  } else {
41
- // FIXME: doesn't quite work right with spacing
41
+ // TODO: ED-26961 - doesn't quite work right with spacing
42
42
  var style = getComputedStyle(child);
43
43
  if (style.minWidth && style.minWidth.endsWith('px') && style.minWidth !== '0px') {
44
44
  colWidths.push(unitToNumber(style.minWidth));
@@ -70,7 +70,7 @@ export var getTableMaxWidth = function getTableMaxWidth(_ref2) {
70
70
  */
71
71
  export var getTableElementWidth = function getTableElementWidth(table) {
72
72
  if (hasTableBeenResized(table)) {
73
- // TODO: is there a scenario where ADF columns are SMALLER than container width?
73
+ // TODO: ED-26961 - is there a scenario where ADF columns are SMALLER than container width?
74
74
  return calcTableColumnWidths(table).reduce(function (sum, width) {
75
75
  return sum + width;
76
76
  }, 0);
@@ -91,7 +91,7 @@ var ColType = /*#__PURE__*/function (ColType) {
91
91
  ColType["SOURCE"] = "src";
92
92
  ColType["DEST"] = "dest";
93
93
  return ColType;
94
- }(ColType || {}); // TODO: should handle when destIdx:
94
+ }(ColType || {}); // TODO: ED-26961 - should handle when destIdx:
95
95
  // - is beyond the range, and then not give it back
96
96
  function moveSpaceFrom(state, srcIdx, destIdx, amount) {
97
97
  var useFreeSpace = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
@@ -279,7 +279,7 @@ export var bulkColumnsResize = function bulkColumnsResize(resizeState, columnsIn
279
279
  }
280
280
  }
281
281
 
282
- // fix total table widths by adding missing pixels to columns widths here and there
282
+ // fixes total table widths by adding missing pixels to columns widths here and there
283
283
  return adjustColumnsWidths(newState, resizeState.maxSize);
284
284
  };
285
285
 
@@ -177,8 +177,7 @@ export var scaleTable = function scaleTable(tableRef, options, domAtPos, api) {
177
177
  }
178
178
  if (tr.docChanged) {
179
179
  tr.setMeta('scrollIntoView', false);
180
- // TODO: ED-8995
181
- // We need to do this check to reduce the number of race conditions when working with tables.
180
+ // TODO: ED-8995 - We need to do this check to reduce the number of race conditions when working with tables.
182
181
  // This metadata is been used in the sendTransaction function in the Collab plugin
183
182
  /* Added !layoutChanged check here to solve unnecessary scroll bar after publish when click on breakout button multiple times and publish
184
183
  scaleTable is only called once every time a breakout button is clicked, so it is safe not to add the meta 'scaleTable' to the tr.
@@ -1,5 +1,6 @@
1
1
  import { bindKeymapArrayWithCommand, bindKeymapWithCommand, moveLeft, moveRight, selectColumn, selectRow, selectTable, shiftArrowUp } from '@atlaskit/editor-common/keymaps';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  import { arrowLeftFromTable, arrowRightFromTable, modASelectTable, selectColumns, selectRows, shiftArrowUpFromTable } from './commands/selection';
4
5
  export function tableSelectionKeymapPlugin(pluginInjectionApi, getIntl) {
5
6
  var _pluginInjectionApi$a;
@@ -20,9 +21,10 @@ export function tableSelectionKeymapPlugin(pluginInjectionApi, getIntl) {
20
21
  // Ignored via go/ees005
21
22
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
22
23
  bindKeymapWithCommand(shiftArrowUp.common, shiftArrowUpFromTable(editorSelectionAPI)(), list);
23
-
24
- // Ignored via go/ees005
25
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
26
- bindKeymapWithCommand(selectTable.common, modASelectTable(editorSelectionAPI)(), list);
24
+ if (editorExperiment('platform_editor_cmd_a_progressively_select_nodes', false)) {
25
+ // Ignored via go/ees005
26
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
27
+ bindKeymapWithCommand(selectTable.common, modASelectTable(editorSelectionAPI)(), list);
28
+ }
27
29
  return keymap(list);
28
30
  }
@@ -19,7 +19,7 @@ var deleteColumnsCustomStep = function deleteColumnsCustomStep(rect) {
19
19
 
20
20
  // Need to split all the merge in the ranges (this is the current behaviour)
21
21
  // Maybe is better to split only the last column?
22
- // TODO: After talking with Roto about this behaviour, he likes when we dont split the columns, I am keeping this for consistency of the current implementation.
22
+ // TODO: ED-26961 - After talking with Roto about this behaviour, he likes when we dont split the columns, I am keeping this for consistency of the current implementation.
23
23
  splitCellsInColumns(tr, table.pos, rect.left, rect.right);
24
24
 
25
25
  // Delete the columns
@@ -155,7 +155,7 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
155
155
  return cols;
156
156
  }
157
157
 
158
- // TODO: move to prosemirror-utils
158
+ // TODO: ED-26961 - move to prosemirror-utils
159
159
  var replaceCells = function replaceCells(tr, table, tablePos, modifyCell) {
160
160
  var rows = [];
161
161
  var modifiedCells = 0;
@@ -165,8 +165,7 @@ var replaceCells = function replaceCells(tr, table, tablePos, modifyCell) {
165
165
  for (var colIndex = 0; colIndex < row.childCount; colIndex++) {
166
166
  var cell = row.child(colIndex);
167
167
 
168
- // FIXME
169
- // The rowIndex and colIndex are not accurate in a merged cell scenario
168
+ // TODO: ED-26961 - The rowIndex and colIndex are not accurate in a merged cell scenario
170
169
  // e.g. table with 5 columns might have only one cell in a row, colIndex will be 1, where it should be 4
171
170
  var node = modifyCell(cell, rowIndex, colIndex);
172
171
  if (node.sameMarkup(cell) === false) {
@@ -83,7 +83,7 @@ export var transformSliceToRemoveNestedTables = function transformSliceToRemoveN
83
83
  var _slice$content$firstC, _slice$content$lastCh;
84
84
  var isPasteInTable = hasParentNodeOfType([table, tableCell, tableHeader])(selection);
85
85
  var isPasteInNestedTable = getParentOfTypeCount(schema.nodes.table)(selection.$from) > 1;
86
- var isCellPaste = isPasteInTable && slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === table;
86
+ var isCellPaste = isPasteInTable && slice.content.childCount === 1 && ((_slice$content$firstC = slice.content.firstChild) === null || _slice$content$firstC === void 0 ? void 0 : _slice$content$firstC.type) === table && slice.openStart !== 0 && slice.openEnd !== 0;
87
87
 
88
88
  // if nesting is allowed we bump up the default nesting allowance to 2 to support
89
89
  // two levels of nesting in nodes that support table nesting already such as layoutSection and expands