@atlaskit/editor-plugin-table 5.4.7 → 5.4.8

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 (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/plugins/table/commands/misc.js +14 -12
  3. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -4
  4. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +9 -3
  5. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -3
  6. package/dist/cjs/plugins/table/types.js +2 -1
  7. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +4 -1
  8. package/dist/cjs/plugins/table/ui/common-styles.js +6 -9
  9. package/dist/cjs/plugins/table/ui/ui-styles.js +12 -16
  10. package/dist/cjs/plugins/table/utils/decoration.js +20 -25
  11. package/dist/es2019/plugins/table/commands/misc.js +5 -4
  12. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +2 -4
  13. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +9 -3
  14. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -3
  15. package/dist/es2019/plugins/table/types.js +2 -1
  16. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -1
  17. package/dist/es2019/plugins/table/ui/common-styles.js +20 -20
  18. package/dist/es2019/plugins/table/ui/ui-styles.js +18 -21
  19. package/dist/es2019/plugins/table/utils/decoration.js +20 -25
  20. package/dist/esm/plugins/table/commands/misc.js +13 -13
  21. package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -4
  22. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +9 -3
  23. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -3
  24. package/dist/esm/plugins/table/types.js +2 -1
  25. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +4 -1
  26. package/dist/esm/plugins/table/ui/common-styles.js +6 -9
  27. package/dist/esm/plugins/table/ui/ui-styles.js +12 -16
  28. package/dist/esm/plugins/table/utils/decoration.js +20 -25
  29. package/dist/types/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -2
  30. package/dist/types/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +1 -1
  31. package/dist/types/plugins/table/pm-plugins/decorations/utils/types.d.ts +10 -4
  32. package/dist/types/plugins/table/types.d.ts +2 -1
  33. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -2
  34. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +1 -1
  35. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +10 -4
  36. package/dist/types-ts4.5/plugins/table/types.d.ts +2 -1
  37. package/package.json +1 -1
  38. package/src/__tests__/unit/event-handlers.ts +37 -38
  39. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +46 -36
  40. package/src/plugins/table/commands/misc.ts +9 -7
  41. package/src/plugins/table/nodeviews/TableComponent.tsx +20 -22
  42. package/src/plugins/table/pm-plugins/decorations/plugin.ts +7 -2
  43. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +20 -11
  44. package/src/plugins/table/pm-plugins/decorations/utils/compose-decorations.ts +2 -4
  45. package/src/plugins/table/pm-plugins/decorations/utils/types.ts +14 -7
  46. package/src/plugins/table/types.ts +2 -1
  47. package/src/plugins/table/ui/TableFloatingControls/index.tsx +73 -67
  48. package/src/plugins/table/ui/common-styles.ts +20 -23
  49. package/src/plugins/table/ui/ui-styles.ts +18 -21
  50. package/src/plugins/table/utils/decoration.ts +27 -32
@@ -22,7 +22,6 @@ import {
22
22
  getCellsInRow,
23
23
  getSelectionRect,
24
24
  } from '@atlaskit/editor-tables/utils';
25
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
26
25
 
27
26
  import type { Cell, CellColumnPositioning } from '../types';
28
27
  import { TableCssClassName as ClassName, TableDecorations } from '../types';
@@ -219,37 +218,33 @@ export const createColumnControlsDecoration = (
219
218
  ): Decoration[] => {
220
219
  const cells: ContentNodeWithPos[] = getCellsInRow(0)(selection) || [];
221
220
 
222
- if (getBooleanFF('platform.editor.table.drag-and-drop')) {
223
- return [];
224
- } else {
225
- let index = 0;
226
- return cells.map((cell) => {
227
- const colspan = (cell.node.attrs as CellAttributes).colspan || 1;
228
- // It's important these values are scoped locally as the widget callback could be executed anytime in the future
229
- // and we want to avoid value leak
230
- const startIndex = index;
231
- const endIndex = startIndex + colspan;
232
-
233
- // The next cell start index will commence from the current cell end index.
234
- index = endIndex;
235
-
236
- return Decoration.widget(
237
- cell.pos + 1,
238
- () => {
239
- const element = document.createElement('div');
240
- element.classList.add(ClassName.COLUMN_CONTROLS_DECORATIONS);
241
- element.dataset.startIndex = `${startIndex}`;
242
- element.dataset.endIndex = `${endIndex}`;
243
- return element;
244
- },
245
- {
246
- key: `${TableDecorations.COLUMN_CONTROLS_DECORATIONS}_${endIndex}`,
247
- // this decoration should be the first one, even before gap cursor.
248
- side: -100,
249
- },
250
- );
251
- });
252
- }
221
+ let index = 0;
222
+ return cells.map((cell) => {
223
+ const colspan = (cell.node.attrs as CellAttributes).colspan || 1;
224
+ // It's important these values are scoped locally as the widget callback could be executed anytime in the future
225
+ // and we want to avoid value leak
226
+ const startIndex = index;
227
+ const endIndex = startIndex + colspan;
228
+
229
+ // The next cell start index will commence from the current cell end index.
230
+ index = endIndex;
231
+
232
+ return Decoration.widget(
233
+ cell.pos + 1,
234
+ () => {
235
+ const element = document.createElement('div');
236
+ element.classList.add(ClassName.COLUMN_CONTROLS_DECORATIONS);
237
+ element.dataset.startIndex = `${startIndex}`;
238
+ element.dataset.endIndex = `${endIndex}`;
239
+ return element;
240
+ },
241
+ {
242
+ key: `${TableDecorations.COLUMN_CONTROLS_DECORATIONS}_${endIndex}`,
243
+ // this decoration should be the first one, even before gap cursor.
244
+ side: -100,
245
+ },
246
+ );
247
+ });
253
248
  };
254
249
 
255
250
  export const updateDecorations = (