@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
|
@@ -9,9 +9,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
|
-
/** @jsx jsx */
|
|
13
12
|
import { Component } from 'react';
|
|
14
|
-
import { jsx } from '@emotion/react';
|
|
15
13
|
import { injectIntl } from 'react-intl-next';
|
|
16
14
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
17
15
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -82,15 +80,15 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
82
80
|
value: {
|
|
83
81
|
name: 'background'
|
|
84
82
|
},
|
|
85
|
-
elemAfter:
|
|
83
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
86
84
|
className: DropdownMenuSharedCssClassName.SUBMENU
|
|
87
|
-
},
|
|
85
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
88
86
|
css: cellColourPreviewStyles(background),
|
|
89
87
|
className: ClassName.CONTEXTUAL_MENU_ICON
|
|
90
|
-
}), isSubmenuOpen &&
|
|
88
|
+
}), isSubmenuOpen && /*#__PURE__*/React.createElement("div", {
|
|
91
89
|
className: ClassName.CONTEXTUAL_SUBMENU,
|
|
92
90
|
ref: _this.handleSubMenuRef
|
|
93
|
-
},
|
|
91
|
+
}, /*#__PURE__*/React.createElement(ColorPalette, {
|
|
94
92
|
cols: 7,
|
|
95
93
|
onClick: _this.setColor,
|
|
96
94
|
selectedColor: background,
|
|
@@ -107,7 +105,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
107
105
|
value: {
|
|
108
106
|
name: 'insert_column'
|
|
109
107
|
},
|
|
110
|
-
elemAfter:
|
|
108
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
111
109
|
css: shortcutStyle
|
|
112
110
|
}, tooltip(addColumnAfter))
|
|
113
111
|
});
|
|
@@ -116,7 +114,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
116
114
|
value: {
|
|
117
115
|
name: 'insert_row'
|
|
118
116
|
},
|
|
119
|
-
elemAfter:
|
|
117
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
120
118
|
css: shortcutStyle
|
|
121
119
|
}, tooltip(addRowAfter))
|
|
122
120
|
});
|
|
@@ -196,7 +194,7 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
196
194
|
value: {
|
|
197
195
|
name: 'clear'
|
|
198
196
|
},
|
|
199
|
-
elemAfter:
|
|
197
|
+
elemAfter: /*#__PURE__*/React.createElement("div", {
|
|
200
198
|
css: shortcutStyle
|
|
201
199
|
}, tooltip(backspace))
|
|
202
200
|
});
|
|
@@ -358,10 +356,10 @@ export var ContextualMenu = /*#__PURE__*/function (_Component) {
|
|
|
358
356
|
if (!items) {
|
|
359
357
|
return null;
|
|
360
358
|
}
|
|
361
|
-
return
|
|
359
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
362
360
|
"data-testid": "table-cell-contextual-menu",
|
|
363
361
|
onMouseLeave: this.closeSubmenu
|
|
364
|
-
},
|
|
362
|
+
}, /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
365
363
|
mountTo: mountPoint
|
|
366
364
|
//This needs be removed when the a11y is completely handled
|
|
367
365
|
//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';
|
|
@@ -34,7 +32,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
34
32
|
return null;
|
|
35
33
|
}
|
|
36
34
|
var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
|
|
37
|
-
return
|
|
35
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
38
36
|
alignX: "right",
|
|
39
37
|
alignY: "top",
|
|
40
38
|
target: targetCellRef,
|
|
@@ -50,9 +48,9 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
|
|
|
50
48
|
forcePlacement: true,
|
|
51
49
|
offset: [-7, 0],
|
|
52
50
|
stick: true
|
|
53
|
-
},
|
|
51
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
54
52
|
css: tablePopupStyles
|
|
55
|
-
},
|
|
53
|
+
}, /*#__PURE__*/React.createElement(ContextualMenu, {
|
|
56
54
|
editorView: editorView,
|
|
57
55
|
offset: [contextualMenuTriggerSize / 2, -contextualMenuTriggerSize],
|
|
58
56
|
isOpen: isOpen,
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
/** @jsx jsx */
|
|
3
|
-
import { jsx } from '@emotion/react';
|
|
4
2
|
import { ArrowKeyNavigationType, DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
5
3
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
6
4
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
@@ -31,15 +29,15 @@ var convertToDropdownItems = function convertToDropdownItems(dragMenuConfig) {
|
|
|
31
29
|
name: item.id
|
|
32
30
|
},
|
|
33
31
|
isDisabled: item.disabled,
|
|
34
|
-
elemBefore: item.icon ?
|
|
32
|
+
elemBefore: item.icon ? /*#__PURE__*/React.createElement("div", {
|
|
35
33
|
style: {
|
|
36
34
|
marginRight: "var(--ds-space-negative-075, -6px)",
|
|
37
35
|
display: 'flex'
|
|
38
36
|
}
|
|
39
|
-
},
|
|
37
|
+
}, /*#__PURE__*/React.createElement(item.icon, {
|
|
40
38
|
label: item.title
|
|
41
39
|
})) : undefined,
|
|
42
|
-
elemAfter: item.keymap ?
|
|
40
|
+
elemAfter: item.keymap ? /*#__PURE__*/React.createElement("div", {
|
|
43
41
|
css: shortcutStyle
|
|
44
42
|
}, item.keymap) : undefined
|
|
45
43
|
});
|
|
@@ -131,7 +129,7 @@ export var DragMenu = function DragMenu(_ref) {
|
|
|
131
129
|
if (!menuItems) {
|
|
132
130
|
return null;
|
|
133
131
|
}
|
|
134
|
-
return
|
|
132
|
+
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
135
133
|
mountTo: mountPoint
|
|
136
134
|
//This needs be removed when the a11y is completely handled
|
|
137
135
|
//Disabling key navigation now as it works only partially
|
|
@@ -89,14 +89,11 @@ export var TableFloatingColumnControls = function TableFloatingColumnControls(_r
|
|
|
89
89
|
}
|
|
90
90
|
return [0];
|
|
91
91
|
}, [tableRef, tableRect.height]);
|
|
92
|
-
if (!tableRef) {
|
|
92
|
+
if (!tableRef || !tableActive) {
|
|
93
93
|
return null;
|
|
94
94
|
}
|
|
95
95
|
var colWidths = getColumnsWidths(editorView);
|
|
96
96
|
var stickyTop = stickyHeader && stickyHeader.sticky && hasHeaderRow ? stickyHeader.top : undefined;
|
|
97
|
-
if (!tableActive) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
97
|
return /*#__PURE__*/React.createElement("div", {
|
|
101
98
|
className: ClassName.DRAG_COLUMN_CONTROLS_WRAPPER,
|
|
102
99
|
"data-testid": "table-floating-column-controls-wrapper"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.12",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"releaseModel": "continuous"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atlaskit/adf-schema": "^
|
|
31
|
-
"@atlaskit/custom-steps": "^0.0.
|
|
30
|
+
"@atlaskit/adf-schema": "^35.0.0",
|
|
31
|
+
"@atlaskit/custom-steps": "^0.0.6",
|
|
32
32
|
"@atlaskit/editor-common": "^76.24.0",
|
|
33
33
|
"@atlaskit/editor-palette": "1.5.2",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^0.3.0",
|
|
@@ -238,8 +238,11 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
238
238
|
},
|
|
239
239
|
{
|
|
240
240
|
name: 'tableEditing',
|
|
241
|
-
plugin: () =>
|
|
242
|
-
|
|
241
|
+
plugin: () => {
|
|
242
|
+
const { dragAndDropEnabled } =
|
|
243
|
+
options || ({} as TablePluginOptions);
|
|
244
|
+
|
|
245
|
+
return tableEditing({
|
|
243
246
|
reportFixedTable: ({
|
|
244
247
|
tr,
|
|
245
248
|
reason,
|
|
@@ -257,7 +260,9 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
257
260
|
eventType: EVENT_TYPE.TRACK,
|
|
258
261
|
})(tr);
|
|
259
262
|
},
|
|
260
|
-
|
|
263
|
+
dragAndDropEnabled,
|
|
264
|
+
}) as SafePlugin;
|
|
265
|
+
},
|
|
261
266
|
},
|
|
262
267
|
{
|
|
263
268
|
name: 'tableStickyHeaders',
|
|
@@ -134,26 +134,35 @@ export const DragHandle = ({
|
|
|
134
134
|
]);
|
|
135
135
|
|
|
136
136
|
return (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
137
|
+
<>
|
|
138
|
+
<button
|
|
139
|
+
className={classnames(
|
|
140
|
+
ClassName.DRAG_HANDLE_BUTTON_CONTAINER,
|
|
141
|
+
ClassName.CONTROLS_BUTTON,
|
|
142
|
+
appearance,
|
|
143
|
+
{
|
|
144
|
+
[ClassName.DRAG_HANDLE_DISABLED]:
|
|
145
|
+
isDragAndDropEnabled && hasMergedCells,
|
|
146
|
+
},
|
|
147
|
+
)}
|
|
148
|
+
ref={dragHandleDivRef}
|
|
149
|
+
style={{
|
|
150
|
+
transform: direction === 'column' ? 'none' : 'rotate(90deg)',
|
|
151
|
+
pointerEvents: 'auto',
|
|
152
|
+
}}
|
|
153
|
+
data-testid="table-floating-column-controls-drag-handle"
|
|
154
|
+
onMouseOver={onMouseOver}
|
|
155
|
+
onMouseOut={onMouseOut}
|
|
156
|
+
onMouseUp={(e) => {
|
|
157
|
+
// 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
|
|
158
|
+
// -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
|
|
159
|
+
editorView.focus();
|
|
160
|
+
onMouseUp && onMouseUp(e);
|
|
161
|
+
}}
|
|
162
|
+
onClick={onClick}
|
|
163
|
+
>
|
|
164
|
+
<HandleIconComponent {...handleIconProps} />
|
|
165
|
+
</button>
|
|
157
166
|
{previewContainer &&
|
|
158
167
|
previewWidth !== undefined &&
|
|
159
168
|
previewHeight !== undefined &&
|
|
@@ -165,6 +174,6 @@ export const DragHandle = ({
|
|
|
165
174
|
/>,
|
|
166
175
|
previewContainer,
|
|
167
176
|
)}
|
|
168
|
-
|
|
177
|
+
</>
|
|
169
178
|
);
|
|
170
179
|
};
|
|
@@ -108,7 +108,7 @@ export const TableFloatingColumnControls: React.FC<Props> = ({
|
|
|
108
108
|
return [0];
|
|
109
109
|
}, [tableRef, tableRect.height]);
|
|
110
110
|
|
|
111
|
-
if (!tableRef) {
|
|
111
|
+
if (!tableRef || !tableActive) {
|
|
112
112
|
return null;
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -119,10 +119,6 @@ export const TableFloatingColumnControls: React.FC<Props> = ({
|
|
|
119
119
|
? stickyHeader.top
|
|
120
120
|
: undefined;
|
|
121
121
|
|
|
122
|
-
if (!tableActive) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
122
|
return (
|
|
127
123
|
<div
|
|
128
124
|
className={ClassName.DRAG_COLUMN_CONTROLS_WRAPPER}
|