@atlaskit/editor-plugin-table 7.6.10 → 7.6.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/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/nodeviews/TableContainer.js +7 -1
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/toolbar.js +18 -4
- package/dist/cjs/ui/DragHandle/index.js +9 -0
- package/dist/es2019/nodeviews/TableContainer.js +8 -1
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/toolbar.js +18 -4
- package/dist/es2019/ui/DragHandle/index.js +9 -0
- package/dist/esm/nodeviews/TableContainer.js +7 -1
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/toolbar.js +18 -4
- package/dist/esm/ui/DragHandle/index.js +9 -0
- package/dist/types/plugin.d.ts +3 -1
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +90 -2
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +180 -4
- package/dist/types/ui/TableFloatingControls/index.d.ts +90 -2
- package/dist/types-ts4.5/plugin.d.ts +3 -1
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +106 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +212 -4
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +106 -2
- package/package.json +6 -2
- package/src/nodeviews/TableContainer.tsx +12 -2
- package/src/plugin.tsx +2 -0
- package/src/pm-plugins/main.ts +4 -1
- package/src/toolbar.tsx +12 -0
- package/src/ui/DragHandle/index.tsx +9 -0
- package/tsconfig.app.json +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.6.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#88299](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88299) [`5a05e6793651`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5a05e6793651) - [ux] fix clickable zone issue
|
|
8
|
+
- [#88007](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88007) [`966ef2d91a91`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/966ef2d91a91) - Disable table resizing in live view mode
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 7.6.11
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#80728](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/80728) [`aac7ad9bb32d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/aac7ad9bb32d) - [ux] The table's floating toolbar dropdown menu a11y annnouncement.
|
|
16
|
+
|
|
3
17
|
## 7.6.10
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
14
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
14
15
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
15
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -117,6 +118,8 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
117
118
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
118
119
|
}, [pluginInjectionApi]);
|
|
119
120
|
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
121
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorViewMode']),
|
|
122
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
120
123
|
|
|
121
124
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
122
125
|
var responsiveContainerWidth = isTableScalingEnabled ? containerWidth - _editorSharedStyles.akEditorGutterPadding * 2 - _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide / 2 : containerWidth - _editorSharedStyles.akEditorGutterPadding * 2 - _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide;
|
|
@@ -159,7 +162,10 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
159
162
|
},
|
|
160
163
|
className: _types.TableCssClassName.TABLE_RESIZER_CONTAINER,
|
|
161
164
|
ref: containerRef
|
|
162
|
-
},
|
|
165
|
+
}, (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
166
|
+
className: className,
|
|
167
|
+
node: node
|
|
168
|
+
}, children) : /*#__PURE__*/_react.default.createElement(_TableResizer.TableResizer, tableResizerProps, /*#__PURE__*/_react.default.createElement(InnerContainer, {
|
|
163
169
|
className: className,
|
|
164
170
|
node: node
|
|
165
171
|
}, children))));
|
|
@@ -224,7 +224,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
|
|
|
224
224
|
// @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
|
|
225
225
|
if (_utils.browser.chrome && event.target) {
|
|
226
226
|
var targetClassList = event.target.classList;
|
|
227
|
-
if (targetClassList.contains(_types.TableCssClassName.CONTROLS_BUTTON) || targetClassList.contains(_types.TableCssClassName.CONTEXTUAL_MENU_BUTTON)) {
|
|
227
|
+
if (targetClassList.contains(_types.TableCssClassName.CONTROLS_BUTTON) || targetClassList.contains(_types.TableCssClassName.CONTEXTUAL_MENU_BUTTON) || targetClassList.contains(_types.TableCssClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE)) {
|
|
228
228
|
return true;
|
|
229
229
|
}
|
|
230
230
|
}
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -22,6 +22,7 @@ var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
|
22
22
|
var _layoutThreeEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-three-equal"));
|
|
23
23
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
24
24
|
var _preferences = _interopRequireDefault(require("@atlaskit/icon/glyph/preferences"));
|
|
25
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
25
26
|
var _commands = require("./commands");
|
|
26
27
|
var _commandsWithAnalytics = require("./commands-with-analytics");
|
|
27
28
|
var _pluginFactory = require("./pm-plugins/plugin-factory");
|
|
@@ -38,31 +39,44 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
38
39
|
|
|
39
40
|
var getToolbarMenuConfig = exports.getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
|
|
40
41
|
var formatMessage = _ref.formatMessage;
|
|
42
|
+
var optionItem = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') ? 'item-checkbox' : 'item';
|
|
41
43
|
var options = [{
|
|
42
44
|
id: 'editor.table.headerRow',
|
|
43
45
|
title: formatMessage(_messages.tableMessages.headerRow),
|
|
44
46
|
onClick: (0, _commandsWithAnalytics.toggleHeaderRowWithAnalytics)(editorAnalyticsAPI),
|
|
45
47
|
selected: state.isHeaderRowEnabled,
|
|
46
|
-
hidden: !config.allowHeaderRow
|
|
48
|
+
hidden: !config.allowHeaderRow,
|
|
49
|
+
domItemOptions: {
|
|
50
|
+
type: optionItem
|
|
51
|
+
}
|
|
47
52
|
}, {
|
|
48
53
|
id: 'editor.table.headerColumn',
|
|
49
54
|
title: formatMessage(_messages.tableMessages.headerColumn),
|
|
50
55
|
onClick: (0, _commandsWithAnalytics.toggleHeaderColumnWithAnalytics)(editorAnalyticsAPI),
|
|
51
56
|
selected: state.isHeaderColumnEnabled,
|
|
52
|
-
hidden: !config.allowHeaderColumn
|
|
57
|
+
hidden: !config.allowHeaderColumn,
|
|
58
|
+
domItemOptions: {
|
|
59
|
+
type: optionItem
|
|
60
|
+
}
|
|
53
61
|
}, {
|
|
54
62
|
id: 'editor.table.numberedColumn',
|
|
55
63
|
title: formatMessage(_messages.tableMessages.numberedColumn),
|
|
56
64
|
onClick: (0, _commandsWithAnalytics.toggleNumberColumnWithAnalytics)(editorAnalyticsAPI),
|
|
57
65
|
selected: state.isNumberColumnEnabled,
|
|
58
|
-
hidden: !config.allowNumberColumn
|
|
66
|
+
hidden: !config.allowNumberColumn,
|
|
67
|
+
domItemOptions: {
|
|
68
|
+
type: optionItem
|
|
69
|
+
}
|
|
59
70
|
}, {
|
|
60
71
|
id: 'editor.table.collapseTable',
|
|
61
72
|
title: formatMessage(_messages.tableMessages.collapseTable),
|
|
62
73
|
onClick: (0, _commandsWithAnalytics.wrapTableInExpandWithAnalytics)(editorAnalyticsAPI),
|
|
63
74
|
selected: !!state.isTableCollapsed,
|
|
64
75
|
disabled: !state.canCollapseTable,
|
|
65
|
-
hidden: !config.allowCollapse
|
|
76
|
+
hidden: !config.allowCollapse,
|
|
77
|
+
domItemOptions: {
|
|
78
|
+
type: optionItem
|
|
79
|
+
}
|
|
66
80
|
}];
|
|
67
81
|
if (state.isDragAndDropEnabled) {
|
|
68
82
|
return {
|
|
@@ -169,6 +169,15 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
169
169
|
alignSelf: isColumn ? 'none' : 'center',
|
|
170
170
|
zIndex: isColumn ? '-1' : 'auto'
|
|
171
171
|
},
|
|
172
|
+
onMouseUp: function onMouseUp(e) {
|
|
173
|
+
// should toggle menu if current drag menu open.
|
|
174
|
+
// 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
|
|
175
|
+
// -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
|
|
176
|
+
editorView.focus();
|
|
177
|
+
if (isDragMenuOpen) {
|
|
178
|
+
toggleDragMenu && toggleDragMenu('mouse', e);
|
|
179
|
+
}
|
|
180
|
+
},
|
|
172
181
|
onClick: onClick
|
|
173
182
|
}), /*#__PURE__*/_react.default.createElement("button", {
|
|
174
183
|
type: "button",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, useCallback, useRef, useState } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
3
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
4
5
|
import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
5
6
|
import { akEditorDefaultLayoutWidth, akEditorGutterPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
@@ -102,6 +103,9 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
102
103
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
103
104
|
}, [pluginInjectionApi]);
|
|
104
105
|
const tableWidth = getTableContainerWidth(node);
|
|
106
|
+
const {
|
|
107
|
+
editorViewModeState
|
|
108
|
+
} = useSharedPluginState(pluginInjectionApi, ['editorViewMode']);
|
|
105
109
|
|
|
106
110
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
107
111
|
const responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPadding * 2 - akEditorMediaResizeHandlerPaddingWide / 2 : containerWidth - akEditorGutterPadding * 2 - akEditorMediaResizeHandlerPaddingWide;
|
|
@@ -145,7 +149,10 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
145
149
|
},
|
|
146
150
|
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
147
151
|
ref: containerRef
|
|
148
|
-
},
|
|
152
|
+
}, (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? /*#__PURE__*/React.createElement(InnerContainer, {
|
|
153
|
+
className: className,
|
|
154
|
+
node: node
|
|
155
|
+
}, children) : /*#__PURE__*/React.createElement(TableResizer, tableResizerProps, /*#__PURE__*/React.createElement(InnerContainer, {
|
|
149
156
|
className: className,
|
|
150
157
|
node: node
|
|
151
158
|
}, children))));
|
|
@@ -217,7 +217,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
|
|
|
217
217
|
// @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
|
|
218
218
|
if (browser.chrome && event.target) {
|
|
219
219
|
const targetClassList = event.target.classList;
|
|
220
|
-
if (targetClassList.contains(ClassName.CONTROLS_BUTTON) || targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON)) {
|
|
220
|
+
if (targetClassList.contains(ClassName.CONTROLS_BUTTON) || targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON) || targetClassList.contains(ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE)) {
|
|
221
221
|
return true;
|
|
222
222
|
}
|
|
223
223
|
}
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -14,6 +14,7 @@ import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType,
|
|
|
14
14
|
import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
15
15
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
16
16
|
import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
|
|
17
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from './commands';
|
|
18
19
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, wrapTableInExpandWithAnalytics } from './commands-with-analytics';
|
|
19
20
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
@@ -27,31 +28,44 @@ import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexe
|
|
|
27
28
|
export const getToolbarMenuConfig = (config, state, {
|
|
28
29
|
formatMessage
|
|
29
30
|
}, editorAnalyticsAPI) => {
|
|
31
|
+
const optionItem = getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') ? 'item-checkbox' : 'item';
|
|
30
32
|
const options = [{
|
|
31
33
|
id: 'editor.table.headerRow',
|
|
32
34
|
title: formatMessage(messages.headerRow),
|
|
33
35
|
onClick: toggleHeaderRowWithAnalytics(editorAnalyticsAPI),
|
|
34
36
|
selected: state.isHeaderRowEnabled,
|
|
35
|
-
hidden: !config.allowHeaderRow
|
|
37
|
+
hidden: !config.allowHeaderRow,
|
|
38
|
+
domItemOptions: {
|
|
39
|
+
type: optionItem
|
|
40
|
+
}
|
|
36
41
|
}, {
|
|
37
42
|
id: 'editor.table.headerColumn',
|
|
38
43
|
title: formatMessage(messages.headerColumn),
|
|
39
44
|
onClick: toggleHeaderColumnWithAnalytics(editorAnalyticsAPI),
|
|
40
45
|
selected: state.isHeaderColumnEnabled,
|
|
41
|
-
hidden: !config.allowHeaderColumn
|
|
46
|
+
hidden: !config.allowHeaderColumn,
|
|
47
|
+
domItemOptions: {
|
|
48
|
+
type: optionItem
|
|
49
|
+
}
|
|
42
50
|
}, {
|
|
43
51
|
id: 'editor.table.numberedColumn',
|
|
44
52
|
title: formatMessage(messages.numberedColumn),
|
|
45
53
|
onClick: toggleNumberColumnWithAnalytics(editorAnalyticsAPI),
|
|
46
54
|
selected: state.isNumberColumnEnabled,
|
|
47
|
-
hidden: !config.allowNumberColumn
|
|
55
|
+
hidden: !config.allowNumberColumn,
|
|
56
|
+
domItemOptions: {
|
|
57
|
+
type: optionItem
|
|
58
|
+
}
|
|
48
59
|
}, {
|
|
49
60
|
id: 'editor.table.collapseTable',
|
|
50
61
|
title: formatMessage(messages.collapseTable),
|
|
51
62
|
onClick: wrapTableInExpandWithAnalytics(editorAnalyticsAPI),
|
|
52
63
|
selected: !!state.isTableCollapsed,
|
|
53
64
|
disabled: !state.canCollapseTable,
|
|
54
|
-
hidden: !config.allowCollapse
|
|
65
|
+
hidden: !config.allowCollapse,
|
|
66
|
+
domItemOptions: {
|
|
67
|
+
type: optionItem
|
|
68
|
+
}
|
|
55
69
|
}];
|
|
56
70
|
if (state.isDragAndDropEnabled) {
|
|
57
71
|
return {
|
|
@@ -161,6 +161,15 @@ const DragHandleComponent = ({
|
|
|
161
161
|
alignSelf: isColumn ? 'none' : 'center',
|
|
162
162
|
zIndex: isColumn ? '-1' : 'auto'
|
|
163
163
|
},
|
|
164
|
+
onMouseUp: e => {
|
|
165
|
+
// should toggle menu if current drag menu open.
|
|
166
|
+
// 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
|
|
167
|
+
// -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
|
|
168
|
+
editorView.focus();
|
|
169
|
+
if (isDragMenuOpen) {
|
|
170
|
+
toggleDragMenu && toggleDragMenu('mouse', e);
|
|
171
|
+
}
|
|
172
|
+
},
|
|
164
173
|
onClick: onClick
|
|
165
174
|
}), /*#__PURE__*/React.createElement("button", {
|
|
166
175
|
type: "button",
|
|
@@ -4,6 +4,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
4
4
|
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; }
|
|
5
5
|
import React, { forwardRef, useCallback, useRef, useState } from 'react';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
7
8
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
8
9
|
import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
9
10
|
import { akEditorDefaultLayoutWidth, akEditorGutterPadding, akEditorMediaResizeHandlerPaddingWide, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
@@ -107,6 +108,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
107
108
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
108
109
|
}, [pluginInjectionApi]);
|
|
109
110
|
var tableWidth = getTableContainerWidth(node);
|
|
111
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorViewMode']),
|
|
112
|
+
editorViewModeState = _useSharedPluginState.editorViewModeState;
|
|
110
113
|
|
|
111
114
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
112
115
|
var responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPadding * 2 - akEditorMediaResizeHandlerPaddingWide / 2 : containerWidth - akEditorGutterPadding * 2 - akEditorMediaResizeHandlerPaddingWide;
|
|
@@ -149,7 +152,10 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
|
|
|
149
152
|
},
|
|
150
153
|
className: ClassName.TABLE_RESIZER_CONTAINER,
|
|
151
154
|
ref: containerRef
|
|
152
|
-
},
|
|
155
|
+
}, (editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode) === 'view' ? /*#__PURE__*/React.createElement(InnerContainer, {
|
|
156
|
+
className: className,
|
|
157
|
+
node: node
|
|
158
|
+
}, children) : /*#__PURE__*/React.createElement(TableResizer, tableResizerProps, /*#__PURE__*/React.createElement(InnerContainer, {
|
|
153
159
|
className: className,
|
|
154
160
|
node: node
|
|
155
161
|
}, children))));
|
|
@@ -217,7 +217,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
217
217
|
// @see https://github.com/ProseMirror/prosemirror-view/commit/33fe4a8b01584f6b4103c279033dcd33e8047b95
|
|
218
218
|
if (browser.chrome && event.target) {
|
|
219
219
|
var targetClassList = event.target.classList;
|
|
220
|
-
if (targetClassList.contains(ClassName.CONTROLS_BUTTON) || targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON)) {
|
|
220
|
+
if (targetClassList.contains(ClassName.CONTROLS_BUTTON) || targetClassList.contains(ClassName.CONTEXTUAL_MENU_BUTTON) || targetClassList.contains(ClassName.DRAG_HANDLE_BUTTON_CLICKABLE_ZONE)) {
|
|
221
221
|
return true;
|
|
222
222
|
}
|
|
223
223
|
}
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -15,6 +15,7 @@ import { findCellRectClosestToPos, findTable, getSelectionRect, isSelectionType,
|
|
|
15
15
|
import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
16
16
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
17
17
|
import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
|
|
18
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
18
19
|
import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from './commands';
|
|
19
20
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, wrapTableInExpandWithAnalytics } from './commands-with-analytics';
|
|
20
21
|
import { getPluginState } from './pm-plugins/plugin-factory';
|
|
@@ -27,31 +28,44 @@ import { FullWidthDisplay } from './ui/TableFullWidthLabel';
|
|
|
27
28
|
import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes } from './utils';
|
|
28
29
|
export var getToolbarMenuConfig = function getToolbarMenuConfig(config, state, _ref, editorAnalyticsAPI) {
|
|
29
30
|
var formatMessage = _ref.formatMessage;
|
|
31
|
+
var optionItem = getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') ? 'item-checkbox' : 'item';
|
|
30
32
|
var options = [{
|
|
31
33
|
id: 'editor.table.headerRow',
|
|
32
34
|
title: formatMessage(messages.headerRow),
|
|
33
35
|
onClick: toggleHeaderRowWithAnalytics(editorAnalyticsAPI),
|
|
34
36
|
selected: state.isHeaderRowEnabled,
|
|
35
|
-
hidden: !config.allowHeaderRow
|
|
37
|
+
hidden: !config.allowHeaderRow,
|
|
38
|
+
domItemOptions: {
|
|
39
|
+
type: optionItem
|
|
40
|
+
}
|
|
36
41
|
}, {
|
|
37
42
|
id: 'editor.table.headerColumn',
|
|
38
43
|
title: formatMessage(messages.headerColumn),
|
|
39
44
|
onClick: toggleHeaderColumnWithAnalytics(editorAnalyticsAPI),
|
|
40
45
|
selected: state.isHeaderColumnEnabled,
|
|
41
|
-
hidden: !config.allowHeaderColumn
|
|
46
|
+
hidden: !config.allowHeaderColumn,
|
|
47
|
+
domItemOptions: {
|
|
48
|
+
type: optionItem
|
|
49
|
+
}
|
|
42
50
|
}, {
|
|
43
51
|
id: 'editor.table.numberedColumn',
|
|
44
52
|
title: formatMessage(messages.numberedColumn),
|
|
45
53
|
onClick: toggleNumberColumnWithAnalytics(editorAnalyticsAPI),
|
|
46
54
|
selected: state.isNumberColumnEnabled,
|
|
47
|
-
hidden: !config.allowNumberColumn
|
|
55
|
+
hidden: !config.allowNumberColumn,
|
|
56
|
+
domItemOptions: {
|
|
57
|
+
type: optionItem
|
|
58
|
+
}
|
|
48
59
|
}, {
|
|
49
60
|
id: 'editor.table.collapseTable',
|
|
50
61
|
title: formatMessage(messages.collapseTable),
|
|
51
62
|
onClick: wrapTableInExpandWithAnalytics(editorAnalyticsAPI),
|
|
52
63
|
selected: !!state.isTableCollapsed,
|
|
53
64
|
disabled: !state.canCollapseTable,
|
|
54
|
-
hidden: !config.allowCollapse
|
|
65
|
+
hidden: !config.allowCollapse,
|
|
66
|
+
domItemOptions: {
|
|
67
|
+
type: optionItem
|
|
68
|
+
}
|
|
55
69
|
}];
|
|
56
70
|
if (state.isDragAndDropEnabled) {
|
|
57
71
|
return {
|
|
@@ -159,6 +159,15 @@ var DragHandleComponent = function DragHandleComponent(_ref) {
|
|
|
159
159
|
alignSelf: isColumn ? 'none' : 'center',
|
|
160
160
|
zIndex: isColumn ? '-1' : 'auto'
|
|
161
161
|
},
|
|
162
|
+
onMouseUp: function onMouseUp(e) {
|
|
163
|
+
// should toggle menu if current drag menu open.
|
|
164
|
+
// 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
|
|
165
|
+
// -> this is bad for a11y but is the current standard new copy/paste keyboard shortcuts should be introduced instead
|
|
166
|
+
editorView.focus();
|
|
167
|
+
if (isDragMenuOpen) {
|
|
168
|
+
toggleDragMenu && toggleDragMenu('mouse', e);
|
|
169
|
+
}
|
|
170
|
+
},
|
|
162
171
|
onClick: onClick
|
|
163
172
|
}), /*#__PURE__*/React.createElement("button", {
|
|
164
173
|
type: "button",
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Command, EditorCommand, GetEditorFeatureFlags, NextEditorPlugin, O
|
|
|
4
4
|
import type { AccessibilityUtilsPlugin } from '@atlaskit/editor-plugin-accessibility-utils';
|
|
5
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
6
|
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
7
|
+
import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
|
|
7
8
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
8
9
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
9
10
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
@@ -42,7 +43,8 @@ export type TablePlugin = NextEditorPlugin<'table', {
|
|
|
42
43
|
WidthPlugin,
|
|
43
44
|
GuidelinePlugin,
|
|
44
45
|
SelectionPlugin,
|
|
45
|
-
OptionalPlugin<MediaPlugin
|
|
46
|
+
OptionalPlugin<MediaPlugin>,
|
|
47
|
+
OptionalPlugin<EditorViewModePlugin>
|
|
46
48
|
];
|
|
47
49
|
}>;
|
|
48
50
|
/**
|
|
@@ -87,7 +87,51 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
|
|
|
87
87
|
dependencies: any;
|
|
88
88
|
sharedState: any;
|
|
89
89
|
actions: any;
|
|
90
|
-
}, any
|
|
90
|
+
}, any>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
|
|
91
|
+
sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
|
|
92
|
+
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
|
|
93
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
|
|
94
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
95
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
96
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
97
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
98
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
99
|
+
sharedState: {
|
|
100
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
101
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
102
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
103
|
+
};
|
|
104
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
105
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
106
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
107
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>];
|
|
108
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
109
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
|
|
110
|
+
sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
|
|
111
|
+
actions: {
|
|
112
|
+
getAvatarColor: (str: string) => {
|
|
113
|
+
index: number;
|
|
114
|
+
color: import("@atlaskit/editor-common/collab").Color;
|
|
115
|
+
};
|
|
116
|
+
addInlineCommentMark: (props: {
|
|
117
|
+
from: number;
|
|
118
|
+
to: number;
|
|
119
|
+
mark: import("prosemirror-model").Mark;
|
|
120
|
+
}) => boolean;
|
|
121
|
+
};
|
|
122
|
+
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
123
|
+
pluginConfiguration?: {
|
|
124
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
125
|
+
} | undefined;
|
|
126
|
+
commands: {
|
|
127
|
+
updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
128
|
+
};
|
|
129
|
+
actions: {
|
|
130
|
+
applyViewModeStepAt: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
131
|
+
};
|
|
132
|
+
}, {
|
|
133
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
134
|
+
} | undefined>>];
|
|
91
135
|
}, import("../../../plugin").TablePluginOptions | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"accessibilityUtils", {
|
|
92
136
|
dependencies: [];
|
|
93
137
|
actions: {
|
|
@@ -145,6 +189,50 @@ export declare const ColumnControls: ({ editorView, tableActive, tableRef, hover
|
|
|
145
189
|
dependencies: any;
|
|
146
190
|
sharedState: any;
|
|
147
191
|
actions: any;
|
|
148
|
-
}, any
|
|
192
|
+
}, any>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
|
|
193
|
+
sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
|
|
194
|
+
dependencies: [import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"collabEdit", {
|
|
195
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions;
|
|
196
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
197
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
198
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
199
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
200
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
201
|
+
sharedState: {
|
|
202
|
+
createAnalyticsEvent: import("@atlaskit/analytics-next").CreateUIAnalyticsEvent | null;
|
|
203
|
+
attachAnalyticsEvent: import("@atlaskit/editor-plugin-analytics").CreateAttachPayloadIntoTransaction | null;
|
|
204
|
+
performanceTracking: import("@atlaskit/editor-common/types").PerformanceTracking | undefined;
|
|
205
|
+
};
|
|
206
|
+
dependencies: [import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
|
|
207
|
+
pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
208
|
+
sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
|
|
209
|
+
}, import("@atlaskit/editor-common/types").FeatureFlags>>];
|
|
210
|
+
actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
|
|
211
|
+
}, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>];
|
|
212
|
+
sharedState: import("@atlaskit/editor-plugin-collab-edit").CollabEditPluginSharedState;
|
|
213
|
+
actions: {
|
|
214
|
+
getAvatarColor: (str: string) => {
|
|
215
|
+
index: number;
|
|
216
|
+
color: import("@atlaskit/editor-common/collab").Color;
|
|
217
|
+
};
|
|
218
|
+
addInlineCommentMark: (props: {
|
|
219
|
+
from: number;
|
|
220
|
+
to: number;
|
|
221
|
+
mark: import("prosemirror-model").Mark;
|
|
222
|
+
}) => boolean;
|
|
223
|
+
};
|
|
224
|
+
}, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
|
|
225
|
+
pluginConfiguration?: {
|
|
226
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
227
|
+
} | undefined;
|
|
228
|
+
commands: {
|
|
229
|
+
updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
|
|
230
|
+
};
|
|
231
|
+
actions: {
|
|
232
|
+
applyViewModeStepAt: (tr: import("prosemirror-state").Transaction) => boolean;
|
|
233
|
+
};
|
|
234
|
+
}, {
|
|
235
|
+
mode?: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode | undefined;
|
|
236
|
+
} | undefined>>]> | undefined;
|
|
149
237
|
}) => JSX.Element;
|
|
150
238
|
export default ColumnControls;
|