@atlaskit/editor-plugin-table 7.0.2 → 7.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 +22 -0
- package/dist/cjs/nodeviews/TableComponent.js +22 -12
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +1 -1
- package/dist/cjs/pm-plugins/keymap.js +1 -1
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
- package/dist/cjs/ui/icons/AddRowAboveIcon.js +8 -12
- package/dist/cjs/ui/icons/AddRowBelowIcon.js +19 -15
- package/dist/es2019/nodeviews/TableComponent.js +10 -1
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +1 -1
- package/dist/es2019/pm-plugins/keymap.js +2 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
- package/dist/es2019/ui/icons/AddRowAboveIcon.js +8 -12
- package/dist/es2019/ui/icons/AddRowBelowIcon.js +19 -15
- package/dist/esm/nodeviews/TableComponent.js +22 -12
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +1 -1
- package/dist/esm/pm-plugins/keymap.js +2 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +1 -1
- package/dist/esm/ui/icons/AddRowAboveIcon.js +8 -12
- package/dist/esm/ui/icons/AddRowBelowIcon.js +19 -15
- package/dist/types/index.d.ts +1 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/package.json +5 -5
- package/src/index.ts +1 -1
- package/src/nodeviews/TableComponent.tsx +18 -5
- package/src/pm-plugins/drag-and-drop/commands.ts +1 -1
- package/src/pm-plugins/keymap.ts +2 -7
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +1 -0
- package/src/ui/icons/AddRowAboveIcon.tsx +2 -16
- package/src/ui/icons/AddRowBelowIcon.tsx +21 -12
- package/tsconfig.json +596 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#69232](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69232) [`93c8f231aa82`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/93c8f231aa82) - Optimized the table move column logic to perform individual insert/deletes per row
|
|
8
|
+
- [#68790](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68790) [`c6d8affc52d1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c6d8affc52d1) - Support maybeAdd plugins in usePreset. Add typing support for universal preset.
|
|
9
|
+
|
|
10
|
+
Now when using the editor API with the universal preset
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#68693](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68693) [`f664d35cc135`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f664d35cc135) - Fix incorrect drag handle position after deleting row in table
|
|
15
|
+
- [#68011](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68011) [`f19b64a46694`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f19b64a46694) - Remove check for header for column insert keyboard shortcut
|
|
16
|
+
- [#68926](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68926) [`fceb32f94798`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fceb32f94798) - [ux] update drag menu's insert row's icons
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## 7.0.3
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#68585](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68585) [`453395005d42`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/453395005d42) - [ux] Fixed a bug where a table nested in expand has showdows after clicking breakout button.
|
|
24
|
+
|
|
3
25
|
## 7.0.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -394,7 +394,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
394
394
|
}, {
|
|
395
395
|
key: "componentDidUpdate",
|
|
396
396
|
value: function componentDidUpdate(_, prevState) {
|
|
397
|
-
var _this$wrapper
|
|
397
|
+
var _this$wrapper,
|
|
398
|
+
_this2 = this;
|
|
398
399
|
var _this$props9 = this.props,
|
|
399
400
|
view = _this$props9.view,
|
|
400
401
|
getNode = _this$props9.getNode,
|
|
@@ -409,7 +410,16 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
409
410
|
(0, _commands.clearHoverSelection)()(view.state, view.dispatch);
|
|
410
411
|
}
|
|
411
412
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
412
|
-
|
|
413
|
+
if (this.props.isDragAndDropEnabled) {
|
|
414
|
+
// requestAnimationFrame is used here to fix a race condition issue
|
|
415
|
+
// that happens when a table is nested in expand and expand's width is
|
|
416
|
+
// changed via breakout button
|
|
417
|
+
window.requestAnimationFrame(function () {
|
|
418
|
+
_this2.overflowShadowsObserver = new _OverflowShadowsObserver.OverflowShadowsObserver(_this2.updateShadowState, _this2.table, _this2.wrapper);
|
|
419
|
+
});
|
|
420
|
+
} else {
|
|
421
|
+
this.overflowShadowsObserver = new _OverflowShadowsObserver.OverflowShadowsObserver(this.updateShadowState, this.table, this.wrapper);
|
|
422
|
+
}
|
|
413
423
|
}
|
|
414
424
|
if (this.overflowShadowsObserver) {
|
|
415
425
|
var _this$state$stickyHea;
|
|
@@ -462,7 +472,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
462
472
|
key: "render",
|
|
463
473
|
value: function render() {
|
|
464
474
|
var _classnames,
|
|
465
|
-
|
|
475
|
+
_this3 = this;
|
|
466
476
|
var _this$props10 = this.props,
|
|
467
477
|
view = _this$props10.view,
|
|
468
478
|
getNode = _this$props10.getNode,
|
|
@@ -585,12 +595,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
585
595
|
editorView: view,
|
|
586
596
|
node: node,
|
|
587
597
|
getScrollOffset: function getScrollOffset() {
|
|
588
|
-
var
|
|
589
|
-
return ((
|
|
598
|
+
var _this3$wrapper;
|
|
599
|
+
return ((_this3$wrapper = _this3.wrapper) === null || _this3$wrapper === void 0 ? void 0 : _this3$wrapper.scrollLeft) || 0;
|
|
590
600
|
},
|
|
591
601
|
getTableWrapperWidth: function getTableWrapperWidth() {
|
|
592
|
-
var
|
|
593
|
-
return ((
|
|
602
|
+
var _this3$wrapper2;
|
|
603
|
+
return ((_this3$wrapper2 = _this3.wrapper) === null || _this3$wrapper2 === void 0 ? void 0 : _this3$wrapper2.clientWidth) || 760;
|
|
594
604
|
}
|
|
595
605
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
596
606
|
style: shadowStyle(showBeforeShadow),
|
|
@@ -605,13 +615,13 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
605
615
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
606
616
|
className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_NODE_WRAPPER),
|
|
607
617
|
ref: function ref(elem) {
|
|
608
|
-
|
|
618
|
+
_this3.wrapper = elem;
|
|
609
619
|
if (elem) {
|
|
610
|
-
|
|
620
|
+
_this3.props.contentDOM(elem);
|
|
611
621
|
var tableElement = elem.querySelector('table');
|
|
612
|
-
if (tableElement !==
|
|
613
|
-
|
|
614
|
-
|
|
622
|
+
if (tableElement !== _this3.table) {
|
|
623
|
+
_this3.table = tableElement;
|
|
624
|
+
_this3.createShadowSentinels(_this3.table);
|
|
615
625
|
}
|
|
616
626
|
}
|
|
617
627
|
}
|
|
@@ -87,7 +87,7 @@ var moveSource = exports.moveSource = function moveSource(sourceType, sourceInde
|
|
|
87
87
|
if (isTableRow) {
|
|
88
88
|
return (0, _transforms.combineTransforms)([(0, _utils.moveRow)(state, sourceIndexes, targetIndex), selectStartOfTable, (0, _utils.selectRow)(targetIndex)], nextTr);
|
|
89
89
|
}
|
|
90
|
-
return (0, _transforms.combineTransforms)([(0, _utils.moveColumn)(sourceIndexes, targetIndex), selectStartOfTable, (0, _utils.selectColumn)(targetIndex)], nextTr);
|
|
90
|
+
return (0, _transforms.combineTransforms)([(0, _utils.moveColumn)(state, sourceIndexes, targetIndex), selectStartOfTable, (0, _utils.selectColumn)(targetIndex)], nextTr);
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
93
|
var toggleDragMenu = exports.toggleDragMenu = function toggleDragMenu(isDragMenuOpen, direction, index) {
|
|
@@ -38,7 +38,7 @@ function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAndDropEn
|
|
|
38
38
|
// Add row/column shortcuts
|
|
39
39
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addRowBefore.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('TOP'), list);
|
|
40
40
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addRowAfter.common, (0, _commandsWithAnalytics.addRowAroundSelection)(editorAnalyticsAPI)('BOTTOM'), list);
|
|
41
|
-
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addColumnBefore.common, (0,
|
|
41
|
+
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addColumnBefore.common, (0, _insert.addColumnBefore)(getEditorContainerWidth), list);
|
|
42
42
|
(0, _keymaps.bindKeymapWithCommand)(_keymaps.addColumnAfter.common, (0, _insert.addColumnAfter)(getEditorContainerWidth), list);
|
|
43
43
|
if (dragAndDropEnabled) {
|
|
44
44
|
// Move row/column shortcuts
|
|
@@ -128,7 +128,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
128
128
|
}
|
|
129
129
|
var isHover = type === 'hover';
|
|
130
130
|
var isRowsSelected = selectedRowIndexes.length > 0;
|
|
131
|
-
var showCondition = isHover ? isRowsSelected && !selectedRowIndexes.includes(rowIndex) && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex) : selectedRowIndexes.length < rowHeights.length && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex);
|
|
131
|
+
var showCondition = isHover ? isRowsSelected && !selectedRowIndexes.includes(rowIndex) && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex) : selectedRowIndexes.length < rowHeights.length && rowIndex < rowHeights.length && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex);
|
|
132
132
|
if (!showCondition) {
|
|
133
133
|
return null;
|
|
134
134
|
}
|
|
@@ -18,24 +18,20 @@ var AddRowAboveIcon = exports.AddRowAboveIcon = function AddRowAboveIcon() {
|
|
|
18
18
|
height: "24",
|
|
19
19
|
fill: "var(--ds-border-inverse, #FFFFFF)",
|
|
20
20
|
fillOpacity: "0.01"
|
|
21
|
-
}), /*#__PURE__*/_react.default.createElement("
|
|
22
|
-
id: "path-1-inside-1_896_17822",
|
|
23
|
-
fill: "var(--ds-border-inverse, #FFFFFF)"
|
|
24
|
-
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
21
|
+
}), /*#__PURE__*/_react.default.createElement("rect", {
|
|
25
22
|
x: "6",
|
|
26
23
|
y: "12",
|
|
27
24
|
width: "12",
|
|
28
|
-
height: "
|
|
29
|
-
rx: "0.5"
|
|
30
|
-
|
|
25
|
+
height: "3",
|
|
26
|
+
rx: "0.5",
|
|
27
|
+
fill: "currentColor"
|
|
28
|
+
}), /*#__PURE__*/_react.default.createElement("rect", {
|
|
31
29
|
x: "6",
|
|
32
|
-
y: "
|
|
30
|
+
y: "16",
|
|
33
31
|
width: "12",
|
|
34
|
-
height: "
|
|
32
|
+
height: "3",
|
|
35
33
|
rx: "0.5",
|
|
36
|
-
|
|
37
|
-
strokeWidth: "4",
|
|
38
|
-
mask: "url(#path-1-inside-1_896_17822)"
|
|
34
|
+
fill: "currentColor"
|
|
39
35
|
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
40
36
|
fillRule: "evenodd",
|
|
41
37
|
clipRule: "evenodd",
|
|
@@ -13,28 +13,32 @@ var AddRowBelowIcon = exports.AddRowBelowIcon = function AddRowBelowIcon() {
|
|
|
13
13
|
viewBox: "0 0 24 24",
|
|
14
14
|
fill: "none",
|
|
15
15
|
xmlns: "http://www.w3.org/2000/svg"
|
|
16
|
-
}, /*#__PURE__*/_react.default.createElement("mask", {
|
|
17
|
-
id: "path-1-inside-1_920_47112",
|
|
18
|
-
fill: "var(--ds-border-inverse, #FFFFFF)"
|
|
19
16
|
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
width: "24",
|
|
18
|
+
height: "24",
|
|
19
|
+
transform: "matrix(-1 0 0 -1 24 24)",
|
|
20
|
+
fill: "var(--ds-border-inverse, #FFFFFF)",
|
|
21
|
+
fillOpacity: "0.01"
|
|
22
|
+
}), /*#__PURE__*/_react.default.createElement("rect", {
|
|
23
|
+
x: "18",
|
|
24
|
+
y: "12",
|
|
22
25
|
width: "12",
|
|
23
|
-
height: "
|
|
24
|
-
rx: "0.5"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
height: "3",
|
|
27
|
+
rx: "0.5",
|
|
28
|
+
transform: "rotate(-180 18 12)",
|
|
29
|
+
fill: "currentColor"
|
|
30
|
+
}), /*#__PURE__*/_react.default.createElement("rect", {
|
|
31
|
+
x: "18",
|
|
32
|
+
y: "8",
|
|
28
33
|
width: "12",
|
|
29
|
-
height: "
|
|
34
|
+
height: "3",
|
|
30
35
|
rx: "0.5",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
mask: "url(#path-1-inside-1_920_47112)"
|
|
36
|
+
transform: "rotate(-180 18 8)",
|
|
37
|
+
fill: "currentColor"
|
|
34
38
|
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
35
39
|
fillRule: "evenodd",
|
|
36
40
|
clipRule: "evenodd",
|
|
37
|
-
d: "
|
|
41
|
+
d: "M11 17V18.01C11.0026 18.2735 11.1092 18.5253 11.2964 18.7107C11.4837 18.896 11.7365 19 12 19C12.556 19 13 18.556 13 18.01V17H14C14.2652 17 14.5196 16.8946 14.7071 16.7071C14.8946 16.5196 15 16.2652 15 16C15 15.7348 14.8946 15.4804 14.7071 15.2929C14.5196 15.1054 14.2652 15 14 15H13V13.99C12.9974 13.7265 12.8908 13.4747 12.7036 13.2893C12.5163 13.104 12.2635 13 12 13C11.444 13 11 13.444 11 13.99V15H10C9.73478 15 9.48043 15.1054 9.29289 15.2929C9.10536 15.4804 9 15.7348 9 16C9 16.2652 9.10536 16.5196 9.29289 16.7071C9.48043 16.8946 9.73478 17 10 17H11Z",
|
|
38
42
|
fill: "currentColor"
|
|
39
43
|
}));
|
|
40
44
|
};
|
|
@@ -406,7 +406,16 @@ class TableComponent extends React.Component {
|
|
|
406
406
|
clearHoverSelection()(view.state, view.dispatch);
|
|
407
407
|
}
|
|
408
408
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
409
|
-
|
|
409
|
+
if (this.props.isDragAndDropEnabled) {
|
|
410
|
+
// requestAnimationFrame is used here to fix a race condition issue
|
|
411
|
+
// that happens when a table is nested in expand and expand's width is
|
|
412
|
+
// changed via breakout button
|
|
413
|
+
window.requestAnimationFrame(() => {
|
|
414
|
+
this.overflowShadowsObserver = new OverflowShadowsObserver(this.updateShadowState, this.table, this.wrapper);
|
|
415
|
+
});
|
|
416
|
+
} else {
|
|
417
|
+
this.overflowShadowsObserver = new OverflowShadowsObserver(this.updateShadowState, this.table, this.wrapper);
|
|
418
|
+
}
|
|
410
419
|
}
|
|
411
420
|
if (this.overflowShadowsObserver) {
|
|
412
421
|
var _this$state$stickyHea;
|
|
@@ -71,7 +71,7 @@ export const moveSource = (sourceType, sourceIndexes, targetIndex, tr) => create
|
|
|
71
71
|
if (isTableRow) {
|
|
72
72
|
return combineTransforms([moveRow(state, sourceIndexes, targetIndex), selectStartOfTable, selectRow(targetIndex)], nextTr);
|
|
73
73
|
}
|
|
74
|
-
return combineTransforms([moveColumn(sourceIndexes, targetIndex), selectStartOfTable, selectColumn(targetIndex)], nextTr);
|
|
74
|
+
return combineTransforms([moveColumn(state, sourceIndexes, targetIndex), selectStartOfTable, selectColumn(targetIndex)], nextTr);
|
|
75
75
|
});
|
|
76
76
|
export const toggleDragMenu = (isDragMenuOpen, direction, index) => createCommand(state => {
|
|
77
77
|
let {
|
|
@@ -3,7 +3,7 @@ import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace,
|
|
|
3
3
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { createTable, goToNextCell, moveCursorBackward
|
|
6
|
+
import { createTable, goToNextCell, moveCursorBackward } from '../commands';
|
|
7
7
|
import { addRowAroundSelection, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
8
|
import { activateNextResizeArea, changeColumnWidthByStep, initiateKeyboardColumnResizing } from '../commands/column-resize';
|
|
9
9
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
|
|
@@ -29,7 +29,7 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
29
29
|
// Add row/column shortcuts
|
|
30
30
|
bindKeymapWithCommand(addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
31
31
|
bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
32
|
-
bindKeymapWithCommand(addColumnBefore.common,
|
|
32
|
+
bindKeymapWithCommand(addColumnBefore.common, addColumnBeforeCommand(getEditorContainerWidth), list);
|
|
33
33
|
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
|
|
34
34
|
if (dragAndDropEnabled) {
|
|
35
35
|
// Move row/column shortcuts
|
|
@@ -118,7 +118,7 @@ const DragControlsComponent = ({
|
|
|
118
118
|
}
|
|
119
119
|
const isHover = type === 'hover';
|
|
120
120
|
const isRowsSelected = selectedRowIndexes.length > 0;
|
|
121
|
-
const showCondition = isHover ? isRowsSelected && !selectedRowIndexes.includes(rowIndex) && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex) : selectedRowIndexes.length < rowHeights.length && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex);
|
|
121
|
+
const showCondition = isHover ? isRowsSelected && !selectedRowIndexes.includes(rowIndex) && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex) : selectedRowIndexes.length < rowHeights.length && rowIndex < rowHeights.length && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex);
|
|
122
122
|
if (!showCondition) {
|
|
123
123
|
return null;
|
|
124
124
|
}
|
|
@@ -10,24 +10,20 @@ export const AddRowAboveIcon = () => /*#__PURE__*/React.createElement("svg", {
|
|
|
10
10
|
height: "24",
|
|
11
11
|
fill: "var(--ds-border-inverse, #FFFFFF)",
|
|
12
12
|
fillOpacity: "0.01"
|
|
13
|
-
}), /*#__PURE__*/React.createElement("
|
|
14
|
-
id: "path-1-inside-1_896_17822",
|
|
15
|
-
fill: "var(--ds-border-inverse, #FFFFFF)"
|
|
16
|
-
}, /*#__PURE__*/React.createElement("rect", {
|
|
13
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
17
14
|
x: "6",
|
|
18
15
|
y: "12",
|
|
19
16
|
width: "12",
|
|
20
|
-
height: "
|
|
21
|
-
rx: "0.5"
|
|
22
|
-
|
|
17
|
+
height: "3",
|
|
18
|
+
rx: "0.5",
|
|
19
|
+
fill: "currentColor"
|
|
20
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
23
21
|
x: "6",
|
|
24
|
-
y: "
|
|
22
|
+
y: "16",
|
|
25
23
|
width: "12",
|
|
26
|
-
height: "
|
|
24
|
+
height: "3",
|
|
27
25
|
rx: "0.5",
|
|
28
|
-
|
|
29
|
-
strokeWidth: "4",
|
|
30
|
-
mask: "url(#path-1-inside-1_896_17822)"
|
|
26
|
+
fill: "currentColor"
|
|
31
27
|
}), /*#__PURE__*/React.createElement("path", {
|
|
32
28
|
fillRule: "evenodd",
|
|
33
29
|
clipRule: "evenodd",
|
|
@@ -5,27 +5,31 @@ export const AddRowBelowIcon = () => /*#__PURE__*/React.createElement("svg", {
|
|
|
5
5
|
viewBox: "0 0 24 24",
|
|
6
6
|
fill: "none",
|
|
7
7
|
xmlns: "http://www.w3.org/2000/svg"
|
|
8
|
-
}, /*#__PURE__*/React.createElement("mask", {
|
|
9
|
-
id: "path-1-inside-1_920_47112",
|
|
10
|
-
fill: "var(--ds-border-inverse, #FFFFFF)"
|
|
11
8
|
}, /*#__PURE__*/React.createElement("rect", {
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
width: "24",
|
|
10
|
+
height: "24",
|
|
11
|
+
transform: "matrix(-1 0 0 -1 24 24)",
|
|
12
|
+
fill: "var(--ds-border-inverse, #FFFFFF)",
|
|
13
|
+
fillOpacity: "0.01"
|
|
14
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
15
|
+
x: "18",
|
|
16
|
+
y: "12",
|
|
14
17
|
width: "12",
|
|
15
|
-
height: "
|
|
16
|
-
rx: "0.5"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
height: "3",
|
|
19
|
+
rx: "0.5",
|
|
20
|
+
transform: "rotate(-180 18 12)",
|
|
21
|
+
fill: "currentColor"
|
|
22
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
23
|
+
x: "18",
|
|
24
|
+
y: "8",
|
|
20
25
|
width: "12",
|
|
21
|
-
height: "
|
|
26
|
+
height: "3",
|
|
22
27
|
rx: "0.5",
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
mask: "url(#path-1-inside-1_920_47112)"
|
|
28
|
+
transform: "rotate(-180 18 8)",
|
|
29
|
+
fill: "currentColor"
|
|
26
30
|
}), /*#__PURE__*/React.createElement("path", {
|
|
27
31
|
fillRule: "evenodd",
|
|
28
32
|
clipRule: "evenodd",
|
|
29
|
-
d: "
|
|
33
|
+
d: "M11 17V18.01C11.0026 18.2735 11.1092 18.5253 11.2964 18.7107C11.4837 18.896 11.7365 19 12 19C12.556 19 13 18.556 13 18.01V17H14C14.2652 17 14.5196 16.8946 14.7071 16.7071C14.8946 16.5196 15 16.2652 15 16C15 15.7348 14.8946 15.4804 14.7071 15.2929C14.5196 15.1054 14.2652 15 14 15H13V13.99C12.9974 13.7265 12.8908 13.4747 12.7036 13.2893C12.5163 13.104 12.2635 13 12 13C11.444 13 11 13.444 11 13.99V15H10C9.73478 15 9.48043 15.1054 9.29289 15.2929C9.10536 15.4804 9 15.7348 9 16C9 16.2652 9.10536 16.5196 9.29289 16.7071C9.48043 16.8946 9.73478 17 10 17H11Z",
|
|
30
34
|
fill: "currentColor"
|
|
31
35
|
}));
|
|
@@ -387,7 +387,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
387
387
|
}, {
|
|
388
388
|
key: "componentDidUpdate",
|
|
389
389
|
value: function componentDidUpdate(_, prevState) {
|
|
390
|
-
var _this$wrapper
|
|
390
|
+
var _this$wrapper,
|
|
391
|
+
_this2 = this;
|
|
391
392
|
var _this$props9 = this.props,
|
|
392
393
|
view = _this$props9.view,
|
|
393
394
|
getNode = _this$props9.getNode,
|
|
@@ -402,7 +403,16 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
402
403
|
clearHoverSelection()(view.state, view.dispatch);
|
|
403
404
|
}
|
|
404
405
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
405
|
-
|
|
406
|
+
if (this.props.isDragAndDropEnabled) {
|
|
407
|
+
// requestAnimationFrame is used here to fix a race condition issue
|
|
408
|
+
// that happens when a table is nested in expand and expand's width is
|
|
409
|
+
// changed via breakout button
|
|
410
|
+
window.requestAnimationFrame(function () {
|
|
411
|
+
_this2.overflowShadowsObserver = new OverflowShadowsObserver(_this2.updateShadowState, _this2.table, _this2.wrapper);
|
|
412
|
+
});
|
|
413
|
+
} else {
|
|
414
|
+
this.overflowShadowsObserver = new OverflowShadowsObserver(this.updateShadowState, this.table, this.wrapper);
|
|
415
|
+
}
|
|
406
416
|
}
|
|
407
417
|
if (this.overflowShadowsObserver) {
|
|
408
418
|
var _this$state$stickyHea;
|
|
@@ -455,7 +465,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
455
465
|
key: "render",
|
|
456
466
|
value: function render() {
|
|
457
467
|
var _classnames,
|
|
458
|
-
|
|
468
|
+
_this3 = this;
|
|
459
469
|
var _this$props10 = this.props,
|
|
460
470
|
view = _this$props10.view,
|
|
461
471
|
getNode = _this$props10.getNode,
|
|
@@ -578,12 +588,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
578
588
|
editorView: view,
|
|
579
589
|
node: node,
|
|
580
590
|
getScrollOffset: function getScrollOffset() {
|
|
581
|
-
var
|
|
582
|
-
return ((
|
|
591
|
+
var _this3$wrapper;
|
|
592
|
+
return ((_this3$wrapper = _this3.wrapper) === null || _this3$wrapper === void 0 ? void 0 : _this3$wrapper.scrollLeft) || 0;
|
|
583
593
|
},
|
|
584
594
|
getTableWrapperWidth: function getTableWrapperWidth() {
|
|
585
|
-
var
|
|
586
|
-
return ((
|
|
595
|
+
var _this3$wrapper2;
|
|
596
|
+
return ((_this3$wrapper2 = _this3.wrapper) === null || _this3$wrapper2 === void 0 ? void 0 : _this3$wrapper2.clientWidth) || 760;
|
|
587
597
|
}
|
|
588
598
|
}), /*#__PURE__*/React.createElement("div", {
|
|
589
599
|
style: shadowStyle(showBeforeShadow),
|
|
@@ -598,13 +608,13 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
598
608
|
}), /*#__PURE__*/React.createElement("div", {
|
|
599
609
|
className: classnames(ClassName.TABLE_NODE_WRAPPER),
|
|
600
610
|
ref: function ref(elem) {
|
|
601
|
-
|
|
611
|
+
_this3.wrapper = elem;
|
|
602
612
|
if (elem) {
|
|
603
|
-
|
|
613
|
+
_this3.props.contentDOM(elem);
|
|
604
614
|
var tableElement = elem.querySelector('table');
|
|
605
|
-
if (tableElement !==
|
|
606
|
-
|
|
607
|
-
|
|
615
|
+
if (tableElement !== _this3.table) {
|
|
616
|
+
_this3.table = tableElement;
|
|
617
|
+
_this3.createShadowSentinels(_this3.table);
|
|
608
618
|
}
|
|
609
619
|
}
|
|
610
620
|
}
|
|
@@ -82,7 +82,7 @@ export var moveSource = function moveSource(sourceType, sourceIndexes, targetInd
|
|
|
82
82
|
if (isTableRow) {
|
|
83
83
|
return combineTransforms([moveRow(state, sourceIndexes, targetIndex), selectStartOfTable, selectRow(targetIndex)], nextTr);
|
|
84
84
|
}
|
|
85
|
-
return combineTransforms([moveColumn(sourceIndexes, targetIndex), selectStartOfTable, selectColumn(targetIndex)], nextTr);
|
|
85
|
+
return combineTransforms([moveColumn(state, sourceIndexes, targetIndex), selectStartOfTable, selectColumn(targetIndex)], nextTr);
|
|
86
86
|
});
|
|
87
87
|
};
|
|
88
88
|
export var toggleDragMenu = function toggleDragMenu(isDragMenuOpen, direction, index) {
|
|
@@ -3,7 +3,7 @@ import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace,
|
|
|
3
3
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
4
4
|
import { keymap } from '@atlaskit/editor-prosemirror/keymap';
|
|
5
5
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
6
|
-
import { createTable, goToNextCell, moveCursorBackward
|
|
6
|
+
import { createTable, goToNextCell, moveCursorBackward } from '../commands';
|
|
7
7
|
import { addRowAroundSelection, deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
|
|
8
8
|
import { activateNextResizeArea, changeColumnWidthByStep, initiateKeyboardColumnResizing } from '../commands/column-resize';
|
|
9
9
|
import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
|
|
@@ -31,7 +31,7 @@ export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI, dragAn
|
|
|
31
31
|
// Add row/column shortcuts
|
|
32
32
|
bindKeymapWithCommand(addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
|
|
33
33
|
bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
|
|
34
|
-
bindKeymapWithCommand(addColumnBefore.common,
|
|
34
|
+
bindKeymapWithCommand(addColumnBefore.common, addColumnBeforeCommand(getEditorContainerWidth), list);
|
|
35
35
|
bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
|
|
36
36
|
if (dragAndDropEnabled) {
|
|
37
37
|
// Move row/column shortcuts
|
|
@@ -118,7 +118,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
118
118
|
}
|
|
119
119
|
var isHover = type === 'hover';
|
|
120
120
|
var isRowsSelected = selectedRowIndexes.length > 0;
|
|
121
|
-
var showCondition = isHover ? isRowsSelected && !selectedRowIndexes.includes(rowIndex) && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex) : selectedRowIndexes.length < rowHeights.length && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex);
|
|
121
|
+
var showCondition = isHover ? isRowsSelected && !selectedRowIndexes.includes(rowIndex) && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex) : selectedRowIndexes.length < rowHeights.length && rowIndex < rowHeights.length && Number.isFinite(hoveredCell === null || hoveredCell === void 0 ? void 0 : hoveredCell.colIndex);
|
|
122
122
|
if (!showCondition) {
|
|
123
123
|
return null;
|
|
124
124
|
}
|
|
@@ -11,24 +11,20 @@ export var AddRowAboveIcon = function AddRowAboveIcon() {
|
|
|
11
11
|
height: "24",
|
|
12
12
|
fill: "var(--ds-border-inverse, #FFFFFF)",
|
|
13
13
|
fillOpacity: "0.01"
|
|
14
|
-
}), /*#__PURE__*/React.createElement("
|
|
15
|
-
id: "path-1-inside-1_896_17822",
|
|
16
|
-
fill: "var(--ds-border-inverse, #FFFFFF)"
|
|
17
|
-
}, /*#__PURE__*/React.createElement("rect", {
|
|
14
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
18
15
|
x: "6",
|
|
19
16
|
y: "12",
|
|
20
17
|
width: "12",
|
|
21
|
-
height: "
|
|
22
|
-
rx: "0.5"
|
|
23
|
-
|
|
18
|
+
height: "3",
|
|
19
|
+
rx: "0.5",
|
|
20
|
+
fill: "currentColor"
|
|
21
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
24
22
|
x: "6",
|
|
25
|
-
y: "
|
|
23
|
+
y: "16",
|
|
26
24
|
width: "12",
|
|
27
|
-
height: "
|
|
25
|
+
height: "3",
|
|
28
26
|
rx: "0.5",
|
|
29
|
-
|
|
30
|
-
strokeWidth: "4",
|
|
31
|
-
mask: "url(#path-1-inside-1_896_17822)"
|
|
27
|
+
fill: "currentColor"
|
|
32
28
|
}), /*#__PURE__*/React.createElement("path", {
|
|
33
29
|
fillRule: "evenodd",
|
|
34
30
|
clipRule: "evenodd",
|
|
@@ -6,28 +6,32 @@ export var AddRowBelowIcon = function AddRowBelowIcon() {
|
|
|
6
6
|
viewBox: "0 0 24 24",
|
|
7
7
|
fill: "none",
|
|
8
8
|
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
-
}, /*#__PURE__*/React.createElement("mask", {
|
|
10
|
-
id: "path-1-inside-1_920_47112",
|
|
11
|
-
fill: "var(--ds-border-inverse, #FFFFFF)"
|
|
12
9
|
}, /*#__PURE__*/React.createElement("rect", {
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
width: "24",
|
|
11
|
+
height: "24",
|
|
12
|
+
transform: "matrix(-1 0 0 -1 24 24)",
|
|
13
|
+
fill: "var(--ds-border-inverse, #FFFFFF)",
|
|
14
|
+
fillOpacity: "0.01"
|
|
15
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
16
|
+
x: "18",
|
|
17
|
+
y: "12",
|
|
15
18
|
width: "12",
|
|
16
|
-
height: "
|
|
17
|
-
rx: "0.5"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
height: "3",
|
|
20
|
+
rx: "0.5",
|
|
21
|
+
transform: "rotate(-180 18 12)",
|
|
22
|
+
fill: "currentColor"
|
|
23
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
24
|
+
x: "18",
|
|
25
|
+
y: "8",
|
|
21
26
|
width: "12",
|
|
22
|
-
height: "
|
|
27
|
+
height: "3",
|
|
23
28
|
rx: "0.5",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
mask: "url(#path-1-inside-1_920_47112)"
|
|
29
|
+
transform: "rotate(-180 18 8)",
|
|
30
|
+
fill: "currentColor"
|
|
27
31
|
}), /*#__PURE__*/React.createElement("path", {
|
|
28
32
|
fillRule: "evenodd",
|
|
29
33
|
clipRule: "evenodd",
|
|
30
|
-
d: "
|
|
34
|
+
d: "M11 17V18.01C11.0026 18.2735 11.1092 18.5253 11.2964 18.7107C11.4837 18.896 11.7365 19 12 19C12.556 19 13 18.556 13 18.01V17H14C14.2652 17 14.5196 16.8946 14.7071 16.7071C14.8946 16.5196 15 16.2652 15 16C15 15.7348 14.8946 15.4804 14.7071 15.2929C14.5196 15.1054 14.2652 15 14 15H13V13.99C12.9974 13.7265 12.8908 13.4747 12.7036 13.2893C12.5163 13.104 12.2635 13 12 13C11.444 13 11 13.444 11 13.99V15H10C9.73478 15 9.48043 15.1054 9.29289 15.2929C9.10536 15.4804 9 15.7348 9 16C9 16.2652 9.10536 16.5196 9.29289 16.7071C9.48043 16.8946 9.73478 17 10 17H11Z",
|
|
31
35
|
fill: "currentColor"
|
|
32
36
|
}));
|
|
33
37
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as tablesPlugin } from './plugin';
|
|
2
|
-
export type { TablePlugin } from './plugin';
|
|
2
|
+
export type { TablePlugin, TablePluginOptions } from './plugin';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as tablesPlugin } from './plugin';
|
|
2
|
-
export type { TablePlugin } from './plugin';
|
|
2
|
+
export type { TablePlugin, TablePluginOptions } from './plugin';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^35.3.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.0.11",
|
|
33
|
-
"@atlaskit/editor-common": "^77.
|
|
33
|
+
"@atlaskit/editor-common": "^77.1.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.2",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^0.4.0",
|
|
36
36
|
"@atlaskit/editor-plugin-content-insertion": "^0.1.0",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"@atlaskit/editor-plugin-width": "^0.2.0",
|
|
40
40
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
41
41
|
"@atlaskit/editor-shared-styles": "^2.9.0",
|
|
42
|
-
"@atlaskit/editor-tables": "^2.
|
|
42
|
+
"@atlaskit/editor-tables": "^2.5.0",
|
|
43
43
|
"@atlaskit/icon": "^22.0.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
45
45
|
"@atlaskit/pragmatic-drag-and-drop": "^0.25.0",
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^0.8.0",
|
|
47
47
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.12.0",
|
|
48
|
-
"@atlaskit/primitives": "^1.
|
|
48
|
+
"@atlaskit/primitives": "^1.20.0",
|
|
49
49
|
"@atlaskit/theme": "^12.6.0",
|
|
50
50
|
"@atlaskit/toggle": "^13.0.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
51
|
+
"@atlaskit/tokens": "^1.35.0",
|
|
52
52
|
"@atlaskit/tooltip": "^18.1.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"@emotion/react": "^11.7.1",
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as tablesPlugin } from './plugin';
|
|
2
|
-
export type { TablePlugin } from './plugin';
|
|
2
|
+
export type { TablePlugin, TablePluginOptions } from './plugin';
|