@atlaskit/editor-plugin-table 1.1.2 → 1.1.3

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 (51) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +13 -3
  3. package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +7 -2
  4. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -1
  5. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +17 -1
  6. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +38 -6
  7. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +2 -2
  8. package/dist/cjs/plugins/table/transforms/column-width.js +47 -5
  9. package/dist/cjs/plugins/table/ui/common-styles.js +4 -3
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +13 -3
  12. package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +7 -2
  13. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -1
  14. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +15 -0
  15. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +37 -4
  16. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +2 -2
  17. package/dist/es2019/plugins/table/transforms/column-width.js +45 -5
  18. package/dist/es2019/plugins/table/ui/common-styles.js +5 -2
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/plugins/table/nodeviews/TableComponent.js +13 -3
  21. package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +7 -2
  22. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -1
  23. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +15 -0
  24. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +35 -4
  25. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +2 -2
  26. package/dist/esm/plugins/table/transforms/column-width.js +47 -5
  27. package/dist/esm/plugins/table/ui/common-styles.js +3 -3
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +7 -0
  30. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +2 -1
  31. package/dist/types/plugins/table/ui/common-styles.d.ts +1 -0
  32. package/package.json +8 -6
  33. package/src/__tests__/integration/__fixtures__/empty-layout.ts +35 -0
  34. package/src/__tests__/integration/__fixtures__/nested-in-expand.ts +129 -0
  35. package/src/__tests__/integration/horizontal-scroll.ts +489 -0
  36. package/src/__tests__/unit/commands/insert.ts +3 -3
  37. package/src/__tests__/unit/keymap.ts +3 -1
  38. package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +38 -0
  39. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +5 -2
  40. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-column-menu-item-visual-hints-should-be-added-to-the-table-column-on-hover-1-snap.png +2 -2
  41. package/src/__tests__/visual-regression/__image_snapshots__/cell-options-menu-ts-table-cell-options-menu-delete-row-menu-item-visual-hints-should-be-added-to-the-table-row-on-hover-1-snap.png +2 -2
  42. package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +2 -2
  43. package/src/__tests__/visual-regression/sticky-header.ts +2 -1
  44. package/src/plugins/table/nodeviews/TableComponent.tsx +16 -3
  45. package/src/plugins/table/pm-plugins/table-resizing/commands.ts +6 -2
  46. package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +9 -1
  47. package/src/plugins/table/pm-plugins/table-resizing/utils/colgroup.ts +19 -1
  48. package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +57 -5
  49. package/src/plugins/table/pm-plugins/table-resizing/utils/resize-logic.ts +2 -2
  50. package/src/plugins/table/transforms/column-width.ts +60 -6
  51. package/src/plugins/table/ui/common-styles.ts +5 -2
@@ -5,4 +5,11 @@ declare type Col = Array<string | {
5
5
  export declare const generateColgroup: (table: PmNode) => Col[];
6
6
  export declare const insertColgroupFromNode: (tableRef: HTMLTableElement, table: PmNode) => HTMLCollection;
7
7
  export declare const hasTableBeenResized: (table: PmNode) => boolean;
8
+ /**
9
+ * Check if a table has all the column width set to tableCellMinWidth(48px) or null
10
+ *
11
+ * @param table
12
+ * @returns true if all column width is equal to tableCellMinWidth or null, false otherwise
13
+ */
14
+ export declare const isMinCellWidthTable: (table: PmNode) => boolean;
8
15
  export {};
@@ -18,5 +18,6 @@ interface getTableMaxWidthProps {
18
18
  layout: TableLayout;
19
19
  getEditorContainerWidth: GetEditorContainerWidth;
20
20
  }
21
- export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getEditorContainerWidth, }: getTableMaxWidthProps) => any;
21
+ export declare const getTableMaxWidth: ({ table, tableStart, state, layout, getEditorContainerWidth, }: getTableMaxWidthProps) => number;
22
+ export declare const getParentWidthWithoutPadding: (parentWidth: number, tableStartPos: number, state: EditorState) => number | undefined;
22
23
  export {};
@@ -1,5 +1,6 @@
1
1
  import type { FeatureFlags } from '@atlaskit/editor-common/types';
2
2
  import { ThemeProps } from '@atlaskit/theme/types';
3
+ export declare const insertColumnButtonOffset: number;
3
4
  export declare const tableStyles: (props: ThemeProps & {
4
5
  featureFlags?: FeatureFlags;
5
6
  }) => import("@emotion/react").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -24,7 +24,7 @@
24
24
  "@atlaskit/editor-tables": "^2.2.0",
25
25
  "@atlaskit/icon": "^21.11.0",
26
26
  "@atlaskit/theme": "^12.1.0",
27
- "@atlaskit/tokens": "^1.0.0",
27
+ "@atlaskit/tokens": "^1.1.0",
28
28
  "@atlaskit/tooltip": "^17.6.0",
29
29
  "@babel/runtime": "^7.0.0",
30
30
  "@emotion/react": "^11.7.1",
