@atlaskit/editor-plugin-table 2.12.4 → 2.12.5

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 2.12.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`1da71810c5d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1da71810c5d) - [Regression] Fix Invalid getPos issue happening for Table nodeviews
8
+
3
9
  ## 2.12.4
4
10
 
5
11
  ### Patch Changes
@@ -153,7 +153,19 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
153
153
  var containerWidth = props.getEditorContainerWidth();
154
154
  var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
155
155
  var isResizing = Boolean((tableResizingPluginState === null || tableResizingPluginState === void 0 ? void 0 : tableResizingPluginState.dragging) || isTableResizing);
156
- var tableActive = props.getPos() === pluginState.tablePos && !isTableResizing;
156
+
157
+ /**
158
+ * ED-19810
159
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
160
+ * before CR6 lands in production
161
+ */
162
+ var tablePos;
163
+ try {
164
+ tablePos = typeof props.getPos === 'function' ? props.getPos() : undefined;
165
+ } catch (e) {
166
+ tablePos = undefined;
167
+ }
168
+ var tableActive = tablePos === pluginState.tablePos && !isTableResizing;
157
169
  return /*#__PURE__*/_react.default.createElement(_TableComponent.default, {
158
170
  view: props.view,
159
171
  allowColumnResizing: props.allowColumnResizing,
@@ -125,7 +125,19 @@ export default class TableView extends ReactNodeView {
125
125
  const containerWidth = props.getEditorContainerWidth();
126
126
  const isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
127
127
  const isResizing = Boolean((tableResizingPluginState === null || tableResizingPluginState === void 0 ? void 0 : tableResizingPluginState.dragging) || isTableResizing);
128
- const tableActive = props.getPos() === pluginState.tablePos && !isTableResizing;
128
+
129
+ /**
130
+ * ED-19810
131
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
132
+ * before CR6 lands in production
133
+ */
134
+ let tablePos;
135
+ try {
136
+ tablePos = typeof props.getPos === 'function' ? props.getPos() : undefined;
137
+ } catch (e) {
138
+ tablePos = undefined;
139
+ }
140
+ const tableActive = tablePos === pluginState.tablePos && !isTableResizing;
129
141
  return /*#__PURE__*/React.createElement(TableComponent, {
130
142
  view: props.view,
131
143
  allowColumnResizing: props.allowColumnResizing,
@@ -146,7 +146,19 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
146
146
  var containerWidth = props.getEditorContainerWidth();
147
147
  var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
148
148
  var isResizing = Boolean((tableResizingPluginState === null || tableResizingPluginState === void 0 ? void 0 : tableResizingPluginState.dragging) || isTableResizing);
149
- var tableActive = props.getPos() === pluginState.tablePos && !isTableResizing;
149
+
150
+ /**
151
+ * ED-19810
152
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
153
+ * before CR6 lands in production
154
+ */
155
+ var tablePos;
156
+ try {
157
+ tablePos = typeof props.getPos === 'function' ? props.getPos() : undefined;
158
+ } catch (e) {
159
+ tablePos = undefined;
160
+ }
161
+ var tableActive = tablePos === pluginState.tablePos && !isTableResizing;
150
162
  return /*#__PURE__*/React.createElement(TableComponent, {
151
163
  view: props.view,
152
164
  allowColumnResizing: props.allowColumnResizing,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.12.4",
3
+ "version": "2.12.5",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/editor-tables": "^2.3.0",
38
38
  "@atlaskit/icon": "^21.12.0",
39
39
  "@atlaskit/platform-feature-flags": "^0.2.1",
40
- "@atlaskit/theme": "^12.5.0",
40
+ "@atlaskit/theme": "^12.6.0",
41
41
  "@atlaskit/tokens": "^1.18.0",
42
42
  "@atlaskit/tooltip": "^17.8.0",
43
43
  "@babel/runtime": "^7.0.0",
@@ -221,8 +221,22 @@ export default class TableView extends ReactNodeView<Props> {
221
221
  const isResizing = Boolean(
222
222
  tableResizingPluginState?.dragging || isTableResizing,
223
223
  );
224
+
225
+ /**
226
+ * ED-19810
227
+ * There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
228
+ * before CR6 lands in production
229
+ */
230
+ let tablePos: number | undefined;
231
+ try {
232
+ tablePos =
233
+ typeof props.getPos === 'function' ? props.getPos() : undefined;
234
+ } catch (e) {
235
+ tablePos = undefined;
236
+ }
237
+
224
238
  const tableActive =
225
- props.getPos() === pluginState!.tablePos && !isTableResizing;
239
+ tablePos === pluginState!.tablePos && !isTableResizing;
226
240
 
227
241
  return (
228
242
  <TableComponent
@@ -1,173 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`change-date-inside-table.ts: Change date inside table 1`] = `
4
- Object {
5
- "content": Array [
6
- Object {
7
- "attrs": Object {
8
- "__autoSize": false,
9
- "isNumberColumnEnabled": false,
10
- "layout": "default",
11
- "localId": "abc-123",
12
- },
13
- "content": Array [
14
- Object {
15
- "content": Array [
16
- Object {
17
- "attrs": Object {
18
- "background": null,
19
- "colspan": 1,
20
- "colwidth": null,
21
- "rowspan": 1,
22
- },
23
- "content": Array [
24
- Object {
25
- "content": Array [
26
- Object {
27
- "attrs": Object {
28
- "timestamp": "1502841600000",
29
- },
30
- "type": "date",
31
- },
32
- Object {
33
- "text": " ",
34
- "type": "text",
35
- },
36
- ],
37
- "type": "paragraph",
38
- },
39
- ],
40
- "type": "tableHeader",
41
- },
42
- Object {
43
- "attrs": Object {
44
- "background": null,
45
- "colspan": 1,
46
- "colwidth": null,
47
- "rowspan": 1,
48
- },
49
- "content": Array [
50
- Object {
51
- "type": "paragraph",
52
- },
53
- ],
54
- "type": "tableHeader",
55
- },
56
- Object {
57
- "attrs": Object {
58
- "background": null,
59
- "colspan": 1,
60
- "colwidth": null,
61
- "rowspan": 1,
62
- },
63
- "content": Array [
64
- Object {
65
- "type": "paragraph",
66
- },
67
- ],
68
- "type": "tableHeader",
69
- },
70
- ],
71
- "type": "tableRow",
72
- },
73
- Object {
74
- "content": Array [
75
- Object {
76
- "attrs": Object {
77
- "background": null,
78
- "colspan": 1,
79
- "colwidth": null,
80
- "rowspan": 1,
81
- },
82
- "content": Array [
83
- Object {
84
- "type": "paragraph",
85
- },
86
- ],
87
- "type": "tableCell",
88
- },
89
- Object {
90
- "attrs": Object {
91
- "background": null,
92
- "colspan": 1,
93
- "colwidth": null,
94
- "rowspan": 1,
95
- },
96
- "content": Array [
97
- Object {
98
- "type": "paragraph",
99
- },
100
- ],
101
- "type": "tableCell",
102
- },
103
- Object {
104
- "attrs": Object {
105
- "background": null,
106
- "colspan": 1,
107
- "colwidth": null,
108
- "rowspan": 1,
109
- },
110
- "content": Array [
111
- Object {
112
- "type": "paragraph",
113
- },
114
- ],
115
- "type": "tableCell",
116
- },
117
- ],
118
- "type": "tableRow",
119
- },
120
- Object {
121
- "content": Array [
122
- Object {
123
- "attrs": Object {
124
- "background": null,
125
- "colspan": 1,
126
- "colwidth": null,
127
- "rowspan": 1,
128
- },
129
- "content": Array [
130
- Object {
131
- "type": "paragraph",
132
- },
133
- ],
134
- "type": "tableCell",
135
- },
136
- Object {
137
- "attrs": Object {
138
- "background": null,
139
- "colspan": 1,
140
- "colwidth": null,
141
- "rowspan": 1,
142
- },
143
- "content": Array [
144
- Object {
145
- "type": "paragraph",
146
- },
147
- ],
148
- "type": "tableCell",
149
- },
150
- Object {
151
- "attrs": Object {
152
- "background": null,
153
- "colspan": 1,
154
- "colwidth": null,
155
- "rowspan": 1,
156
- },
157
- "content": Array [
158
- Object {
159
- "type": "paragraph",
160
- },
161
- ],
162
- "type": "tableCell",
163
- },
164
- ],
165
- "type": "tableRow",
166
- },
167
- ],
168
- "type": "table",
169
- },
170
- ],
171
- "type": "doc",
172
- }
173
- `;
@@ -1,46 +0,0 @@
1
- import {
2
- editable,
3
- fullpage,
4
- getDocFromElement,
5
- insertBlockMenuItem,
6
- quickInsert,
7
- } from '@atlaskit/editor-test-helpers/integration/helpers';
8
- import {
9
- goToEditorTestingWDExample,
10
- mountEditor,
11
- } from '@atlaskit/editor-test-helpers/testing-example-page';
12
- import { BrowserTestCase } from '@atlaskit/webdriver-runner/runner';
13
-
14
- const calendar = '[aria-label="calendar"]';
15
- const nextDate = 'button[aria-selected=true] + button';
16
-
17
- BrowserTestCase(
18
- 'change-date-inside-table.ts: Change date inside table',
19
- {},
20
- async (client: any, testName: string) => {
21
- const page = await goToEditorTestingWDExample(
22
- client,
23
- 'editor-plugin-table',
24
- );
25
- await mountEditor(page, {
26
- appearance: fullpage.appearance,
27
- allowDate: true,
28
- allowTables: {
29
- advanced: true,
30
- },
31
- });
32
-
33
- await page.click(editable);
34
-
35
- // Insert table
36
- await quickInsert(page, 'Table');
37
- // Insert Date
38
- await insertBlockMenuItem(page, 'Date');
39
- expect(await page.isExisting(calendar)).toBe(true);
40
-
41
- await page.click(nextDate);
42
-
43
- const doc = await page.$eval(editable, getDocFromElement);
44
- expect(doc).toMatchCustomDocSnapshot(testName);
45
- },
46
- );