@atlaskit/editor-plugin-table 1.0.2 → 1.1.0
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 +21 -0
- package/dist/cjs/plugins/table/toolbar.js +24 -0
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +3 -1
- package/dist/cjs/plugins/table/ui/FloatingInsertButton/index.js +3 -1
- package/dist/cjs/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +2 -1
- package/dist/cjs/plugins/table/utils/decoration.js +31 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/toolbar.js +25 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +3 -1
- package/dist/es2019/plugins/table/ui/FloatingInsertButton/index.js +3 -1
- package/dist/es2019/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +2 -1
- package/dist/es2019/plugins/table/utils/decoration.js +32 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/toolbar.js +25 -1
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +3 -1
- package/dist/esm/plugins/table/ui/FloatingInsertButton/index.js +3 -1
- package/dist/esm/plugins/table/ui/TableFloatingControls/NumberColumn/index.js +2 -1
- package/dist/esm/plugins/table/utils/decoration.js +32 -2
- package/dist/esm/version.json +1 -1
- package/package.json +4 -4
- package/report.api.md +15 -0
- package/src/__tests__/integration/__fixtures__/basic-table-with-merged-cell.ts +112 -0
- package/src/__tests__/integration/__fixtures__/paragraph-and-table-adf.ts +132 -0
- package/src/__tests__/integration/__snapshots__/floating-toolbar.ts.snap +292 -0
- package/src/__tests__/integration/arrow-down-into-table.ts +24 -15
- package/src/__tests__/integration/deleting-empty-paragraph-under-table.ts +3 -3
- package/src/__tests__/integration/floating-toolbar.ts +164 -8
- package/src/__tests__/integration/meta-arrowup-cursor-in-first-row.ts +1 -1
- package/src/__tests__/unit/copy-paste.ts +1 -1
- package/src/__tests__/unit/toolbar.ts +86 -2
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +7 -1
- package/src/plugins/table/toolbar.tsx +23 -0
- package/src/plugins/table/ui/FloatingContextualButton/index.tsx +2 -0
- package/src/plugins/table/ui/FloatingInsertButton/index.tsx +2 -0
- package/src/plugins/table/ui/TableFloatingControls/NumberColumn/index.tsx +1 -0
- package/src/plugins/table/utils/decoration.ts +27 -2
- package/src/__tests__/integration/__fixtures__/paragraph-and-table-adf.json +0 -130
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`a0a35fe7fb1`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a0a35fe7fb1) - Renaming contentComponent event subject to contentComponentv2. Move errorStack attribute to nonPrivacySafeAttributes
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`cb6dc027c6d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cb6dc027c6d) - [ux] Disable content editable on a table number column to prevent selection on the number column.
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 1.0.3
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- [`20117f2de5a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/20117f2de5a) - [ux] ED-16204 Fix table cell options floating toolbar context menu closes after clicking on disabled options
|
|
19
|
+
- [`c6c0cab10e0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c6c0cab10e0) - [ux] ED-16205 - Fix missing yellow highlight on merged table cells when hover sort column options on table floating toolbar
|
|
20
|
+
- [`e3b699e5069`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e3b699e5069) - ED-15794 - Fix merged cells in table not highlighting on delete hover when in bottom right corner
|
|
21
|
+
- [`746d7339a88`](https://bitbucket.org/atlassian/atlassian-frontend/commits/746d7339a88) - [ux] ED-15823 - Table cells on the second column would change their color upon unchecking "Header Column" table option when the selection cursor was placed in the 3rd column. This was caused by a view update not identifying the cells to update correctly. This was causing table data cells to be changed to table header cells.
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 1.0.2
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -264,6 +264,18 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
|
|
|
264
264
|
options.push({
|
|
265
265
|
id: 'editor.table.sortColumnAsc',
|
|
266
266
|
title: formatMessage(_ContextualMenu.messages.sortColumnASC),
|
|
267
|
+
onMouseOver: function onMouseOver(state, dispatch) {
|
|
268
|
+
if ((0, _utils.getMergedCellsPositions)(state.tr).length !== 0) {
|
|
269
|
+
(0, _commands.hoverMergedCells)()(state, dispatch);
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return false;
|
|
274
|
+
},
|
|
275
|
+
onMouseOut: function onMouseOut(state, dispatch) {
|
|
276
|
+
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
277
|
+
return true;
|
|
278
|
+
},
|
|
267
279
|
onClick: function onClick(state, dispatch) {
|
|
268
280
|
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, _steps.TableSortOrder.ASC)(state, dispatch);
|
|
269
281
|
return true;
|
|
@@ -275,6 +287,18 @@ var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(editorSta
|
|
|
275
287
|
options.push({
|
|
276
288
|
id: 'editor.table.sortColumnDesc',
|
|
277
289
|
title: formatMessage(_ContextualMenu.messages.sortColumnDESC),
|
|
290
|
+
onMouseOver: function onMouseOver(state, dispatch) {
|
|
291
|
+
if ((0, _utils.getMergedCellsPositions)(state.tr).length !== 0) {
|
|
292
|
+
(0, _commands.hoverMergedCells)()(state, dispatch);
|
|
293
|
+
return true;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return false;
|
|
297
|
+
},
|
|
298
|
+
onMouseOut: function onMouseOut(state, dispatch) {
|
|
299
|
+
(0, _commands.clearHoverSelection)()(state, dispatch);
|
|
300
|
+
return true;
|
|
301
|
+
},
|
|
278
302
|
onClick: function onClick(state, dispatch) {
|
|
279
303
|
(0, _commandsWithAnalytics.sortColumnWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, _steps.TableSortOrder.DESC)(state, dispatch);
|
|
280
304
|
return true;
|
|
@@ -118,7 +118,9 @@ var FloatingContextualButtonInner = /*#__PURE__*/function (_React$Component) {
|
|
|
118
118
|
selection: editorView.state.selection.toJSON(),
|
|
119
119
|
position: targetCellPosition,
|
|
120
120
|
docSize: editorView.state.doc.nodeSize,
|
|
121
|
-
error: error instanceof Error ? error.message : String(error)
|
|
121
|
+
error: error instanceof Error ? error.message : String(error)
|
|
122
|
+
},
|
|
123
|
+
nonPrivacySafeAttributes: {
|
|
122
124
|
errorStack: error instanceof Error ? error.stack : undefined
|
|
123
125
|
}
|
|
124
126
|
};
|
|
@@ -134,7 +134,9 @@ var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
134
134
|
selection: editorView.state.selection.toJSON(),
|
|
135
135
|
position: pos,
|
|
136
136
|
docSize: editorView.state.doc.nodeSize,
|
|
137
|
-
error: error === null || error === void 0 ? void 0 : error.toString()
|
|
137
|
+
error: error === null || error === void 0 ? void 0 : error.toString()
|
|
138
|
+
},
|
|
139
|
+
nonPrivacySafeAttributes: {
|
|
138
140
|
errorStack: error.stack || undefined
|
|
139
141
|
}
|
|
140
142
|
};
|
|
@@ -119,7 +119,8 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
119
119
|
className: _types.TableCssClassName.NUMBERED_COLUMN,
|
|
120
120
|
style: {
|
|
121
121
|
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined
|
|
122
|
-
}
|
|
122
|
+
},
|
|
123
|
+
contentEditable: false
|
|
123
124
|
}, rowHeights.map(function (rowHeight, index) {
|
|
124
125
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
125
126
|
key: "wrapper-".concat(index),
|
|
@@ -89,7 +89,37 @@ var createControlsHoverDecoration = function createControlsHoverDecoration(cells
|
|
|
89
89
|
// to match the "clicked" selection
|
|
90
90
|
|
|
91
91
|
if (danger) {
|
|
92
|
-
|
|
92
|
+
// Find the bounding rectangle of all the given cells, also considering
|
|
93
|
+
// merged cells.
|
|
94
|
+
var _cells$reduce3 = cells.reduce(function (acc, cell) {
|
|
95
|
+
var _map$findCell = map.findCell(cell.pos - table.start),
|
|
96
|
+
left = _map$findCell.left,
|
|
97
|
+
right = _map$findCell.right,
|
|
98
|
+
bottom = _map$findCell.bottom,
|
|
99
|
+
top = _map$findCell.top; // Finding the bounding rect requires finding the min left and top positions,
|
|
100
|
+
// and the max right and bottom positions of the cells
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
recLeft: Math.min(acc.recLeft, left),
|
|
105
|
+
recTop: Math.min(acc.recTop, top),
|
|
106
|
+
recRight: Math.max(acc.recRight, right),
|
|
107
|
+
recBottom: Math.max(acc.recBottom, bottom)
|
|
108
|
+
};
|
|
109
|
+
}, // +-Infinity as initialisation vars which will always be overwritten
|
|
110
|
+
// by smaller/larger values respectively
|
|
111
|
+
{
|
|
112
|
+
recLeft: Infinity,
|
|
113
|
+
recTop: Infinity,
|
|
114
|
+
recRight: -Infinity,
|
|
115
|
+
recBottom: -Infinity
|
|
116
|
+
}),
|
|
117
|
+
recLeft = _cells$reduce3.recLeft,
|
|
118
|
+
recTop = _cells$reduce3.recTop,
|
|
119
|
+
recRight = _cells$reduce3.recRight,
|
|
120
|
+
recBottom = _cells$reduce3.recBottom;
|
|
121
|
+
|
|
122
|
+
var rect = new _tableMap.Rect(recLeft, recTop, recRight, recBottom);
|
|
93
123
|
updatedCells = map.cellsInRect(rect).map(function (x) {
|
|
94
124
|
return x + table.start;
|
|
95
125
|
});
|
package/dist/cjs/version.json
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx } from '@emotion/react';
|
|
|
3
3
|
import { defineMessages } from 'react-intl-next';
|
|
4
4
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
5
5
|
import commonMessages from '@atlaskit/editor-common/messages';
|
|
6
|
-
import { clearHoverSelection, hoverTable, hoverColumns, hoverRows, removeDescendantNodes } from './commands';
|
|
6
|
+
import { clearHoverSelection, hoverTable, hoverColumns, hoverRows, removeDescendantNodes, hoverMergedCells } from './commands';
|
|
7
7
|
import { deleteTableWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, insertRowWithAnalytics, deleteRowsWithAnalytics, mergeCellsWithAnalytics, splitCellWithAnalytics, deleteColumnsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, wrapTableInExpandWithAnalytics, sortColumnWithAnalytics, setColorWithAnalytics, distributeColumnsWidthsWithAnalytics } from './commands-with-analytics';
|
|
8
8
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
9
9
|
import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
@@ -229,6 +229,18 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
229
229
|
options.push({
|
|
230
230
|
id: 'editor.table.sortColumnAsc',
|
|
231
231
|
title: formatMessage(ContextualMenuMessages.sortColumnASC),
|
|
232
|
+
onMouseOver: (state, dispatch) => {
|
|
233
|
+
if (getMergedCellsPositions(state.tr).length !== 0) {
|
|
234
|
+
hoverMergedCells()(state, dispatch);
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return false;
|
|
239
|
+
},
|
|
240
|
+
onMouseOut: (state, dispatch) => {
|
|
241
|
+
clearHoverSelection()(state, dispatch);
|
|
242
|
+
return true;
|
|
243
|
+
},
|
|
232
244
|
onClick: (state, dispatch) => {
|
|
233
245
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, SortOrder.ASC)(state, dispatch);
|
|
234
246
|
return true;
|
|
@@ -240,6 +252,18 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
240
252
|
options.push({
|
|
241
253
|
id: 'editor.table.sortColumnDesc',
|
|
242
254
|
title: formatMessage(ContextualMenuMessages.sortColumnDESC),
|
|
255
|
+
onMouseOver: (state, dispatch) => {
|
|
256
|
+
if (getMergedCellsPositions(state.tr).length !== 0) {
|
|
257
|
+
hoverMergedCells()(state, dispatch);
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return false;
|
|
262
|
+
},
|
|
263
|
+
onMouseOut: (state, dispatch) => {
|
|
264
|
+
clearHoverSelection()(state, dispatch);
|
|
265
|
+
return true;
|
|
266
|
+
},
|
|
243
267
|
onClick: (state, dispatch) => {
|
|
244
268
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, SortOrder.DESC)(state, dispatch);
|
|
245
269
|
return true;
|
|
@@ -69,7 +69,9 @@ export class FloatingContextualButtonInner extends React.Component {
|
|
|
69
69
|
selection: editorView.state.selection.toJSON(),
|
|
70
70
|
position: targetCellPosition,
|
|
71
71
|
docSize: editorView.state.doc.nodeSize,
|
|
72
|
-
error: error instanceof Error ? error.message : String(error)
|
|
72
|
+
error: error instanceof Error ? error.message : String(error)
|
|
73
|
+
},
|
|
74
|
+
nonPrivacySafeAttributes: {
|
|
73
75
|
errorStack: error instanceof Error ? error.stack : undefined
|
|
74
76
|
}
|
|
75
77
|
};
|
|
@@ -89,7 +89,9 @@ export class FloatingInsertButton extends React.Component {
|
|
|
89
89
|
selection: editorView.state.selection.toJSON(),
|
|
90
90
|
position: pos,
|
|
91
91
|
docSize: editorView.state.doc.nodeSize,
|
|
92
|
-
error: error === null || error === void 0 ? void 0 : error.toString()
|
|
92
|
+
error: error === null || error === void 0 ? void 0 : error.toString()
|
|
93
|
+
},
|
|
94
|
+
nonPrivacySafeAttributes: {
|
|
93
95
|
errorStack: error.stack || undefined
|
|
94
96
|
}
|
|
95
97
|
};
|
|
@@ -73,7 +73,8 @@ export default class NumberColumn extends Component {
|
|
|
73
73
|
className: ClassName.NUMBERED_COLUMN,
|
|
74
74
|
style: {
|
|
75
75
|
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined
|
|
76
|
-
}
|
|
76
|
+
},
|
|
77
|
+
contentEditable: false
|
|
77
78
|
}, rowHeights.map((rowHeight, index) => /*#__PURE__*/React.createElement("div", {
|
|
78
79
|
key: `wrapper-${index}`,
|
|
79
80
|
className: this.getClassNames(index),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
1
|
+
import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
2
2
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
3
3
|
import { Decoration } from 'prosemirror-view';
|
|
4
4
|
import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
@@ -43,7 +43,37 @@ export const createControlsHoverDecoration = (cells, type, tr, danger, selected)
|
|
|
43
43
|
// to match the "clicked" selection
|
|
44
44
|
|
|
45
45
|
if (danger) {
|
|
46
|
-
|
|
46
|
+
// Find the bounding rectangle of all the given cells, also considering
|
|
47
|
+
// merged cells.
|
|
48
|
+
const {
|
|
49
|
+
recLeft,
|
|
50
|
+
recTop,
|
|
51
|
+
recRight,
|
|
52
|
+
recBottom
|
|
53
|
+
} = cells.reduce((acc, cell) => {
|
|
54
|
+
const {
|
|
55
|
+
left,
|
|
56
|
+
right,
|
|
57
|
+
bottom,
|
|
58
|
+
top
|
|
59
|
+
} = map.findCell(cell.pos - table.start); // Finding the bounding rect requires finding the min left and top positions,
|
|
60
|
+
// and the max right and bottom positions of the cells
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
recLeft: Math.min(acc.recLeft, left),
|
|
64
|
+
recTop: Math.min(acc.recTop, top),
|
|
65
|
+
recRight: Math.max(acc.recRight, right),
|
|
66
|
+
recBottom: Math.max(acc.recBottom, bottom)
|
|
67
|
+
};
|
|
68
|
+
}, // +-Infinity as initialisation vars which will always be overwritten
|
|
69
|
+
// by smaller/larger values respectively
|
|
70
|
+
{
|
|
71
|
+
recLeft: Infinity,
|
|
72
|
+
recTop: Infinity,
|
|
73
|
+
recRight: -Infinity,
|
|
74
|
+
recBottom: -Infinity
|
|
75
|
+
});
|
|
76
|
+
const rect = new Rect(recLeft, recTop, recRight, recBottom);
|
|
47
77
|
updatedCells = map.cellsInRect(rect).map(x => x + table.start);
|
|
48
78
|
}
|
|
49
79
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx } from '@emotion/react';
|
|
|
5
5
|
import { defineMessages } from 'react-intl-next';
|
|
6
6
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
7
7
|
import commonMessages from '@atlaskit/editor-common/messages';
|
|
8
|
-
import { clearHoverSelection, hoverTable, hoverColumns, hoverRows, removeDescendantNodes } from './commands';
|
|
8
|
+
import { clearHoverSelection, hoverTable, hoverColumns, hoverRows, removeDescendantNodes, hoverMergedCells } from './commands';
|
|
9
9
|
import { deleteTableWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, insertRowWithAnalytics, deleteRowsWithAnalytics, mergeCellsWithAnalytics, splitCellWithAnalytics, deleteColumnsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, wrapTableInExpandWithAnalytics, sortColumnWithAnalytics, setColorWithAnalytics, distributeColumnsWidthsWithAnalytics } from './commands-with-analytics';
|
|
10
10
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
11
11
|
import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
@@ -229,6 +229,18 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
229
229
|
options.push({
|
|
230
230
|
id: 'editor.table.sortColumnAsc',
|
|
231
231
|
title: formatMessage(ContextualMenuMessages.sortColumnASC),
|
|
232
|
+
onMouseOver: function onMouseOver(state, dispatch) {
|
|
233
|
+
if (getMergedCellsPositions(state.tr).length !== 0) {
|
|
234
|
+
hoverMergedCells()(state, dispatch);
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return false;
|
|
239
|
+
},
|
|
240
|
+
onMouseOut: function onMouseOut(state, dispatch) {
|
|
241
|
+
clearHoverSelection()(state, dispatch);
|
|
242
|
+
return true;
|
|
243
|
+
},
|
|
232
244
|
onClick: function onClick(state, dispatch) {
|
|
233
245
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, SortOrder.ASC)(state, dispatch);
|
|
234
246
|
return true;
|
|
@@ -240,6 +252,18 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
240
252
|
options.push({
|
|
241
253
|
id: 'editor.table.sortColumnDesc',
|
|
242
254
|
title: formatMessage(ContextualMenuMessages.sortColumnDESC),
|
|
255
|
+
onMouseOver: function onMouseOver(state, dispatch) {
|
|
256
|
+
if (getMergedCellsPositions(state.tr).length !== 0) {
|
|
257
|
+
hoverMergedCells()(state, dispatch);
|
|
258
|
+
return true;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return false;
|
|
262
|
+
},
|
|
263
|
+
onMouseOut: function onMouseOut(state, dispatch) {
|
|
264
|
+
clearHoverSelection()(state, dispatch);
|
|
265
|
+
return true;
|
|
266
|
+
},
|
|
243
267
|
onClick: function onClick(state, dispatch) {
|
|
244
268
|
sortColumnWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.FLOATING_TB, initialSelectionRect.left, SortOrder.DESC)(state, dispatch);
|
|
245
269
|
return true;
|
|
@@ -91,7 +91,9 @@ export var FloatingContextualButtonInner = /*#__PURE__*/function (_React$Compone
|
|
|
91
91
|
selection: editorView.state.selection.toJSON(),
|
|
92
92
|
position: targetCellPosition,
|
|
93
93
|
docSize: editorView.state.doc.nodeSize,
|
|
94
|
-
error: error instanceof Error ? error.message : String(error)
|
|
94
|
+
error: error instanceof Error ? error.message : String(error)
|
|
95
|
+
},
|
|
96
|
+
nonPrivacySafeAttributes: {
|
|
95
97
|
errorStack: error instanceof Error ? error.stack : undefined
|
|
96
98
|
}
|
|
97
99
|
};
|
|
@@ -106,7 +106,9 @@ export var FloatingInsertButton = /*#__PURE__*/function (_React$Component) {
|
|
|
106
106
|
selection: editorView.state.selection.toJSON(),
|
|
107
107
|
position: pos,
|
|
108
108
|
docSize: editorView.state.doc.nodeSize,
|
|
109
|
-
error: error === null || error === void 0 ? void 0 : error.toString()
|
|
109
|
+
error: error === null || error === void 0 ? void 0 : error.toString()
|
|
110
|
+
},
|
|
111
|
+
nonPrivacySafeAttributes: {
|
|
110
112
|
errorStack: error.stack || undefined
|
|
111
113
|
}
|
|
112
114
|
};
|
|
@@ -98,7 +98,8 @@ var NumberColumn = /*#__PURE__*/function (_Component) {
|
|
|
98
98
|
className: ClassName.NUMBERED_COLUMN,
|
|
99
99
|
style: {
|
|
100
100
|
marginTop: hasHeaderRow && this.props.stickyTop !== undefined ? rowHeights[0] : undefined
|
|
101
|
-
}
|
|
101
|
+
},
|
|
102
|
+
contentEditable: false
|
|
102
103
|
}, rowHeights.map(function (rowHeight, index) {
|
|
103
104
|
return /*#__PURE__*/React.createElement("div", {
|
|
104
105
|
key: "wrapper-".concat(index),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
2
|
+
import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
3
3
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
4
4
|
import { Decoration } from 'prosemirror-view';
|
|
5
5
|
import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
@@ -66,7 +66,37 @@ export var createControlsHoverDecoration = function createControlsHoverDecoratio
|
|
|
66
66
|
// to match the "clicked" selection
|
|
67
67
|
|
|
68
68
|
if (danger) {
|
|
69
|
-
|
|
69
|
+
// Find the bounding rectangle of all the given cells, also considering
|
|
70
|
+
// merged cells.
|
|
71
|
+
var _cells$reduce3 = cells.reduce(function (acc, cell) {
|
|
72
|
+
var _map$findCell = map.findCell(cell.pos - table.start),
|
|
73
|
+
left = _map$findCell.left,
|
|
74
|
+
right = _map$findCell.right,
|
|
75
|
+
bottom = _map$findCell.bottom,
|
|
76
|
+
top = _map$findCell.top; // Finding the bounding rect requires finding the min left and top positions,
|
|
77
|
+
// and the max right and bottom positions of the cells
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
recLeft: Math.min(acc.recLeft, left),
|
|
82
|
+
recTop: Math.min(acc.recTop, top),
|
|
83
|
+
recRight: Math.max(acc.recRight, right),
|
|
84
|
+
recBottom: Math.max(acc.recBottom, bottom)
|
|
85
|
+
};
|
|
86
|
+
}, // +-Infinity as initialisation vars which will always be overwritten
|
|
87
|
+
// by smaller/larger values respectively
|
|
88
|
+
{
|
|
89
|
+
recLeft: Infinity,
|
|
90
|
+
recTop: Infinity,
|
|
91
|
+
recRight: -Infinity,
|
|
92
|
+
recBottom: -Infinity
|
|
93
|
+
}),
|
|
94
|
+
recLeft = _cells$reduce3.recLeft,
|
|
95
|
+
recTop = _cells$reduce3.recTop,
|
|
96
|
+
recRight = _cells$reduce3.recRight,
|
|
97
|
+
recBottom = _cells$reduce3.recBottom;
|
|
98
|
+
|
|
99
|
+
var rect = new Rect(recLeft, recTop, recRight, recBottom);
|
|
70
100
|
updatedCells = map.cellsInRect(rect).map(function (x) {
|
|
71
101
|
return x + table.start;
|
|
72
102
|
});
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"releaseModel": "scheduled"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@atlaskit/adf-schema": "^25.
|
|
22
|
-
"@atlaskit/editor-common": "^72.
|
|
21
|
+
"@atlaskit/adf-schema": "^25.1.0",
|
|
22
|
+
"@atlaskit/editor-common": "^72.2.0",
|
|
23
23
|
"@atlaskit/editor-shared-styles": "^2.3.0",
|
|
24
24
|
"@atlaskit/editor-tables": "^2.2.0",
|
|
25
25
|
"@atlaskit/icon": "^21.11.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@atlaskit/analytics-next": "^8.3.3",
|
|
53
53
|
"@atlaskit/button": "^16.5.0",
|
|
54
|
-
"@atlaskit/editor-core": "^
|
|
54
|
+
"@atlaskit/editor-core": "^178.1.0",
|
|
55
55
|
"@atlaskit/editor-test-helpers": "^18.0.0",
|
|
56
56
|
"@atlaskit/link-provider": "^1.3.0",
|
|
57
57
|
"@atlaskit/logo": "^13.10.0",
|
package/report.api.md
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
### Table of contents
|
|
9
9
|
|
|
10
10
|
- [Main Entry Types](#main-entry-types)
|
|
11
|
+
- [Peer Dependencies](#peer-dependencies)
|
|
11
12
|
|
|
12
13
|
### Main Entry Types
|
|
13
14
|
|
|
@@ -102,3 +103,17 @@ export const tablesPlugin: NextEditorPlugin<
|
|
|
102
103
|
```
|
|
103
104
|
|
|
104
105
|
<!--SECTION END: Main Entry Types-->
|
|
106
|
+
|
|
107
|
+
### Peer Dependencies
|
|
108
|
+
|
|
109
|
+
<!--SECTION START: Peer Dependencies-->
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"react": "^16.8.0",
|
|
114
|
+
"react-dom": "^16.8.0",
|
|
115
|
+
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
<!--SECTION END: Peer Dependencies-->
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
version: 1,
|
|
3
|
+
type: 'doc',
|
|
4
|
+
content: [
|
|
5
|
+
{
|
|
6
|
+
type: 'table',
|
|
7
|
+
attrs: {
|
|
8
|
+
isNumberColumnEnabled: false,
|
|
9
|
+
layout: 'default',
|
|
10
|
+
},
|
|
11
|
+
content: [
|
|
12
|
+
{
|
|
13
|
+
type: 'tableRow',
|
|
14
|
+
content: [
|
|
15
|
+
{
|
|
16
|
+
type: 'tableHeader',
|
|
17
|
+
attrs: {},
|
|
18
|
+
content: [
|
|
19
|
+
{
|
|
20
|
+
type: 'paragraph',
|
|
21
|
+
content: [],
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'tableHeader',
|
|
27
|
+
attrs: {},
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: 'paragraph',
|
|
31
|
+
content: [],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
type: 'tableHeader',
|
|
37
|
+
attrs: {},
|
|
38
|
+
content: [
|
|
39
|
+
{
|
|
40
|
+
type: 'paragraph',
|
|
41
|
+
content: [],
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'tableRow',
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: 'tableCell',
|
|
52
|
+
attrs: {},
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'paragraph',
|
|
56
|
+
content: [],
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
type: 'tableCell',
|
|
62
|
+
attrs: {},
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: 'paragraph',
|
|
66
|
+
content: [],
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
type: 'tableCell',
|
|
72
|
+
attrs: {},
|
|
73
|
+
content: [
|
|
74
|
+
{
|
|
75
|
+
type: 'paragraph',
|
|
76
|
+
content: [],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
type: 'tableRow',
|
|
84
|
+
content: [
|
|
85
|
+
{
|
|
86
|
+
type: 'tableCell',
|
|
87
|
+
attrs: {},
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: 'paragraph',
|
|
91
|
+
content: [],
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
type: 'tableCell',
|
|
97
|
+
attrs: {
|
|
98
|
+
colspan: 2,
|
|
99
|
+
},
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: 'paragraph',
|
|
103
|
+
content: [],
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
};
|