@atlaskit/editor-plugin-table 11.1.2 → 11.1.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 (46) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/afm-rovo-extension/tsconfig.json +108 -0
  3. package/dist/cjs/nodeviews/TableContainer.js +8 -3
  4. package/dist/cjs/nodeviews/TableResizer.js +10 -5
  5. package/dist/cjs/nodeviews/toDOM.js +10 -3
  6. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +6 -1
  7. package/dist/cjs/pm-plugins/utils/snapping.js +9 -2
  8. package/dist/cjs/ui/DragPreview/index.js +2 -0
  9. package/dist/cjs/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +2 -0
  10. package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  11. package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -0
  12. package/dist/cjs/ui/TableFullWidthLabel/index.js +2 -0
  13. package/dist/es2019/nodeviews/TableContainer.js +9 -4
  14. package/dist/es2019/nodeviews/TableResizer.js +11 -6
  15. package/dist/es2019/nodeviews/toDOM.js +10 -3
  16. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +7 -2
  17. package/dist/es2019/pm-plugins/utils/snapping.js +10 -3
  18. package/dist/es2019/ui/DragPreview/index.js +2 -0
  19. package/dist/es2019/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
  20. package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  21. package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +1 -0
  22. package/dist/es2019/ui/TableFullWidthLabel/index.js +1 -0
  23. package/dist/es2019/ui/toolbar.js +1 -1
  24. package/dist/esm/nodeviews/TableContainer.js +9 -4
  25. package/dist/esm/nodeviews/TableResizer.js +11 -6
  26. package/dist/esm/nodeviews/toDOM.js +10 -3
  27. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +7 -2
  28. package/dist/esm/pm-plugins/utils/snapping.js +10 -3
  29. package/dist/esm/ui/DragPreview/index.js +2 -0
  30. package/dist/esm/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
  31. package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  32. package/dist/esm/ui/FloatingDragMenu/DragMenu.js +1 -0
  33. package/dist/esm/ui/TableFullWidthLabel/index.js +1 -0
  34. package/dist/esm/ui/toolbar.js +1 -1
  35. package/package.json +4 -4
  36. package/src/nodeviews/TableContainer.tsx +15 -5
  37. package/src/nodeviews/TableResizer.tsx +20 -9
  38. package/src/nodeviews/toDOM.ts +10 -3
  39. package/src/pm-plugins/table-resizing/utils/misc.ts +12 -1
  40. package/src/pm-plugins/utils/snapping.ts +15 -3
  41. package/src/ui/DragPreview/index.tsx +1 -0
  42. package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +1 -0
  43. package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +1 -0
  44. package/src/ui/FloatingDragMenu/DragMenu.tsx +1 -0
  45. package/src/ui/TableFullWidthLabel/index.tsx +1 -0
  46. package/src/ui/toolbar.tsx +2 -2
@@ -14,7 +14,10 @@ import {
14
14
  akEditorFullWidthLayoutWidth,
15
15
  akEditorGutterPaddingDynamic,
16
16
  akEditorTableNumberColumnWidth,
17
+ akEditorGutterPaddingReduced,
18
+ akEditorFullPageNarrowBreakout,
17
19
  } from '@atlaskit/editor-shared-styles';
20
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
18
21
 
19
22
  import type { TableOptions } from '../../../nodeviews/types';
20
23
 
@@ -33,8 +36,16 @@ export function getLayoutSize(
33
36
  const { isFullWidthModeEnabled } = options;
34
37
 
35
38
  if (isFullWidthModeEnabled) {
39
+ let padding: number = akEditorGutterPaddingDynamic();
40
+ if (
41
+ containerWidth <= akEditorFullPageNarrowBreakout &&
42
+ expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)
43
+ ) {
44
+ padding = akEditorGutterPaddingReduced;
45
+ }
46
+
36
47
  return containerWidth
37
- ? Math.min(containerWidth - akEditorGutterPaddingDynamic() * 2, akEditorFullWidthLayoutWidth)
48
+ ? Math.min(containerWidth - padding * 2, akEditorFullWidthLayoutWidth)
38
49
  : akEditorFullWidthLayoutWidth;
39
50
  }
40
51
 
@@ -5,7 +5,10 @@ import {
5
5
  akEditorDefaultLayoutWidth,
6
6
  akEditorFullWidthLayoutWidth,
7
7
  akEditorGutterPaddingDynamic,
8
+ akEditorGutterPaddingReduced,
9
+ akEditorFullPageNarrowBreakout,
8
10
  } from '@atlaskit/editor-shared-styles';
11
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
12
 
