@atlaskit/editor-plugin-table 2.12.4 → 2.12.6
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 +12 -0
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +13 -1
- package/dist/cjs/plugins/table/nodeviews/table.js +13 -1
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +13 -1
- package/dist/es2019/plugins/table/nodeviews/table.js +13 -1
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +13 -1
- package/dist/esm/plugins/table/nodeviews/table.js +13 -1
- package/package.json +3 -3
- package/src/plugins/table/nodeviews/TableComponent.tsx +13 -1
- package/src/plugins/table/nodeviews/table.tsx +14 -1
- package/src/__tests__/integration/__snapshots__/change-date-inside-table.ts.snap +0 -173
- package/src/__tests__/integration/change-date-inside-table.ts +0 -46
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 2.12.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1f6e908f2bd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1f6e908f2bd) - Workaround invalid getPos error occuring for TableComponent
|
|
8
|
+
|
|
9
|
+
## 2.12.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`1da71810c5d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/1da71810c5d) - [Regression] Fix Invalid getPos issue happening for Table nodeviews
|
|
14
|
+
|
|
3
15
|
## 2.12.4
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -415,7 +415,19 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
415
415
|
visibility: visible ? 'visible' : 'hidden'
|
|
416
416
|
};
|
|
417
417
|
});
|
|
418
|
-
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* ED-19838
|
|
421
|
+
* There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
|
|
422
|
+
* before CR6 lands in production
|
|
423
|
+
*/
|
|
424
|
+
var tablePos;
|
|
425
|
+
try {
|
|
426
|
+
tablePos = getPos ? getPos() : undefined;
|
|
427
|
+
} catch (e) {
|
|
428
|
+
tablePos = undefined;
|
|
429
|
+
}
|
|
430
|
+
var isNested = (0, _utils4.isTableNested)(view.state, tablePos);
|
|
419
431
|
return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer, {
|
|
420
432
|
className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_CONTAINER, (_classnames = {}, (0, _defineProperty3.default)(_classnames, _types.TableCssClassName.WITH_CONTROLS, allowControls && tableActive), (0, _defineProperty3.default)(_classnames, _types.TableCssClassName.TABLE_STICKY, this.state.stickyHeader && hasHeaderRow), (0, _defineProperty3.default)(_classnames, _types.TableCssClassName.HOVERED_DELETE_BUTTON, isInDanger), (0, _defineProperty3.default)(_classnames, _types.TableCssClassName.TABLE_SELECTED, (0, _utils2.isTableSelected)(view.state.selection)), _classnames)),
|
|
421
433
|
editorView: view,
|
|
@@ -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
|
-
|
|
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
|
+
* directly to confluence since this bug is now in production.
|
|
161
|
+
*/
|
|
162
|
+
var tablePos;
|
|
163
|
+
try {
|
|
164
|
+
tablePos = props.getPos ? 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,
|
|
@@ -407,7 +407,19 @@ class TableComponent extends React.Component {
|
|
|
407
407
|
const shadowStyle = memoizeOne(visible => ({
|
|
408
408
|
visibility: visible ? 'visible' : 'hidden'
|
|
409
409
|
}));
|
|
410
|
-
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* ED-19838
|
|
413
|
+
* There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
|
|
414
|
+
* before CR6 lands in production
|
|
415
|
+
*/
|
|
416
|
+
let tablePos;
|
|
417
|
+
try {
|
|
418
|
+
tablePos = getPos ? getPos() : undefined;
|
|
419
|
+
} catch (e) {
|
|
420
|
+
tablePos = undefined;
|
|
421
|
+
}
|
|
422
|
+
const isNested = isTableNested(view.state, tablePos);
|
|
411
423
|
return /*#__PURE__*/React.createElement(TableContainer, {
|
|
412
424
|
className: classnames(ClassName.TABLE_CONTAINER, {
|
|
413
425
|
[ClassName.WITH_CONTROLS]: allowControls && tableActive,
|
|
@@ -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
|
-
|
|
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
|
+
* directly to confluence since this bug is now in production.
|
|
133
|
+
*/
|
|
134
|
+
let tablePos;
|
|
135
|
+
try {
|
|
136
|
+
tablePos = props.getPos ? 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,
|
|
@@ -408,7 +408,19 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
408
408
|
visibility: visible ? 'visible' : 'hidden'
|
|
409
409
|
};
|
|
410
410
|
});
|
|
411
|
-
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* ED-19838
|
|
414
|
+
* There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
|
|
415
|
+
* before CR6 lands in production
|
|
416
|
+
*/
|
|
417
|
+
var tablePos;
|
|
418
|
+
try {
|
|
419
|
+
tablePos = getPos ? getPos() : undefined;
|
|
420
|
+
} catch (e) {
|
|
421
|
+
tablePos = undefined;
|
|
422
|
+
}
|
|
423
|
+
var isNested = isTableNested(view.state, tablePos);
|
|
412
424
|
return /*#__PURE__*/React.createElement(TableContainer, {
|
|
413
425
|
className: classnames(ClassName.TABLE_CONTAINER, (_classnames = {}, _defineProperty(_classnames, ClassName.WITH_CONTROLS, allowControls && tableActive), _defineProperty(_classnames, ClassName.TABLE_STICKY, this.state.stickyHeader && hasHeaderRow), _defineProperty(_classnames, ClassName.HOVERED_DELETE_BUTTON, isInDanger), _defineProperty(_classnames, ClassName.TABLE_SELECTED, isTableSelected(view.state.selection)), _classnames)),
|
|
414
426
|
editorView: view,
|
|
@@ -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
|
-
|
|
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
|
+
* directly to confluence since this bug is now in production.
|
|
154
|
+
*/
|
|
155
|
+
var tablePos;
|
|
156
|
+
try {
|
|
157
|
+
tablePos = props.getPos ? 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.
|
|
3
|
+
"version": "2.12.6",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -37,8 +37,8 @@
|
|
|
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.
|
|
41
|
-
"@atlaskit/tokens": "^1.
|
|
40
|
+
"@atlaskit/theme": "^12.6.0",
|
|
41
|
+
"@atlaskit/tokens": "^1.19.0",
|
|
42
42
|
"@atlaskit/tooltip": "^17.8.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@emotion/react": "^11.7.1",
|
|
@@ -342,7 +342,19 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
342
342
|
({ visibility: visible ? 'visible' : 'hidden' } as CSSProperties),
|
|
343
343
|
);
|
|
344
344
|
|
|
345
|
-
|
|
345
|
+
/**
|
|
346
|
+
* ED-19838
|
|
347
|
+
* There is a getPos issue coming from this code. We need to apply this workaround for now and apply a patch
|
|
348
|
+
* before CR6 lands in production
|
|
349
|
+
*/
|
|
350
|
+
let tablePos: number | undefined;
|
|
351
|
+
try {
|
|
352
|
+
tablePos = getPos ? getPos() : undefined;
|
|
353
|
+
} catch (e) {
|
|
354
|
+
tablePos = undefined;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const isNested = isTableNested(view.state, tablePos);
|
|
346
358
|
|
|
347
359
|
return (
|
|
348
360
|
<TableContainer
|
|
@@ -221,8 +221,21 @@ 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
|
+
* directly to confluence since this bug is now in production.
|
|
229
|
+
*/
|
|
230
|
+
let tablePos: number | undefined;
|
|
231
|
+
try {
|
|
232
|
+
tablePos = props.getPos ? props.getPos() : undefined;
|
|
233
|
+
} catch (e) {
|
|
234
|
+
tablePos = undefined;
|
|
235
|
+
}
|
|
236
|
+
|
|
224
237
|
const tableActive =
|
|
225
|
-
|
|
238
|
+
tablePos === pluginState!.tablePos && !isTableResizing;
|
|
226
239
|
|
|
227
240
|
return (
|
|
228
241
|
<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
|
-
);
|