@@ -51,10 +51,10 @@
51
51
  "devDependencies": {
52
52
  "@atlaskit/analytics-next": "^8.3.3",
53
53
  "@atlaskit/button": "^16.5.0",
54
- "@atlaskit/editor-core": "^178.1.0",
54
+ "@atlaskit/editor-core": "^179.0.0",
55
55
  "@atlaskit/editor-test-helpers": "^18.0.0",
56
- "@atlaskit/link-provider": "^1.3.0",
57
- "@atlaskit/logo": "^13.10.0",
56
+ "@atlaskit/link-provider": "^1.4.0",
57
+ "@atlaskit/logo": "^13.11.0",
58
58
  "@atlaskit/media-integration-test-helpers": "^2.6.0",
59
59
  "@atlaskit/synchrony-test-helpers": "^2.3.0",
60
60
  "@atlaskit/util-data-test": "^17.6.0",
@@ -78,7 +78,9 @@
78
78
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1",
79
79
  "techstack": {
80
80
  "@repo/internal": {
81
- "theming": "tokens",
81
+ "design-tokens": [
82
+ "color"
83
+ ],
82
84
  "deprecation": "no-deprecated-imports",
83
85
  "styling": [
84
86
  "emotion"
@@ -0,0 +1,35 @@
1
+ export const emptyLayout = {
2
+ version: 1,
3
+ type: 'doc',
4
+ content: [
5
+ {
6
+ type: 'layoutSection',
7
+ content: [
8
+ {
9
+ type: 'layoutColumn',
10
+ attrs: {
11
+ width: 50,
12
+ },
13
+ content: [
14
+ {
15
+ type: 'paragraph',
16
+ content: [],
17
+ },
18
+ ],
19
+ },
20
+ {
21
+ type: 'layoutColumn',
22
+ attrs: {
23
+ width: 50,
24
+ },
25
+ content: [
26
+ {
27
+ type: 'paragraph',
28
+ content: [],
29
+ },
30
+ ],
31
+ },
32
+ ],
33
+ },
34
+ ],
35
+ };
@@ -0,0 +1,129 @@
1
+ export default {
2
+ version: 1,
3
+ type: 'doc',
4
+ content: [
5
+ {
6
+ type: 'expand',
7
+ attrs: {
8
+ title: '',
9
+ },
10
+ content: [
11
+ {
12
+ type: 'table',
13
+ attrs: {
14
+ isNumberColumnEnabled: false,
15
+ layout: 'default',
16
+ localId: '30bc8b3b-d6b5-42c8-830b-71358eb3ab39',
17
+ },
18
+ content: [
19
+ {
20
+ type: 'tableRow',
21
+ content: [
22
+ {
23
+ type: 'tableHeader',
24
+ attrs: {},
25
+ content: [
26
+ {
27
+ type: 'paragraph',
28
+ content: [],
29
+ },
30
+ ],
31
+ },
32
+ {
33
+ type: 'tableHeader',
34
+ attrs: {},
35
+ content: [
36
+ {
37
+ type: 'paragraph',
38
+ content: [],
39
+ },
40
+ ],
41
+ },
42
+ {
43
+ type: 'tableHeader',
44
+ attrs: {},
45
+ content: [
46
+ {
47
+ type: 'paragraph',
48
+ content: [],
49
+ },
50
+ ],
51
+ },
52
+ ],
53
+ },
54
+ {
55
+ type: 'tableRow',
56
+ content: [
57
+ {
58
+ type: 'tableCell',
59
+ attrs: {},
60
+ content: [
61
+ {
62
+ type: 'paragraph',
63
+ content: [],
64
+ },
65
+ ],
66
+ },
67
+ {
68
+ type: 'tableCell',
69
+ attrs: {},
70
+ content: [
71
+ {
72
+ type: 'paragraph',
73
+ content: [],
74
+ },
75
+ ],
76
+ },
77
+ {
78
+ type: 'tableCell',
79
+ attrs: {},
80
+ content: [
81
+ {
82
+ type: 'paragraph',
83
+ content: [],
84
+ },
85
+ ],
86
+ },
87
+ ],
88
+ },
89
+ {
90
+ type: 'tableRow',
91
+ content: [
92
+ {
93
+ type: 'tableCell',
94
+ attrs: {},
95
+ content: [
96
+ {
97
+ type: 'paragraph',
98
+ content: [],
99
+ },
100
+ ],
101
+ },
102
+ {
103
+ type: 'tableCell',
104
+ attrs: {},
105
+ content: [
106
+ {
107
+ type: 'paragraph',
108
+ content: [],
109
+ },
110
+ ],
111
+ },
112
+ {
113
+ type: 'tableCell',
114
+ attrs: {},
115
+ content: [
116
+ {
117
+ type: 'paragraph',
118
+ content: [],
119
+ },
120
+ ],
121
+ },
122
+ ],
123
+ },
124
+ ],
125
+ },
126
+ ],
127
+ },
128
+ ],
129
+ };