@atlaskit/editor-plugin-table 5.4.10 → 5.4.12
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 +14 -0
- package/dist/cjs/plugins/table/index.js +52 -49
- package/dist/cjs/plugins/table/toolbar.js +3 -6
- package/dist/cjs/plugins/table/ui/ColumnResizeWidget/index.js +3 -6
- package/dist/cjs/plugins/table/ui/DragHandle/index.js +12 -6
- package/dist/cjs/plugins/table/ui/DragPreview/index.js +2 -0
- package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +7 -10
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +10 -11
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +3 -6
- package/dist/cjs/plugins/table/ui/FloatingDragMenu/DragMenu.js +4 -7
- package/dist/cjs/plugins/table/ui/TableFloatingColumnControls/index.js +1 -4
- package/dist/es2019/plugins/table/index.js +22 -16
- package/dist/es2019/plugins/table/toolbar.js +3 -5
- package/dist/es2019/plugins/table/ui/ColumnResizeWidget/index.js +3 -5
- package/dist/es2019/plugins/table/ui/DragHandle/index.js +11 -4
- package/dist/es2019/plugins/table/ui/DragPreview/index.js +2 -0
- package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +7 -9
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +9 -11
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +3 -5
- package/dist/es2019/plugins/table/ui/FloatingDragMenu/DragMenu.js +4 -6
- package/dist/es2019/plugins/table/ui/TableFloatingColumnControls/index.js +1 -4
- package/dist/esm/plugins/table/index.js +52 -49
- package/dist/esm/plugins/table/toolbar.js +3 -5
- package/dist/esm/plugins/table/ui/ColumnResizeWidget/index.js +3 -5
- package/dist/esm/plugins/table/ui/DragHandle/index.js +11 -5
- package/dist/esm/plugins/table/ui/DragPreview/index.js +2 -0
- package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +7 -9
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +9 -11
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +3 -5
- package/dist/esm/plugins/table/ui/FloatingDragMenu/DragMenu.js +4 -6
- package/dist/esm/plugins/table/ui/TableFloatingColumnControls/index.js +1 -4
- package/package.json +3 -3
- package/src/plugins/table/index.tsx +8 -3
- package/src/plugins/table/ui/DragHandle/index.tsx +30 -21
- package/src/plugins/table/ui/TableFloatingColumnControls/index.tsx +1 -5
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
1
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
3
|
import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
@@ -89,7 +87,7 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
89
87
|
},
|
|
90
88
|
selected: false,
|
|
91
89
|
disabled: false,
|
|
92
|
-
elemAfter:
|
|
90
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
93
91
|
css: shortcutStyle
|
|
94
92
|
}, tooltip(addColumnAfter))
|
|
95
93
|
}, {
|
|
@@ -108,7 +106,7 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
108
106
|
},
|
|
109
107
|
selected: false,
|
|
110
108
|
disabled: false,
|
|
111
|
-
elemAfter:
|
|
109
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
112
110
|
css: shortcutStyle
|
|
113
111
|
}, tooltip(addRowAfter))
|
|
114
112
|
}, {
|
|
@@ -241,7 +239,7 @@ export const getToolbarCellOptionsConfig = (editorState, editorView, initialSele
|
|
|
241
239
|
},
|
|
242
240
|
selected: false,
|
|
243
241
|
disabled: false,
|
|
244
|
-
elemAfter:
|
|
242
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
245
243
|
css: shortcutStyle
|
|
246
244
|
}, tooltip(backspace))
|
|
247
245
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/** @jsx jsx */
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { jsx } from '@emotion/react';
|
|
5
3
|
import { useIntl } from 'react-intl-next';
|
|
6
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -15,19 +13,19 @@ export const ColumnResizeWidget = ({
|
|
|
15
13
|
formatMessage
|
|
16
14
|
} = useIntl();
|
|
17
15
|
if (!includeTooltip) {
|
|
18
|
-
return
|
|
16
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
17
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
20
18
|
"data-start-index": startIndex,
|
|
21
19
|
"data-end-index": endIndex
|
|
22
20
|
});
|
|
23
21
|
}
|
|
24
|
-
return
|
|
22
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
25
23
|
content: formatMessage(messages.adjustColumns),
|
|
26
24
|
hideTooltipOnClick: true,
|
|
27
25
|
hideTooltipOnMouseDown: true,
|
|
28
26
|
position: "mouse",
|
|
29
27
|
mousePosition: "auto-start"
|
|
30
|
-
}, tooltipProps =>
|
|
28
|
+
}, tooltipProps => /*#__PURE__*/React.createElement("div", _extends({
|
|
31
29
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
32
30
|
"data-start-index": startIndex,
|
|
33
31
|
"data-end-index": endIndex
|
|
@@ -100,8 +100,10 @@ export const DragHandle = ({
|
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
}, [tableLocalId, direction, indexes, editorView.state.selection, hasMergedCells]);
|
|
103
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
104
|
-
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance,
|
|
103
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
104
|
+
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, ClassName.CONTROLS_BUTTON, appearance, {
|
|
105
|
+
[ClassName.DRAG_HANDLE_DISABLED]: isDragAndDropEnabled && hasMergedCells
|
|
106
|
+
}),
|
|
105
107
|
ref: dragHandleDivRef,
|
|
106
108
|
style: {
|
|
107
109
|
transform: direction === 'column' ? 'none' : 'rotate(90deg)',
|
|
@@ -110,9 +112,14 @@ export const DragHandle = ({
|
|
|
110
112
|
"data-testid": "table-floating-column-controls-drag-handle",
|
|
111
113
|
onMouseOver: onMouseOver,
|
|
112
114
|
onMouseOut: onMouseOut,
|
|
113
|
-
onMouseUp:
|
|
115
|
+
onMouseUp: e => {
|
|
116
|
+
// return focus to editor so copying table selections whilst still works, i cannot call e.preventDefault in a mousemove event as this stops dragstart events from firing
|
|
117
|
+
// -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
|
|
118
|
+
editorView.focus();
|
|
119
|
+
onMouseUp && onMouseUp(e);
|
|
120
|
+
},
|
|
114
121
|
onClick: onClick
|
|
115
|
-
}, /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
|
|
122
|
+
}, /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps)), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
|
|
116
123
|
direction: direction,
|
|
117
124
|
width: previewWidth,
|
|
118
125
|
height: previewHeight
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
4
2
|
import { injectIntl } from 'react-intl-next';
|
|
5
3
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
6
4
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
@@ -50,25 +48,25 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
|
|
|
50
48
|
return null;
|
|
51
49
|
}
|
|
52
50
|
const labelCellOptions = formatMessage(messages.cellOptions);
|
|
53
|
-
const button =
|
|
51
|
+
const button = /*#__PURE__*/React.createElement("div", {
|
|
54
52
|
css: theme => [tableFloatingCellButtonStyles({
|
|
55
53
|
theme
|
|
56
54
|
}), isContextualMenuOpen && tableFloatingCellButtonSelectedStyles({
|
|
57
55
|
theme
|
|
58
56
|
})]
|
|
59
|
-
},
|
|
57
|
+
}, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
60
58
|
className: ClassName.CONTEXTUAL_MENU_BUTTON,
|
|
61
59
|
selected: isContextualMenuOpen,
|
|
62
60
|
title: labelCellOptions,
|
|
63
61
|
onClick: handleClick,
|
|
64
|
-
iconBefore:
|
|
62
|
+
iconBefore: /*#__PURE__*/React.createElement(ExpandIcon, {
|
|
65
63
|
label: ""
|
|
66
64
|
}),
|
|
67
65
|
"aria-label": labelCellOptions
|
|
68
66
|
}));
|
|
69
67
|
const parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
70
68
|
if (stickyHeader && parentSticky && tableWrapper) {
|
|
71
|
-
return
|
|
69
|
+
return /*#__PURE__*/React.createElement(FixedButton, {
|
|
72
70
|
offset: BUTTON_OFFSET,
|
|
73
71
|
stickyHeader: stickyHeader,
|
|
74
72
|
tableWrapper: tableWrapper,
|
|
@@ -78,7 +76,7 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
|
|
|
78
76
|
isContextualMenuOpen: isContextualMenuOpen
|
|
79
77
|
}, button);
|
|
80
78
|
}
|
|
81
|
-
return
|
|
79
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
82
80
|
alignX: "right",
|
|
83
81
|
alignY: "start",
|
|
84
82
|
target: targetCellRef,
|
|
@@ -93,9 +91,9 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
|
|
|
93
91
|
});
|
|
94
92
|
const FloatingContextualButton = injectIntl(FloatingContextualButtonInner);
|
|
95
93
|
export default function (props) {
|
|
96
|
-
return
|
|
94
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
97
95
|
component: ACTION_SUBJECT.FLOATING_CONTEXTUAL_BUTTON,
|
|
98
96
|
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
99
97
|
fallbackComponent: null
|
|
100
|
-
},
|
|
98
|
+
}, /*#__PURE__*/React.createElement(FloatingContextualButton, props));
|
|
101
99
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
/** @jsx jsx */
|
|
3
2
|
import { Component } from 'react';
|
|
4
|
-
import { jsx } from '@emotion/react';
|
|
5
3
|
import { injectIntl } from 'react-intl-next';
|
|
6
4
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
7
5
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -75,15 +73,15 @@ export class ContextualMenu extends Component {
|
|
|
75
73
|
value: {
|
|
76
74
|
name: 'background'
|
|
77
75
|
},
|
|
78
|
-
elemAfter:
|
|
76
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
79
77
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
80
|
-
},
|
|
78
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
81
79
|
css: cellColourPreviewStyles(background),
|
|
82
80
|
className: ClassName.CONTEXTUAL_MENU_ICON
|
|
83
|
-
}), isSubmenuOpen &&
|
|
81
|
+
}), isSubmenuOpen && /*#__PURE__*/React.createElement("div", {
|
|
84
82
|
className: ClassName.CONTEXTUAL_SUBMENU,
|
|
85
83
|
ref: this.handleSubMenuRef
|
|
86
|
-
},
|
|
84
|
+
}, /*#__PURE__*/React.createElement(ColorPalette, {
|
|
87
85
|
cols: 7,
|
|
88
86
|
onClick: this.setColor,
|
|
89
87
|
selectedColor: background,
|
|
@@ -100,7 +98,7 @@ export class ContextualMenu extends Component {
|
|
|
100
98
|
value: {
|
|
101
99
|
name: 'insert_column'
|
|
102
100
|
},
|
|
103
|
-
elemAfter:
|
|
101
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
104
102
|
css: shortcutStyle
|
|
105
103
|
}, tooltip(addColumnAfter))
|
|
106
104
|
});
|
|
@@ -109,7 +107,7 @@ export class ContextualMenu extends Component {
|
|
|
109
107
|
value: {
|
|
110
108
|
name: 'insert_row'
|
|
111
109
|
},
|
|
112
|
-
elemAfter:
|
|
110
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
113
111
|
css: shortcutStyle
|
|
114
112
|
}, tooltip(addRowAfter))
|
|
115
113
|
});
|
|
@@ -193,7 +191,7 @@ export class ContextualMenu extends Component {
|
|
|
193
191
|
value: {
|
|
194
192
|
name: 'clear'
|
|
195
193
|
},
|
|
196
|
-
elemAfter:
|
|
194
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
197
195
|
css: shortcutStyle
|
|
198
196
|
}, tooltip(backspace))
|
|
199
197
|
});
|
|
@@ -375,10 +373,10 @@ export class ContextualMenu extends Component {
|
|
|
375
373
|
if (!items) {
|
|
376
374
|
return null;
|
|
377
375
|
}
|
|
378
|
-
return
|
|
376
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
379
377
|
"data-testid": "table-cell-contextual-menu",
|
|
380
378
|
onMouseLeave: this.closeSubmenu
|
|
381
|
-
},
|
|
379
|
+
}, /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
382
380
|
mountTo: mountPoint
|
|
383
381
|
//This needs be removed when the a11y is completely handled
|
|
384
382
|
//Disabling key navigation now as it works only partially
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
1
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
4
2
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
3
|
import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
@@ -38,7 +36,7 @@ const FloatingContextualMenu = ({
|
|
|
38
36
|
return null;
|
|
39
37
|
}
|
|
40
38
|
const parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
41
|
-
return
|
|
39
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
42
40
|
alignX: "right",
|
|
43
41
|
alignY: "top",
|
|
44
42
|
target: targetCellRef,
|
|
@@ -54,9 +52,9 @@ const FloatingContextualMenu = ({
|
|
|
54
52
|
forcePlacement: true,
|
|
55
53
|
offset: [-7, 0],
|
|
56
54
|
stick: true
|
|
57
|
-
},
|
|
55
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
58
56
|
css: tablePopupStyles
|
|
59
|
-
},
|
|
57
|
+
}, /*#__PURE__*/React.createElement(ContextualMenu, {
|
|
60
58
|
editorView: editorView,
|
|
61
59
|
offset: [contextualMenuTriggerSize / 2, -contextualMenuTriggerSize],
|
|
62
60
|
isOpen: isOpen,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
1
|
import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
4
2
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
5
3
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
@@ -26,15 +24,15 @@ const convertToDropdownItems = dragMenuConfig => {
|
|
|
26
24
|
name: item.id
|
|
27
25
|
},
|
|
28
26
|
isDisabled: item.disabled,
|
|
29
|
-
elemBefore: item.icon ?
|
|
27
|
+
elemBefore: item.icon ? /*#__PURE__*/React.createElement("div", {
|
|
30
28
|
style: {
|
|
31
29
|
marginRight: "var(--ds-space-negative-075, -6px)",
|
|
32
30
|
display: 'flex'
|
|
33
31
|
}
|
|
34
|
-
},
|
|
32
|
+
}, /*#__PURE__*/React.createElement(item.icon, {
|
|
35
33
|
label: item.title
|
|
36
34
|
})) : undefined,
|
|
37
|
-
elemAfter: item.keymap ?
|
|
35
|
+
elemAfter: item.keymap ? /*#__PURE__*/React.createElement("div", {
|
|
38
36
|
css: shortcutStyle
|
|
39
37
|
}, item.keymap) : undefined
|
|
40
38
|
});
|
|
@@ -137,7 +135,7 @@ export const DragMenu = ({
|
|
|
137
135
|
if (!menuItems) {
|
|
138
136
|
return null;
|
|
139
137
|
}
|
|
140
|
-
return
|
|
138
|
+
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
141
139
|
mountTo: mountPoint
|
|
142
140
|
//This needs be removed when the a11y is completely handled
|
|
143
141
|
//Disabling key navigation now as it works only partially
|
|
@@ -70,14 +70,11 @@ export const TableFloatingColumnControls = ({
|
|
|
70
70
|
}
|
|
71
71
|
return [0];
|
|
72
72
|
}, [tableRef, tableRect.height]);
|
|
73
|
-
if (!tableRef) {
|
|
73
|
+
if (!tableRef || !tableActive) {
|
|
74
74
|
return null;
|
|
75
75
|
}
|
|
76
76
|
const colWidths = getColumnsWidths(editorView);
|
|
77
77
|
const stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
78
|
-
if (!tableActive) {
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
78
|
return /*#__PURE__*/React.createElement("div", {
|
|
82
79
|
className: ClassName.DRAG_COLUMN_CONTROLS_WRAPPER,
|
|
83
80
|
"data-testid": "table-floating-column-controls-wrapper"
|
|
@@ -147,10 +147,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
147
147
|
}, {
|
|
148
148
|
name: 'tableEditing',
|
|
149
149
|
plugin: function plugin() {
|
|
150
|
+
var _ref6 = options || {},
|
|
151
|
+
dragAndDropEnabled = _ref6.dragAndDropEnabled;
|
|
150
152
|
return tableEditing({
|
|
151
|
-
reportFixedTable: function reportFixedTable(
|
|
152
|
-
var tr =
|
|
153
|
-
reason =
|
|
153
|
+
reportFixedTable: function reportFixedTable(_ref7) {
|
|
154
|
+
var tr = _ref7.tr,
|
|
155
|
+
reason = _ref7.reason;
|
|
154
156
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
155
157
|
action: TABLE_ACTION.FIXED,
|
|
156
158
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -160,54 +162,55 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
160
162
|
},
|
|
161
163
|
eventType: EVENT_TYPE.TRACK
|
|
162
164
|
})(tr);
|
|
163
|
-
}
|
|
165
|
+
},
|
|
166
|
+
dragAndDropEnabled: dragAndDropEnabled
|
|
164
167
|
});
|
|
165
168
|
}
|
|
166
169
|
}, {
|
|
167
170
|
name: 'tableStickyHeaders',
|
|
168
|
-
plugin: function plugin(
|
|
169
|
-
var dispatch =
|
|
170
|
-
eventDispatcher =
|
|
171
|
+
plugin: function plugin(_ref8) {
|
|
172
|
+
var dispatch = _ref8.dispatch,
|
|
173
|
+
eventDispatcher = _ref8.eventDispatcher;
|
|
171
174
|
return options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, eventDispatcher, function () {
|
|
172
175
|
return [];
|
|
173
176
|
}, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined;
|
|
174
177
|
}
|
|
175
178
|
}, {
|
|
176
179
|
name: 'tableDragAndDrop',
|
|
177
|
-
plugin: function plugin(
|
|
178
|
-
var dispatch =
|
|
179
|
-
eventDispatcher =
|
|
180
|
+
plugin: function plugin(_ref9) {
|
|
181
|
+
var dispatch = _ref9.dispatch,
|
|
182
|
+
eventDispatcher = _ref9.eventDispatcher;
|
|
180
183
|
return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, eventDispatcher) : undefined;
|
|
181
184
|
}
|
|
182
185
|
}, {
|
|
183
186
|
name: 'tableLocalId',
|
|
184
|
-
plugin: function plugin(
|
|
185
|
-
var dispatch =
|
|
187
|
+
plugin: function plugin(_ref10) {
|
|
188
|
+
var dispatch = _ref10.dispatch;
|
|
186
189
|
return createTableLocalIdPlugin(dispatch);
|
|
187
190
|
}
|
|
188
191
|
}, {
|
|
189
192
|
name: 'tableWidth',
|
|
190
|
-
plugin: function plugin(
|
|
193
|
+
plugin: function plugin(_ref11) {
|
|
191
194
|
var _options$fullWidthEna;
|
|
192
|
-
var dispatchAnalyticsEvent =
|
|
193
|
-
dispatch =
|
|
195
|
+
var dispatchAnalyticsEvent = _ref11.dispatchAnalyticsEvent,
|
|
196
|
+
dispatch = _ref11.dispatch;
|
|
194
197
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
195
198
|
}
|
|
196
199
|
},
|
|
197
200
|
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
198
201
|
{
|
|
199
202
|
name: 'tableOverflowAnalyticsPlugin',
|
|
200
|
-
plugin: function plugin(
|
|
203
|
+
plugin: function plugin(_ref12) {
|
|
201
204
|
var _options$tableResizin;
|
|
202
|
-
var dispatch =
|
|
203
|
-
dispatchAnalyticsEvent =
|
|
205
|
+
var dispatch = _ref12.dispatch,
|
|
206
|
+
dispatchAnalyticsEvent = _ref12.dispatchAnalyticsEvent;
|
|
204
207
|
return getBooleanFF('platform.editor.table.overflow-state-analytics') ? createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false) : undefined;
|
|
205
208
|
}
|
|
206
209
|
}, {
|
|
207
210
|
name: 'tableAnalyticsPlugin',
|
|
208
|
-
plugin: function plugin(
|
|
209
|
-
var dispatch =
|
|
210
|
-
dispatchAnalyticsEvent =
|
|
211
|
+
plugin: function plugin(_ref13) {
|
|
212
|
+
var dispatch = _ref13.dispatch,
|
|
213
|
+
dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent;
|
|
211
214
|
return getBooleanFF('platform.editor.table.analytics-plugin-moved-event') ? createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent) : undefined;
|
|
212
215
|
}
|
|
213
216
|
}, {
|
|
@@ -238,12 +241,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
238
241
|
}
|
|
239
242
|
return plugins;
|
|
240
243
|
},
|
|
241
|
-
contentComponent: function contentComponent(
|
|
242
|
-
var editorView =
|
|
243
|
-
popupsMountPoint =
|
|
244
|
-
popupsBoundariesElement =
|
|
245
|
-
popupsScrollableElement =
|
|
246
|
-
dispatchAnalyticsEvent =
|
|
244
|
+
contentComponent: function contentComponent(_ref14) {
|
|
245
|
+
var editorView = _ref14.editorView,
|
|
246
|
+
popupsMountPoint = _ref14.popupsMountPoint,
|
|
247
|
+
popupsBoundariesElement = _ref14.popupsBoundariesElement,
|
|
248
|
+
popupsScrollableElement = _ref14.popupsScrollableElement,
|
|
249
|
+
dispatchAnalyticsEvent = _ref14.dispatchAnalyticsEvent;
|
|
247
250
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
248
251
|
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
249
252
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -257,30 +260,30 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
257
260
|
stickyHeadersState: stickyHeadersPluginKey,
|
|
258
261
|
dragAndDropState: dragAndDropPluginKey
|
|
259
262
|
},
|
|
260
|
-
render: function render(
|
|
261
|
-
var resizingPluginState =
|
|
262
|
-
stickyHeadersState =
|
|
263
|
-
tablePluginState =
|
|
264
|
-
tableWidthPluginState =
|
|
265
|
-
dragAndDropState =
|
|
263
|
+
render: function render(_ref15) {
|
|
264
|
+
var resizingPluginState = _ref15.tableResizingPluginState,
|
|
265
|
+
stickyHeadersState = _ref15.stickyHeadersState,
|
|
266
|
+
tablePluginState = _ref15.tablePluginState,
|
|
267
|
+
tableWidthPluginState = _ref15.tableWidthPluginState,
|
|
268
|
+
dragAndDropState = _ref15.dragAndDropState;
|
|
266
269
|
var state = editorView.state;
|
|
267
270
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
268
271
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
269
272
|
var isResizing = isColumnResizing || isTableResizing;
|
|
270
|
-
var
|
|
271
|
-
tableNode =
|
|
272
|
-
tablePos =
|
|
273
|
-
targetCellPosition =
|
|
274
|
-
isContextualMenuOpen =
|
|
275
|
-
layout =
|
|
276
|
-
tableRef =
|
|
277
|
-
pluginConfig =
|
|
278
|
-
insertColumnButtonIndex =
|
|
279
|
-
insertRowButtonIndex =
|
|
280
|
-
isHeaderColumnEnabled =
|
|
281
|
-
isHeaderRowEnabled =
|
|
282
|
-
isDragAndDropEnabled =
|
|
283
|
-
tableWrapperTarget =
|
|
273
|
+
var _ref16 = tablePluginState,
|
|
274
|
+
tableNode = _ref16.tableNode,
|
|
275
|
+
tablePos = _ref16.tablePos,
|
|
276
|
+
targetCellPosition = _ref16.targetCellPosition,
|
|
277
|
+
isContextualMenuOpen = _ref16.isContextualMenuOpen,
|
|
278
|
+
layout = _ref16.layout,
|
|
279
|
+
tableRef = _ref16.tableRef,
|
|
280
|
+
pluginConfig = _ref16.pluginConfig,
|
|
281
|
+
insertColumnButtonIndex = _ref16.insertColumnButtonIndex,
|
|
282
|
+
insertRowButtonIndex = _ref16.insertRowButtonIndex,
|
|
283
|
+
isHeaderColumnEnabled = _ref16.isHeaderColumnEnabled,
|
|
284
|
+
isHeaderRowEnabled = _ref16.isHeaderRowEnabled,
|
|
285
|
+
isDragAndDropEnabled = _ref16.isDragAndDropEnabled,
|
|
286
|
+
tableWrapperTarget = _ref16.tableWrapperTarget;
|
|
284
287
|
var allowControls = pluginConfig.allowControls;
|
|
285
288
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
286
289
|
var LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
|
|
@@ -358,8 +361,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
358
361
|
}));
|
|
359
362
|
},
|
|
360
363
|
pluginsOptions: {
|
|
361
|
-
quickInsert: function quickInsert(
|
|
362
|
-
var formatMessage =
|
|
364
|
+
quickInsert: function quickInsert(_ref17) {
|
|
365
|
+
var formatMessage = _ref17.formatMessage;
|
|
363
366
|
return [{
|
|
364
367
|
id: 'table',
|
|
365
368
|
title: formatMessage(messages.table),
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
3
1
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
4
2
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
3
|
import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
@@ -87,7 +85,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
87
85
|
},
|
|
88
86
|
selected: false,
|
|
89
87
|
disabled: false,
|
|
90
|
-
elemAfter:
|
|
88
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
91
89
|
css: shortcutStyle
|
|
92
90
|
}, tooltip(addColumnAfter))
|
|
93
91
|
}, {
|
|
@@ -106,7 +104,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
106
104
|
},
|
|
107
105
|
selected: false,
|
|
108
106
|
disabled: false,
|
|
109
|
-
elemAfter:
|
|
107
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
110
108
|
css: shortcutStyle
|
|
111
109
|
}, tooltip(addRowAfter))
|
|
112
110
|
}, {
|
|
@@ -238,7 +236,7 @@ export var getToolbarCellOptionsConfig = function getToolbarCellOptionsConfig(ed
|
|
|
238
236
|
},
|
|
239
237
|
selected: false,
|
|
240
238
|
disabled: false,
|
|
241
|
-
elemAfter:
|
|
239
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
242
240
|
css: shortcutStyle
|
|
243
241
|
}, tooltip(backspace))
|
|
244
242
|
});
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/** @jsx jsx */
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { jsx } from '@emotion/react';
|
|
5
3
|
import { useIntl } from 'react-intl-next';
|
|
6
4
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
7
5
|
import Tooltip from '@atlaskit/tooltip';
|
|
@@ -13,20 +11,20 @@ export var ColumnResizeWidget = function ColumnResizeWidget(_ref) {
|
|
|
13
11
|
var _useIntl = useIntl(),
|
|
14
12
|
formatMessage = _useIntl.formatMessage;
|
|
15
13
|
if (!includeTooltip) {
|
|
16
|
-
return
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
17
15
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
18
16
|
"data-start-index": startIndex,
|
|
19
17
|
"data-end-index": endIndex
|
|
20
18
|
});
|
|
21
19
|
}
|
|
22
|
-
return
|
|
20
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
23
21
|
content: formatMessage(messages.adjustColumns),
|
|
24
22
|
hideTooltipOnClick: true,
|
|
25
23
|
hideTooltipOnMouseDown: true,
|
|
26
24
|
position: "mouse",
|
|
27
25
|
mousePosition: "auto-start"
|
|
28
26
|
}, function (tooltipProps) {
|
|
29
|
-
return
|
|
27
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
30
28
|
className: TableCssClassName.RESIZE_HANDLE_DECORATION,
|
|
31
29
|
"data-start-index": startIndex,
|
|
32
30
|
"data-end-index": endIndex
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
4
|
import classnames from 'classnames';
|
|
@@ -21,7 +22,7 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
21
22
|
previewHeight = _ref.previewHeight,
|
|
22
23
|
onMouseOver = _ref.onMouseOver,
|
|
23
24
|
onMouseOut = _ref.onMouseOut,
|
|
24
|
-
|
|
25
|
+
_onMouseUp = _ref.onMouseUp,
|
|
25
26
|
onClick = _ref.onClick,
|
|
26
27
|
editorView = _ref.editorView;
|
|
27
28
|
var dragHandleDivRef = useRef(null);
|
|
@@ -102,8 +103,8 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
}, [tableLocalId, direction, indexes, editorView.state.selection, hasMergedCells]);
|
|
105
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
106
|
-
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, appearance, isDragAndDropEnabled && hasMergedCells
|
|
106
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
107
|
+
className: classnames(ClassName.DRAG_HANDLE_BUTTON_CONTAINER, ClassName.CONTROLS_BUTTON, appearance, _defineProperty({}, ClassName.DRAG_HANDLE_DISABLED, isDragAndDropEnabled && hasMergedCells)),
|
|
107
108
|
ref: dragHandleDivRef,
|
|
108
109
|
style: {
|
|
109
110
|
transform: direction === 'column' ? 'none' : 'rotate(90deg)',
|
|
@@ -112,9 +113,14 @@ export var DragHandle = function DragHandle(_ref) {
|
|
|
112
113
|
"data-testid": "table-floating-column-controls-drag-handle",
|
|
113
114
|
onMouseOver: onMouseOver,
|
|
114
115
|
onMouseOut: onMouseOut,
|
|
115
|
-
onMouseUp: onMouseUp
|
|
116
|
+
onMouseUp: function onMouseUp(e) {
|
|
117
|
+
// return focus to editor so copying table selections whilst still works, i cannot call e.preventDefault in a mousemove event as this stops dragstart events from firing
|
|
118
|
+
// -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
|
|
119
|
+
editorView.focus();
|
|
120
|
+
_onMouseUp && _onMouseUp(e);
|
|
121
|
+
},
|
|
116
122
|
onClick: onClick
|
|
117
|
-
}, /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
|
|
123
|
+
}, /*#__PURE__*/React.createElement(HandleIconComponent, handleIconProps)), previewContainer && previewWidth !== undefined && previewHeight !== undefined && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(DragPreview, {
|
|
118
124
|
direction: direction,
|
|
119
125
|
width: previewWidth,
|
|
120
126
|
height: previewHeight
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
1
|
import React from 'react';
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
4
2
|
import { injectIntl } from 'react-intl-next';
|
|
5
3
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
6
4
|
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
@@ -44,7 +42,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
44
42
|
return null;
|
|
45
43
|
}
|
|
46
44
|
var labelCellOptions = formatMessage(messages.cellOptions);
|
|
47
|
-
var button =
|
|
45
|
+
var button = /*#__PURE__*/React.createElement("div", {
|
|
48
46
|
css: function css(theme) {
|
|
49
47
|
return [tableFloatingCellButtonStyles({
|
|
50
48
|
theme: theme
|
|
@@ -52,19 +50,19 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
52
50
|
theme: theme
|
|
53
51
|
})];
|
|
54
52
|
}
|
|
55
|
-
},
|
|
53
|
+
}, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
56
54
|
className: ClassName.CONTEXTUAL_MENU_BUTTON,
|
|
57
55
|
selected: isContextualMenuOpen,
|
|
58
56
|
title: labelCellOptions,
|
|
59
57
|
onClick: handleClick,
|
|
60
|
-
iconBefore:
|
|
58
|
+
iconBefore: /*#__PURE__*/React.createElement(ExpandIcon, {
|
|
61
59
|
label: ""
|
|
62
60
|
}),
|
|
63
61
|
"aria-label": labelCellOptions
|
|
64
62
|
}));
|
|
65
63
|
var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
66
64
|
if (stickyHeader && parentSticky && tableWrapper) {
|
|
67
|
-
return
|
|
65
|
+
return /*#__PURE__*/React.createElement(FixedButton, {
|
|
68
66
|
offset: BUTTON_OFFSET,
|
|
69
67
|
stickyHeader: stickyHeader,
|
|
70
68
|
tableWrapper: tableWrapper,
|
|
@@ -74,7 +72,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
74
72
|
isContextualMenuOpen: isContextualMenuOpen
|
|
75
73
|
}, button);
|
|
76
74
|
}
|
|
77
|
-
return
|
|
75
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
78
76
|
alignX: "right",
|
|
79
77
|
alignY: "start",
|
|
80
78
|
target: targetCellRef,
|
|
@@ -89,9 +87,9 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
|
|
|
89
87
|
});
|
|
90
88
|
var FloatingContextualButton = injectIntl(FloatingContextualButtonInner);
|
|
91
89
|
export default function (props) {
|
|
92
|
-
return
|
|
90
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
93
91
|
component: ACTION_SUBJECT.FLOATING_CONTEXTUAL_BUTTON,
|
|
94
92
|
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
95
93
|
fallbackComponent: null
|
|
96
|
-
},
|
|
94
|
+
}, /*#__PURE__*/React.createElement(FloatingContextualButton, props));
|
|
97
95
|
}
|