10
13
  const numberOfLanesInDefaultLayoutWidth = 12;
11
14
 
@@ -29,6 +32,13 @@ export type GuidelineExcludeConfig = {
29
32
  breakoutPoints: boolean;
30
33
  };
31
34
 
35
+ const getPadding = (editorContainerWith: number) => {
36
+ return editorContainerWith <= akEditorFullPageNarrowBreakout &&
37
+ expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)
38
+ ? akEditorGutterPaddingReduced
39
+ : akEditorGutterPaddingDynamic();
40
+ };
41
+
32
42
  // FF TablePreserve for calculateDefaultSnappings
33
43
  export const calculateDefaultTablePreserveSnappings = (
34
44
  lengthOffset = 0,
@@ -38,10 +48,11 @@ export const calculateDefaultTablePreserveSnappings = (
38
48
  breakoutPoints: false,
39
49
  },
40
50
  ) => {
51
+ const padding = getPadding(editorContainerWith);
41
52
  const dynamicFullWidthLine =
42
- editorContainerWith - akEditorGutterPaddingDynamic() * 2 >= akEditorFullWidthLayoutWidth
53
+ editorContainerWith - padding * 2 >= akEditorFullWidthLayoutWidth
43
54
  ? akEditorFullWidthLayoutWidth
44
- : editorContainerWith - akEditorGutterPaddingDynamic() * 2;
55
+ : editorContainerWith - padding * 2;
45
56
 
46
57
  const guides = [dynamicFullWidthLine - lengthOffset];
47
58
 
@@ -77,7 +88,8 @@ export const defaultTablePreserveSnappingWidths = (
77
88
  breakoutPoints: false,
78
89
  },
79
90
  ) => {
80
- return editorContainerWidth - akEditorGutterPaddingDynamic() * 2 > akEditorFullWidthLayoutWidth
91
+ const padding = getPadding(editorContainerWidth);
92
+ return editorContainerWidth - padding * 2 > akEditorFullWidthLayoutWidth
81
93
  ? calculateDefaultSnappings()
82
94
  : calculateDefaultTablePreserveSnappings(lengthOffset, editorContainerWidth, exclude); // lengthOffset was hardcoded 0 here, created PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
83
95
  };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
3
4
  import { Box, xcss } from '@atlaskit/primitives';
4
5
 
5
6
  import type { TableDirection } from '../../types';
@@ -11,6 +11,7 @@ import {
11
11
  FloatingToolbarButton as Button,
12
12
  FloatingToolbarSeparator,
13
13
  } from '@atlaskit/editor-common/ui';
14
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
14
15
  import { Box, xcss } from '@atlaskit/primitives';
15
16
 
16
17
  const containerStyles = xcss({
@@ -53,6 +53,7 @@ import TableRowAddBelowIcon from '@atlaskit/icon/core/table-row-add-below';
53
53
  import TableRowDeleteIcon from '@atlaskit/icon/core/table-row-delete';
54
54
  import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
55
55
  import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
56
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
56
57
  import { Box, xcss } from '@atlaskit/primitives';
57
58
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
58
59
 
@@ -42,6 +42,7 @@ import {
42
42
  isSelectionType,
43
43
  } from '@atlaskit/editor-tables/utils';
44
44
  import PaintBucketIcon from '@atlaskit/icon/core/migration/paint-bucket--editor-background-color';
45
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
45
46
  import { Box, xcss } from '@atlaskit/primitives';
46
47
  import Toggle from '@atlaskit/toggle';
47
48
 
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { useIntl } from 'react-intl-next';
4
4
 
5
5
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
+ // eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
6
7
  import { Box, Inline, xcss } from '@atlaskit/primitives';
7
8
  import { token } from '@atlaskit/tokens';
8
9
 
@@ -17,8 +17,8 @@ import type {
17
17
  Command,
18
18
  CommandDispatch,
19
19
  ConfirmDialogOptions,
20
- DropdownOptions,
21
20
  DropdownOptionT,
21
+ DropdownOptions,
22
22
  FloatingToolbarDropdown,
23
23
  FloatingToolbarHandler,
24
24
  FloatingToolbarItem,
@@ -26,7 +26,7 @@ import type {
26
26
  Icon,
27
27
  typeOption,
28
28
  } from '@atlaskit/editor-common/types';
29
- import { cellBackgroundColorPalette, DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
29
+ import { DEFAULT_BORDER_COLOR, cellBackgroundColorPalette } from '@atlaskit/editor-common/ui-color';
30
30
  import {
31
31
  closestElement,
32
32
  getChildrenInfo,