@atlaskit/editor-plugin-table 2.10.6 → 2.10.8
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 +37 -0
- package/dist/cjs/plugins/table/index.js +64 -62
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +5 -5
- package/dist/es2019/plugins/table/index.js +11 -8
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +5 -5
- package/dist/esm/plugins/table/index.js +64 -62
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +5 -5
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugins/table/index.d.ts +12 -11
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/index.d.ts +12 -11
- package/package.json +4 -5
- package/report.api.md +23 -20
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +6 -8
- package/src/__tests__/unit/nodeviews/TableContainer.tsx +5 -7
- package/src/__tests__/unit/ui/FloatingDeleteButton.tsx +9 -10
- package/src/__tests__/unit/ui/FloatingInsertButton.tsx +9 -9
- package/src/index.ts +1 -0
- package/src/plugins/table/index.tsx +18 -16
- package/src/plugins/table/nodeviews/TableContainer.tsx +4 -4
- package/tmp/api-report-tmp.d.ts +20 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 2.10.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8467bdcdf4f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8467bdcdf4f) - Removing `dependencies` prop from PluginInjectionAPI and changing
|
|
8
|
+
signature of `NextEditorPlugin`.
|
|
9
|
+
|
|
10
|
+
Previously a `NextEditorPlugin` would be consumed as so:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
const plugin: NextEditorPlugin< ... > = (config, api) => {
|
|
14
|
+
// Can use api like so:
|
|
15
|
+
api.dependencies.core.actions.execute( ... )
|
|
16
|
+
return { ... }
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Now these have become named parameters like so and the `pluginInjectionAPI` is used
|
|
21
|
+
without the `dependencies` prop:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const plugin: NextEditorPlugin< ... > = ({ config, api }) => {
|
|
25
|
+
// Can use api like so:
|
|
26
|
+
api.core.actions.execute( ... )
|
|
27
|
+
return { ... }
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
33
|
+
## 2.10.7
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- [`24e27147cbd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24e27147cbd) - Added atlaskit docs to all existing plugins.
|
|
38
|
+
- Updated dependencies
|
|
39
|
+
|
|
3
40
|
## 2.10.6
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
|
@@ -38,29 +38,31 @@ var _utils3 = require("./utils");
|
|
|
38
38
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
39
39
|
return {};
|
|
40
40
|
};
|
|
41
|
-
var tablesPlugin = function tablesPlugin(
|
|
42
|
-
var _api$
|
|
41
|
+
var tablesPlugin = function tablesPlugin(_ref) {
|
|
42
|
+
var _api$analytics;
|
|
43
|
+
var options = _ref.config,
|
|
44
|
+
api = _ref.api;
|
|
43
45
|
var editorViewRef = {
|
|
44
46
|
current: null
|
|
45
47
|
};
|
|
46
48
|
var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
|
|
47
|
-
var _document$body$offset, _document, _document$body, _api$
|
|
49
|
+
var _document$body$offset, _document, _document$body, _api$width$sharedStat;
|
|
48
50
|
var defaultState = {
|
|
49
51
|
width: (_document$body$offset = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
|
|
50
52
|
};
|
|
51
|
-
return (_api$
|
|
53
|
+
return (_api$width$sharedStat = api === null || api === void 0 ? void 0 : api.width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : defaultState;
|
|
52
54
|
};
|
|
53
|
-
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$
|
|
55
|
+
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
54
56
|
return {
|
|
55
57
|
name: 'table',
|
|
56
58
|
actions: {
|
|
57
59
|
insertTable: function insertTable(analyticsPayload) {
|
|
58
60
|
return function (state, dispatch) {
|
|
59
|
-
var _api$
|
|
61
|
+
var _api$contentInsertion, _api$contentInsertion2, _api$contentInsertion3;
|
|
60
62
|
var node = (0, _utils2.createTable)({
|
|
61
63
|
schema: state.schema
|
|
62
64
|
});
|
|
63
|
-
return (_api$
|
|
65
|
+
return (_api$contentInsertion = api === null || api === void 0 ? void 0 : (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 ? void 0 : (_api$contentInsertion3 = _api$contentInsertion2.actions) === null || _api$contentInsertion3 === void 0 ? void 0 : _api$contentInsertion3.insert({
|
|
64
66
|
state: state,
|
|
65
67
|
dispatch: dispatch,
|
|
66
68
|
node: node,
|
|
@@ -68,7 +70,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
68
70
|
selectNodeInserted: false,
|
|
69
71
|
analyticsPayload: analyticsPayload
|
|
70
72
|
}
|
|
71
|
-
})) !== null && _api$
|
|
73
|
+
})) !== null && _api$contentInsertion !== void 0 ? _api$contentInsertion : false;
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
76
|
},
|
|
@@ -91,28 +93,28 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
91
93
|
pmPlugins: function pmPlugins() {
|
|
92
94
|
var plugins = [{
|
|
93
95
|
name: 'table',
|
|
94
|
-
plugin: function plugin(
|
|
95
|
-
var dispatchAnalyticsEvent =
|
|
96
|
-
dispatch =
|
|
97
|
-
portalProviderAPI =
|
|
98
|
-
eventDispatcher =
|
|
99
|
-
var
|
|
100
|
-
fullWidthEnabled =
|
|
101
|
-
wasFullWidthEnabled =
|
|
102
|
-
tableResizingEnabled =
|
|
103
|
-
breakoutEnabled =
|
|
104
|
-
tableOptions =
|
|
105
|
-
getEditorFeatureFlags =
|
|
96
|
+
plugin: function plugin(_ref2) {
|
|
97
|
+
var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
98
|
+
dispatch = _ref2.dispatch,
|
|
99
|
+
portalProviderAPI = _ref2.portalProviderAPI,
|
|
100
|
+
eventDispatcher = _ref2.eventDispatcher;
|
|
101
|
+
var _ref3 = options || {},
|
|
102
|
+
fullWidthEnabled = _ref3.fullWidthEnabled,
|
|
103
|
+
wasFullWidthEnabled = _ref3.wasFullWidthEnabled,
|
|
104
|
+
tableResizingEnabled = _ref3.tableResizingEnabled,
|
|
105
|
+
breakoutEnabled = _ref3.breakoutEnabled,
|
|
106
|
+
tableOptions = _ref3.tableOptions,
|
|
107
|
+
getEditorFeatureFlags = _ref3.getEditorFeatureFlags;
|
|
106
108
|
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
|
|
107
109
|
}
|
|
108
110
|
}, {
|
|
109
111
|
name: 'tablePMColResizing',
|
|
110
|
-
plugin: function plugin(
|
|
111
|
-
var dispatch =
|
|
112
|
-
var
|
|
113
|
-
fullWidthEnabled =
|
|
114
|
-
tableOptions =
|
|
115
|
-
getEditorFeatureFlags =
|
|
112
|
+
plugin: function plugin(_ref4) {
|
|
113
|
+
var dispatch = _ref4.dispatch;
|
|
114
|
+
var _ref5 = options || {},
|
|
115
|
+
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
116
|
+
tableOptions = _ref5.tableOptions,
|
|
117
|
+
getEditorFeatureFlags = _ref5.getEditorFeatureFlags;
|
|
116
118
|
var _pluginConfig = (0, _createPluginConfig.pluginConfig)(tableOptions),
|
|
117
119
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
118
120
|
return allowColumnResizing ? (0, _tableResizing.createPlugin)(dispatch, {
|
|
@@ -141,9 +143,9 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
141
143
|
name: 'tableEditing',
|
|
142
144
|
plugin: function plugin() {
|
|
143
145
|
return (0, _pmPlugins.tableEditing)({
|
|
144
|
-
reportFixedTable: function reportFixedTable(
|
|
145
|
-
var tr =
|
|
146
|
-
reason =
|
|
146
|
+
reportFixedTable: function reportFixedTable(_ref6) {
|
|
147
|
+
var tr = _ref6.tr,
|
|
148
|
+
reason = _ref6.reason;
|
|
147
149
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
148
150
|
action: _analytics.TABLE_ACTION.FIXED,
|
|
149
151
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
@@ -158,24 +160,24 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
158
160
|
}
|
|
159
161
|
}, {
|
|
160
162
|
name: 'tableStickyHeaders',
|
|
161
|
-
plugin: function plugin(
|
|
162
|
-
var dispatch =
|
|
163
|
-
eventDispatcher =
|
|
163
|
+
plugin: function plugin(_ref7) {
|
|
164
|
+
var dispatch = _ref7.dispatch,
|
|
165
|
+
eventDispatcher = _ref7.eventDispatcher;
|
|
164
166
|
return options && options.tableOptions.stickyHeaders ? (0, _stickyHeaders.createPlugin)(dispatch, eventDispatcher, function () {
|
|
165
167
|
return [];
|
|
166
168
|
}, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined;
|
|
167
169
|
}
|
|
168
170
|
}, {
|
|
169
171
|
name: 'tableLocalId',
|
|
170
|
-
plugin: function plugin(
|
|
171
|
-
var dispatch =
|
|
172
|
+
plugin: function plugin(_ref8) {
|
|
173
|
+
var dispatch = _ref8.dispatch;
|
|
172
174
|
return (0, _tableLocalId.createPlugin)(dispatch);
|
|
173
175
|
}
|
|
174
176
|
}, {
|
|
175
177
|
name: 'tableWidth',
|
|
176
|
-
plugin: function plugin(
|
|
178
|
+
plugin: function plugin(_ref9) {
|
|
177
179
|
var _options$fullWidthEna;
|
|
178
|
-
var dispatch =
|
|
180
|
+
var dispatch = _ref9.dispatch;
|
|
179
181
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? (0, _tableWidth.createPlugin)(dispatch, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
180
182
|
}
|
|
181
183
|
}, {
|
|
@@ -206,12 +208,12 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
206
208
|
}
|
|
207
209
|
return plugins;
|
|
208
210
|
},
|
|
209
|
-
contentComponent: function contentComponent(
|
|
210
|
-
var editorView =
|
|
211
|
-
popupsMountPoint =
|
|
212
|
-
popupsBoundariesElement =
|
|
213
|
-
popupsScrollableElement =
|
|
214
|
-
dispatchAnalyticsEvent =
|
|
211
|
+
contentComponent: function contentComponent(_ref10) {
|
|
212
|
+
var editorView = _ref10.editorView,
|
|
213
|
+
popupsMountPoint = _ref10.popupsMountPoint,
|
|
214
|
+
popupsBoundariesElement = _ref10.popupsBoundariesElement,
|
|
215
|
+
popupsScrollableElement = _ref10.popupsScrollableElement,
|
|
216
|
+
dispatchAnalyticsEvent = _ref10.dispatchAnalyticsEvent;
|
|
215
217
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.ErrorBoundary, {
|
|
216
218
|
component: _analytics.ACTION_SUBJECT.TABLES_PLUGIN,
|
|
217
219
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -223,28 +225,28 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
223
225
|
tableResizingPluginState: _tableResizing.pluginKey,
|
|
224
226
|
stickyHeadersState: _stickyHeaders.pluginKey
|
|
225
227
|
},
|
|
226
|
-
render: function render(
|
|
227
|
-
var resizingPluginState =
|
|
228
|
-
stickyHeadersState =
|
|
229
|
-
tablePluginState =
|
|
230
|
-
tableWidthPluginState =
|
|
228
|
+
render: function render(_ref11) {
|
|
229
|
+
var resizingPluginState = _ref11.tableResizingPluginState,
|
|
230
|
+
stickyHeadersState = _ref11.stickyHeadersState,
|
|
231
|
+
tablePluginState = _ref11.tablePluginState,
|
|
232
|
+
tableWidthPluginState = _ref11.tableWidthPluginState;
|
|
231
233
|
var state = editorView.state;
|
|
232
234
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
233
235
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
234
236
|
var isResizing = isColumnResizing || isTableResizing;
|
|
235
|
-
var
|
|
236
|
-
tableNode =
|
|
237
|
-
tablePos =
|
|
238
|
-
targetCellPosition =
|
|
239
|
-
isContextualMenuOpen =
|
|
240
|
-
layout =
|
|
241
|
-
tableRef =
|
|
242
|
-
pluginConfig =
|
|
243
|
-
insertColumnButtonIndex =
|
|
244
|
-
insertRowButtonIndex =
|
|
245
|
-
isHeaderColumnEnabled =
|
|
246
|
-
isHeaderRowEnabled =
|
|
247
|
-
tableWrapperTarget =
|
|
237
|
+
var _ref12 = tablePluginState,
|
|
238
|
+
tableNode = _ref12.tableNode,
|
|
239
|
+
tablePos = _ref12.tablePos,
|
|
240
|
+
targetCellPosition = _ref12.targetCellPosition,
|
|
241
|
+
isContextualMenuOpen = _ref12.isContextualMenuOpen,
|
|
242
|
+
layout = _ref12.layout,
|
|
243
|
+
tableRef = _ref12.tableRef,
|
|
244
|
+
pluginConfig = _ref12.pluginConfig,
|
|
245
|
+
insertColumnButtonIndex = _ref12.insertColumnButtonIndex,
|
|
246
|
+
insertRowButtonIndex = _ref12.insertRowButtonIndex,
|
|
247
|
+
isHeaderColumnEnabled = _ref12.isHeaderColumnEnabled,
|
|
248
|
+
isHeaderRowEnabled = _ref12.isHeaderRowEnabled,
|
|
249
|
+
tableWrapperTarget = _ref12.tableWrapperTarget;
|
|
248
250
|
var allowControls = pluginConfig.allowControls;
|
|
249
251
|
var stickyHeader = stickyHeadersState ? (0, _stickyHeaders.findStickyHeaderForTable)(stickyHeadersState, tablePos) : undefined;
|
|
250
252
|
var LayoutContent = options && !options.tableResizingEnabled && (0, _utils3.isLayoutSupported)(state) && options.breakoutEnabled ? /*#__PURE__*/_react.default.createElement(_LayoutButton.default, {
|
|
@@ -310,8 +312,8 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
310
312
|
}));
|
|
311
313
|
},
|
|
312
314
|
pluginsOptions: {
|
|
313
|
-
quickInsert: function quickInsert(
|
|
314
|
-
var formatMessage =
|
|
315
|
+
quickInsert: function quickInsert(_ref13) {
|
|
316
|
+
var formatMessage = _ref13.formatMessage;
|
|
315
317
|
return [{
|
|
316
318
|
id: 'table',
|
|
317
319
|
title: formatMessage(_messages.toolbarInsertBlockMessages.table),
|
|
@@ -76,14 +76,14 @@ var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
76
76
|
}
|
|
77
77
|
}, [lineLength]);
|
|
78
78
|
var displayGuideline = (0, _react.useCallback)(function (guidelines) {
|
|
79
|
-
var _pluginInjectionApi$
|
|
80
|
-
return (_pluginInjectionApi$
|
|
79
|
+
var _pluginInjectionApi$g, _pluginInjectionApi$g2, _pluginInjectionApi$g3;
|
|
80
|
+
return (_pluginInjectionApi$g = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g2 = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g2 === void 0 ? void 0 : (_pluginInjectionApi$g3 = _pluginInjectionApi$g2.actions) === null || _pluginInjectionApi$g3 === void 0 ? void 0 : _pluginInjectionApi$g3.displayGuideline(editorView)({
|
|
81
81
|
guidelines: guidelines
|
|
82
|
-
})) !== null && _pluginInjectionApi$
|
|
82
|
+
})) !== null && _pluginInjectionApi$g !== void 0 ? _pluginInjectionApi$g : false;
|
|
83
83
|
}, [pluginInjectionApi, editorView]);
|
|
84
84
|
var attachAnalyticsEvent = (0, _react.useCallback)(function (payload) {
|
|
85
|
-
var _pluginInjectionApi$
|
|
86
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
85
|
+
var _pluginInjectionApi$a;
|
|
86
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent(payload);
|
|
87
87
|
}, [pluginInjectionApi]);
|
|
88
88
|
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
89
89
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
@@ -29,28 +29,31 @@ import FloatingInsertButton from './ui/FloatingInsertButton';
|
|
|
29
29
|
import LayoutButton from './ui/LayoutButton';
|
|
30
30
|
import { isLayoutSupported } from './utils';
|
|
31
31
|
const defaultGetEditorFeatureFlags = () => ({});
|
|
32
|
-
const tablesPlugin = (
|
|
33
|
-
|
|
32
|
+
const tablesPlugin = ({
|
|
33
|
+
config: options,
|
|
34
|
+
api
|
|
35
|
+
}) => {
|
|
36
|
+
var _api$analytics;
|
|
34
37
|
const editorViewRef = {
|
|
35
38
|
current: null
|
|
36
39
|
};
|
|
37
40
|
const defaultGetEditorContainerWidth = () => {
|
|
38
|
-
var _document$body$offset, _document, _document$body, _api$
|
|
41
|
+
var _document$body$offset, _document, _document$body, _api$width$sharedStat;
|
|
39
42
|
const defaultState = {
|
|
40
43
|
width: (_document$body$offset = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
|
|
41
44
|
};
|
|
42
|
-
return (_api$
|
|
45
|
+
return (_api$width$sharedStat = api === null || api === void 0 ? void 0 : api.width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : defaultState;
|
|
43
46
|
};
|
|
44
|
-
const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$
|
|
47
|
+
const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
45
48
|
return {
|
|
46
49
|
name: 'table',
|
|
47
50
|
actions: {
|
|
48
51
|
insertTable: analyticsPayload => (state, dispatch) => {
|
|
49
|
-
var _api$
|
|
52
|
+
var _api$contentInsertion, _api$contentInsertion2, _api$contentInsertion3;
|
|
50
53
|
const node = createTable({
|
|
51
54
|
schema: state.schema
|
|
52
55
|
});
|
|
53
|
-
return (_api$
|
|
56
|
+
return (_api$contentInsertion = api === null || api === void 0 ? void 0 : (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 ? void 0 : (_api$contentInsertion3 = _api$contentInsertion2.actions) === null || _api$contentInsertion3 === void 0 ? void 0 : _api$contentInsertion3.insert({
|
|
54
57
|
state,
|
|
55
58
|
dispatch,
|
|
56
59
|
node,
|
|
@@ -58,7 +61,7 @@ const tablesPlugin = (options, api) => {
|
|
|
58
61
|
selectNodeInserted: false,
|
|
59
62
|
analyticsPayload
|
|
60
63
|
}
|
|
61
|
-
})) !== null && _api$
|
|
64
|
+
})) !== null && _api$contentInsertion !== void 0 ? _api$contentInsertion : false;
|
|
62
65
|
}
|
|
63
66
|
},
|
|
64
67
|
nodes() {
|
|
@@ -67,14 +67,14 @@ export const ResizableTableContainer = ({
|
|
|
67
67
|
}
|
|
68
68
|
}, [lineLength]);
|
|
69
69
|
const displayGuideline = useCallback(guidelines => {
|
|
70
|
-
var _pluginInjectionApi$
|
|
71
|
-
return (_pluginInjectionApi$
|
|
70
|
+
var _pluginInjectionApi$g, _pluginInjectionApi$g2, _pluginInjectionApi$g3;
|
|
71
|
+
return (_pluginInjectionApi$g = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g2 = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g2 === void 0 ? void 0 : (_pluginInjectionApi$g3 = _pluginInjectionApi$g2.actions) === null || _pluginInjectionApi$g3 === void 0 ? void 0 : _pluginInjectionApi$g3.displayGuideline(editorView)({
|
|
72
72
|
guidelines
|
|
73
|
-
})) !== null && _pluginInjectionApi$
|
|
73
|
+
})) !== null && _pluginInjectionApi$g !== void 0 ? _pluginInjectionApi$g : false;
|
|
74
74
|
}, [pluginInjectionApi, editorView]);
|
|
75
75
|
const attachAnalyticsEvent = useCallback(payload => {
|
|
76
|
-
var _pluginInjectionApi$
|
|
77
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
76
|
+
var _pluginInjectionApi$a;
|
|
77
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent(payload);
|
|
78
78
|
}, [pluginInjectionApi]);
|
|
79
79
|
const tableWidth = getTableContainerWidth(node);
|
|
80
80
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
@@ -31,29 +31,31 @@ import { isLayoutSupported } from './utils';
|
|
|
31
31
|
var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
32
32
|
return {};
|
|
33
33
|
};
|
|
34
|
-
var tablesPlugin = function tablesPlugin(
|
|
35
|
-
var _api$
|
|
34
|
+
var tablesPlugin = function tablesPlugin(_ref) {
|
|
35
|
+
var _api$analytics;
|
|
36
|
+
var options = _ref.config,
|
|
37
|
+
api = _ref.api;
|
|
36
38
|
var editorViewRef = {
|
|
37
39
|
current: null
|
|
38
40
|
};
|
|
39
41
|
var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
|
|
40
|
-
var _document$body$offset, _document, _document$body, _api$
|
|
42
|
+
var _document$body$offset, _document, _document$body, _api$width$sharedStat;
|
|
41
43
|
var defaultState = {
|
|
42
44
|
width: (_document$body$offset = (_document = document) === null || _document === void 0 ? void 0 : (_document$body = _document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
|
|
43
45
|
};
|
|
44
|
-
return (_api$
|
|
46
|
+
return (_api$width$sharedStat = api === null || api === void 0 ? void 0 : api.width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : defaultState;
|
|
45
47
|
};
|
|
46
|
-
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$
|
|
48
|
+
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
47
49
|
return {
|
|
48
50
|
name: 'table',
|
|
49
51
|
actions: {
|
|
50
52
|
insertTable: function insertTable(analyticsPayload) {
|
|
51
53
|
return function (state, dispatch) {
|
|
52
|
-
var _api$
|
|
54
|
+
var _api$contentInsertion, _api$contentInsertion2, _api$contentInsertion3;
|
|
53
55
|
var node = createTable({
|
|
54
56
|
schema: state.schema
|
|
55
57
|
});
|
|
56
|
-
return (_api$
|
|
58
|
+
return (_api$contentInsertion = api === null || api === void 0 ? void 0 : (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 ? void 0 : (_api$contentInsertion3 = _api$contentInsertion2.actions) === null || _api$contentInsertion3 === void 0 ? void 0 : _api$contentInsertion3.insert({
|
|
57
59
|
state: state,
|
|
58
60
|
dispatch: dispatch,
|
|
59
61
|
node: node,
|
|
@@ -61,7 +63,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
61
63
|
selectNodeInserted: false,
|
|
62
64
|
analyticsPayload: analyticsPayload
|
|
63
65
|
}
|
|
64
|
-
})) !== null && _api$
|
|
66
|
+
})) !== null && _api$contentInsertion !== void 0 ? _api$contentInsertion : false;
|
|
65
67
|
};
|
|
66
68
|
}
|
|
67
69
|
},
|
|
@@ -84,28 +86,28 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
84
86
|
pmPlugins: function pmPlugins() {
|
|
85
87
|
var plugins = [{
|
|
86
88
|
name: 'table',
|
|
87
|
-
plugin: function plugin(
|
|
88
|
-
var dispatchAnalyticsEvent =
|
|
89
|
-
dispatch =
|
|
90
|
-
portalProviderAPI =
|
|
91
|
-
eventDispatcher =
|
|
92
|
-
var
|
|
93
|
-
fullWidthEnabled =
|
|
94
|
-
wasFullWidthEnabled =
|
|
95
|
-
tableResizingEnabled =
|
|
96
|
-
breakoutEnabled =
|
|
97
|
-
tableOptions =
|
|
98
|
-
getEditorFeatureFlags =
|
|
89
|
+
plugin: function plugin(_ref2) {
|
|
90
|
+
var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
91
|
+
dispatch = _ref2.dispatch,
|
|
92
|
+
portalProviderAPI = _ref2.portalProviderAPI,
|
|
93
|
+
eventDispatcher = _ref2.eventDispatcher;
|
|
94
|
+
var _ref3 = options || {},
|
|
95
|
+
fullWidthEnabled = _ref3.fullWidthEnabled,
|
|
96
|
+
wasFullWidthEnabled = _ref3.wasFullWidthEnabled,
|
|
97
|
+
tableResizingEnabled = _ref3.tableResizingEnabled,
|
|
98
|
+
breakoutEnabled = _ref3.breakoutEnabled,
|
|
99
|
+
tableOptions = _ref3.tableOptions,
|
|
100
|
+
getEditorFeatureFlags = _ref3.getEditorFeatureFlags;
|
|
99
101
|
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
|
|
100
102
|
}
|
|
101
103
|
}, {
|
|
102
104
|
name: 'tablePMColResizing',
|
|
103
|
-
plugin: function plugin(
|
|
104
|
-
var dispatch =
|
|
105
|
-
var
|
|
106
|
-
fullWidthEnabled =
|
|
107
|
-
tableOptions =
|
|
108
|
-
getEditorFeatureFlags =
|
|
105
|
+
plugin: function plugin(_ref4) {
|
|
106
|
+
var dispatch = _ref4.dispatch;
|
|
107
|
+
var _ref5 = options || {},
|
|
108
|
+
fullWidthEnabled = _ref5.fullWidthEnabled,
|
|
109
|
+
tableOptions = _ref5.tableOptions,
|
|
110
|
+
getEditorFeatureFlags = _ref5.getEditorFeatureFlags;
|
|
109
111
|
var _pluginConfig = pluginConfig(tableOptions),
|
|
110
112
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
111
113
|
return allowColumnResizing ? createFlexiResizingPlugin(dispatch, {
|
|
@@ -134,9 +136,9 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
134
136
|
name: 'tableEditing',
|
|
135
137
|
plugin: function plugin() {
|
|
136
138
|
return tableEditing({
|
|
137
|
-
reportFixedTable: function reportFixedTable(
|
|
138
|
-
var tr =
|
|
139
|
-
reason =
|
|
139
|
+
reportFixedTable: function reportFixedTable(_ref6) {
|
|
140
|
+
var tr = _ref6.tr,
|
|
141
|
+
reason = _ref6.reason;
|
|
140
142
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
141
143
|
action: TABLE_ACTION.FIXED,
|
|
142
144
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
@@ -151,24 +153,24 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
151
153
|
}
|
|
152
154
|
}, {
|
|
153
155
|
name: 'tableStickyHeaders',
|
|
154
|
-
plugin: function plugin(
|
|
155
|
-
var dispatch =
|
|
156
|
-
eventDispatcher =
|
|
156
|
+
plugin: function plugin(_ref7) {
|
|
157
|
+
var dispatch = _ref7.dispatch,
|
|
158
|
+
eventDispatcher = _ref7.eventDispatcher;
|
|
157
159
|
return options && options.tableOptions.stickyHeaders ? createStickyHeadersPlugin(dispatch, eventDispatcher, function () {
|
|
158
160
|
return [];
|
|
159
161
|
}, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags) : undefined;
|
|
160
162
|
}
|
|
161
163
|
}, {
|
|
162
164
|
name: 'tableLocalId',
|
|
163
|
-
plugin: function plugin(
|
|
164
|
-
var dispatch =
|
|
165
|
+
plugin: function plugin(_ref8) {
|
|
166
|
+
var dispatch = _ref8.dispatch;
|
|
165
167
|
return createTableLocalIdPlugin(dispatch);
|
|
166
168
|
}
|
|
167
169
|
}, {
|
|
168
170
|
name: 'tableWidth',
|
|
169
|
-
plugin: function plugin(
|
|
171
|
+
plugin: function plugin(_ref9) {
|
|
170
172
|
var _options$fullWidthEna;
|
|
171
|
-
var dispatch =
|
|
173
|
+
var dispatch = _ref9.dispatch;
|
|
172
174
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
173
175
|
}
|
|
174
176
|
}, {
|
|
@@ -199,12 +201,12 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
199
201
|
}
|
|
200
202
|
return plugins;
|
|
201
203
|
},
|
|
202
|
-
contentComponent: function contentComponent(
|
|
203
|
-
var editorView =
|
|
204
|
-
popupsMountPoint =
|
|
205
|
-
popupsBoundariesElement =
|
|
206
|
-
popupsScrollableElement =
|
|
207
|
-
dispatchAnalyticsEvent =
|
|
204
|
+
contentComponent: function contentComponent(_ref10) {
|
|
205
|
+
var editorView = _ref10.editorView,
|
|
206
|
+
popupsMountPoint = _ref10.popupsMountPoint,
|
|
207
|
+
popupsBoundariesElement = _ref10.popupsBoundariesElement,
|
|
208
|
+
popupsScrollableElement = _ref10.popupsScrollableElement,
|
|
209
|
+
dispatchAnalyticsEvent = _ref10.dispatchAnalyticsEvent;
|
|
208
210
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
209
211
|
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
210
212
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -216,28 +218,28 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
216
218
|
tableResizingPluginState: tableResizingPluginKey,
|
|
217
219
|
stickyHeadersState: stickyHeadersPluginKey
|
|
218
220
|
},
|
|
219
|
-
render: function render(
|
|
220
|
-
var resizingPluginState =
|
|
221
|
-
stickyHeadersState =
|
|
222
|
-
tablePluginState =
|
|
223
|
-
tableWidthPluginState =
|
|
221
|
+
render: function render(_ref11) {
|
|
222
|
+
var resizingPluginState = _ref11.tableResizingPluginState,
|
|
223
|
+
stickyHeadersState = _ref11.stickyHeadersState,
|
|
224
|
+
tablePluginState = _ref11.tablePluginState,
|
|
225
|
+
tableWidthPluginState = _ref11.tableWidthPluginState;
|
|
224
226
|
var state = editorView.state;
|
|
225
227
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
226
228
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
227
229
|
var isResizing = isColumnResizing || isTableResizing;
|
|
228
|
-
var
|
|
229
|
-
tableNode =
|
|
230
|
-
tablePos =
|
|
231
|
-
targetCellPosition =
|
|
232
|
-
isContextualMenuOpen =
|
|
233
|
-
layout =
|
|
234
|
-
tableRef =
|
|
235
|
-
pluginConfig =
|
|
236
|
-
insertColumnButtonIndex =
|
|
237
|
-
insertRowButtonIndex =
|
|
238
|
-
isHeaderColumnEnabled =
|
|
239
|
-
isHeaderRowEnabled =
|
|
240
|
-
tableWrapperTarget =
|
|
230
|
+
var _ref12 = tablePluginState,
|
|
231
|
+
tableNode = _ref12.tableNode,
|
|
232
|
+
tablePos = _ref12.tablePos,
|
|
233
|
+
targetCellPosition = _ref12.targetCellPosition,
|
|
234
|
+
isContextualMenuOpen = _ref12.isContextualMenuOpen,
|
|
235
|
+
layout = _ref12.layout,
|
|
236
|
+
tableRef = _ref12.tableRef,
|
|
237
|
+
pluginConfig = _ref12.pluginConfig,
|
|
238
|
+
insertColumnButtonIndex = _ref12.insertColumnButtonIndex,
|
|
239
|
+
insertRowButtonIndex = _ref12.insertRowButtonIndex,
|
|
240
|
+
isHeaderColumnEnabled = _ref12.isHeaderColumnEnabled,
|
|
241
|
+
isHeaderRowEnabled = _ref12.isHeaderRowEnabled,
|
|
242
|
+
tableWrapperTarget = _ref12.tableWrapperTarget;
|
|
241
243
|
var allowControls = pluginConfig.allowControls;
|
|
242
244
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
243
245
|
var LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
|
|
@@ -303,8 +305,8 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
303
305
|
}));
|
|
304
306
|
},
|
|
305
307
|
pluginsOptions: {
|
|
306
|
-
quickInsert: function quickInsert(
|
|
307
|
-
var formatMessage =
|
|
308
|
+
quickInsert: function quickInsert(_ref13) {
|
|
309
|
+
var formatMessage = _ref13.formatMessage;
|
|
308
310
|
return [{
|
|
309
311
|
id: 'table',
|
|
310
312
|
title: formatMessage(messages.table),
|
|
@@ -65,14 +65,14 @@ export var ResizableTableContainer = function ResizableTableContainer(_ref2) {
|
|
|
65
65
|
}
|
|
66
66
|
}, [lineLength]);
|
|
67
67
|
var displayGuideline = useCallback(function (guidelines) {
|
|
68
|
-
var _pluginInjectionApi$
|
|
69
|
-
return (_pluginInjectionApi$
|
|
68
|
+
var _pluginInjectionApi$g, _pluginInjectionApi$g2, _pluginInjectionApi$g3;
|
|
69
|
+
return (_pluginInjectionApi$g = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$g2 = pluginInjectionApi.guideline) === null || _pluginInjectionApi$g2 === void 0 ? void 0 : (_pluginInjectionApi$g3 = _pluginInjectionApi$g2.actions) === null || _pluginInjectionApi$g3 === void 0 ? void 0 : _pluginInjectionApi$g3.displayGuideline(editorView)({
|
|
70
70
|
guidelines: guidelines
|
|
71
|
-
})) !== null && _pluginInjectionApi$
|
|
71
|
+
})) !== null && _pluginInjectionApi$g !== void 0 ? _pluginInjectionApi$g : false;
|
|
72
72
|
}, [pluginInjectionApi, editorView]);
|
|
73
73
|
var attachAnalyticsEvent = useCallback(function (payload) {
|
|
74
|
-
var _pluginInjectionApi$
|
|
75
|
-
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$
|
|
74
|
+
var _pluginInjectionApi$a;
|
|
75
|
+
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent(payload);
|
|
76
76
|
}, [pluginInjectionApi]);
|
|
77
77
|
var tableWidth = getTableContainerWidth(node);
|
|
78
78
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
3
3
|
import type { Command, GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import { PluginConfig } from './types';
|
|
4
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
+
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
7
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
|
+
import type { PluginConfig } from './types';
|
|
9
9
|
interface TablePluginOptions {
|
|
10
10
|
tableOptions: PluginConfig;
|
|
11
11
|
tableResizingEnabled?: boolean;
|
|
@@ -17,16 +17,17 @@ interface TablePluginOptions {
|
|
|
17
17
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
18
18
|
}
|
|
19
19
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
20
|
-
|
|
20
|
+
export type TablePlugin = NextEditorPlugin<'table', {
|
|
21
21
|
pluginConfiguration: TablePluginOptions | undefined;
|
|
22
22
|
actions: {
|
|
23
23
|
insertTable: InsertTableAction;
|
|
24
24
|
};
|
|
25
25
|
dependencies: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
AnalyticsPlugin,
|
|
27
|
+
ContentInsertionPlugin,
|
|
28
|
+
WidthPlugin,
|
|
29
|
+
GuidelinePlugin
|
|
30
30
|
];
|
|
31
31
|
}>;
|
|
32
|
+
declare const tablesPlugin: TablePlugin;
|
|
32
33
|
export default tablesPlugin;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
3
3
|
import type { Command, GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import { PluginConfig } from './types';
|
|
4
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
|
+
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
6
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
7
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
|
+
import type { PluginConfig } from './types';
|
|
9
9
|
interface TablePluginOptions {
|
|
10
10
|
tableOptions: PluginConfig;
|
|
11
11
|
tableResizingEnabled?: boolean;
|
|
@@ -17,16 +17,17 @@ interface TablePluginOptions {
|
|
|
17
17
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
18
18
|
}
|
|
19
19
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
20
|
-
|
|
20
|
+
export type TablePlugin = NextEditorPlugin<'table', {
|
|
21
21
|
pluginConfiguration: TablePluginOptions | undefined;
|
|
22
22
|
actions: {
|
|
23
23
|
insertTable: InsertTableAction;
|
|
24
24
|
};
|
|
25
25
|
dependencies: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
AnalyticsPlugin,
|
|
27
|
+
ContentInsertionPlugin,
|
|
28
|
+
WidthPlugin,
|
|
29
|
+
GuidelinePlugin
|
|
30
30
|
];
|
|
31
31
|
}>;
|
|
32
|
+
declare const tablesPlugin: TablePlugin;
|
|
32
33
|
export default tablesPlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.8",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -28,17 +28,17 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "28.1.2",
|
|
31
|
-
"@atlaskit/editor-common": "^74.
|
|
31
|
+
"@atlaskit/editor-common": "^74.53.0",
|
|
32
32
|
"@atlaskit/editor-palette": "1.5.1",
|
|
33
33
|
"@atlaskit/editor-plugin-analytics": "^0.1.0",
|
|
34
|
-
"@atlaskit/editor-plugin-content-insertion": "^0.0.
|
|
34
|
+
"@atlaskit/editor-plugin-content-insertion": "^0.0.11",
|
|
35
35
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
36
36
|
"@atlaskit/editor-shared-styles": "^2.6.0",
|
|
37
37
|
"@atlaskit/editor-tables": "^2.3.0",
|
|
38
38
|
"@atlaskit/icon": "^21.12.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
40
40
|
"@atlaskit/theme": "^12.5.0",
|
|
41
|
-
"@atlaskit/tokens": "^1.
|
|
41
|
+
"@atlaskit/tokens": "^1.17.0",
|
|
42
42
|
"@atlaskit/tooltip": "^17.8.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"@emotion/react": "^11.7.1",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"@atlaskit/editor-plugin-guideline": "^0.4.0",
|
|
62
62
|
"@atlaskit/editor-plugin-hyperlink": "^0.3.0",
|
|
63
63
|
"@atlaskit/editor-plugin-width": "^0.1.0",
|
|
64
|
-
"@atlaskit/editor-test-helpers": "^18.11.0",
|
|
65
64
|
"@atlaskit/visual-regression": "*",
|
|
66
65
|
"@atlaskit/webdriver-runner": "*",
|
|
67
66
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
package/report.api.md
CHANGED
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
<!--SECTION START: Main Entry Types-->
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
19
|
-
import type {
|
|
18
|
+
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
19
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
20
20
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
21
|
-
import type {
|
|
21
|
+
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
22
22
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
23
23
|
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
24
|
-
import type {
|
|
24
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
25
25
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
26
26
|
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
27
|
-
import type {
|
|
27
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
28
28
|
|
|
29
29
|
// @public (undocumented)
|
|
30
30
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
@@ -80,6 +80,23 @@ interface PluginConfig {
|
|
|
80
80
|
tableRenderOptimization?: boolean;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
// @public (undocumented)
|
|
84
|
+
export type TablePlugin = NextEditorPlugin<
|
|
85
|
+
'table',
|
|
86
|
+
{
|
|
87
|
+
pluginConfiguration: TablePluginOptions | undefined;
|
|
88
|
+
actions: {
|
|
89
|
+
insertTable: InsertTableAction;
|
|
90
|
+
};
|
|
91
|
+
dependencies: [
|
|
92
|
+
AnalyticsPlugin,
|
|
93
|
+
ContentInsertionPlugin,
|
|
94
|
+
WidthPlugin,
|
|
95
|
+
GuidelinePlugin,
|
|
96
|
+
];
|
|
97
|
+
}
|
|
98
|
+
>;
|
|
99
|
+
|
|
83
100
|
// @public (undocumented)
|
|
84
101
|
interface TablePluginOptions {
|
|
85
102
|
// (undocumented)
|
|
@@ -101,21 +118,7 @@ interface TablePluginOptions {
|
|
|
101
118
|
}
|
|
102
119
|
|
|
103
120
|
// @public (undocumented)
|
|
104
|
-
export const tablesPlugin:
|
|
105
|
-
'table',
|
|
106
|
-
{
|
|
107
|
-
pluginConfiguration: TablePluginOptions | undefined;
|
|
108
|
-
actions: {
|
|
109
|
-
insertTable: InsertTableAction;
|
|
110
|
-
};
|
|
111
|
-
dependencies: [
|
|
112
|
-
typeof analyticsPlugin,
|
|
113
|
-
typeof contentInsertionPlugin,
|
|
114
|
-
typeof widthPlugin,
|
|
115
|
-
typeof guidelinePlugin,
|
|
116
|
-
];
|
|
117
|
-
}
|
|
118
|
-
>;
|
|
121
|
+
export const tablesPlugin: TablePlugin;
|
|
119
122
|
|
|
120
123
|
// (No @packageDocumentation comment for this package)
|
|
121
124
|
```
|
|
@@ -4,9 +4,9 @@ import { render } from '@testing-library/react';
|
|
|
4
4
|
import { replaceRaf } from 'raf-stub';
|
|
5
5
|
|
|
6
6
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
7
|
-
import { Command } from '@atlaskit/editor-common/types';
|
|
7
|
+
import type { Command } from '@atlaskit/editor-common/types';
|
|
8
8
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
10
10
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/src/utils/select-nodes';
|
|
11
11
|
import {
|
|
12
12
|
findTable,
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
selectTable,
|
|
15
15
|
} from '@atlaskit/editor-tables/utils';
|
|
16
16
|
import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
|
|
17
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
17
18
|
import {
|
|
18
19
|
doc,
|
|
19
|
-
DocBuilder,
|
|
20
20
|
p,
|
|
21
21
|
table,
|
|
22
22
|
td,
|
|
@@ -34,10 +34,8 @@ import {
|
|
|
34
34
|
} from '../../../plugins/table/commands';
|
|
35
35
|
import TableComponent from '../../../plugins/table/nodeviews/TableComponent';
|
|
36
36
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
37
|
-
import {
|
|
38
|
-
|
|
39
|
-
TablePluginState,
|
|
40
|
-
} from '../../../plugins/table/types';
|
|
37
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
38
|
+
import { TableCssClassName as ClassName } from '../../../plugins/table/types';
|
|
41
39
|
|
|
42
40
|
jest.mock('../../../plugins/table/utils/nodes', () =>
|
|
43
41
|
Object.assign({}, jest.requireActual('../../../plugins/table/utils/nodes'), {
|
|
@@ -67,7 +65,7 @@ describe('table -> nodeviews -> TableComponent.tsx', () => {
|
|
|
67
65
|
editorProps: {
|
|
68
66
|
allowTables: false,
|
|
69
67
|
dangerouslyAppendPlugins: {
|
|
70
|
-
__plugins: [tablePlugin()],
|
|
68
|
+
__plugins: [tablePlugin({ config: undefined })],
|
|
71
69
|
},
|
|
72
70
|
featureFlags,
|
|
73
71
|
},
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { fireEvent, render } from '@testing-library/react';
|
|
4
4
|
|
|
5
|
-
import { TableAttributes } from '@atlaskit/adf-schema';
|
|
5
|
+
import type { TableAttributes } from '@atlaskit/adf-schema';
|
|
6
6
|
import {
|
|
7
7
|
ACTION_SUBJECT,
|
|
8
8
|
EVENT_TYPE,
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
import { akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
12
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
13
13
|
import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
|
|
14
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
14
15
|
import {
|
|
15
16
|
doc,
|
|
16
|
-
DocBuilder,
|
|
17
17
|
p,
|
|
18
18
|
table,
|
|
19
19
|
td,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
TableContainer,
|
|
28
28
|
} from '../../../plugins/table/nodeviews/TableContainer';
|
|
29
29
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
30
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
30
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
31
31
|
|
|
32
32
|
const mockStartMeasure = jest.fn();
|
|
33
33
|
const mockEndMeasure = jest.fn(() => {
|
|
@@ -57,7 +57,7 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
57
57
|
editorProps: {
|
|
58
58
|
allowTables: false,
|
|
59
59
|
dangerouslyAppendPlugins: {
|
|
60
|
-
__plugins: [tablePlugin()],
|
|
60
|
+
__plugins: [tablePlugin({ config: undefined })],
|
|
61
61
|
},
|
|
62
62
|
featureFlags,
|
|
63
63
|
},
|
|
@@ -199,9 +199,7 @@ describe('table -> nodeviews -> TableContainer.tsx', () => {
|
|
|
199
199
|
}
|
|
200
200
|
pluginInjectionApi={
|
|
201
201
|
{
|
|
202
|
-
|
|
203
|
-
analytics: { actions: { attachAnalyticsEvent: analyticsMock } },
|
|
204
|
-
},
|
|
202
|
+
analytics: { actions: { attachAnalyticsEvent: analyticsMock } },
|
|
205
203
|
} as any
|
|
206
204
|
}
|
|
207
205
|
/>,
|
|
@@ -3,12 +3,12 @@ import React from 'react';
|
|
|
3
3
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
4
4
|
import { IntlProvider } from 'react-intl-next';
|
|
5
5
|
|
|
6
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
7
7
|
import { getCellsInColumn, selectTable } from '@atlaskit/editor-tables/utils';
|
|
8
8
|
import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
|
|
9
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
9
10
|
import {
|
|
10
11
|
doc,
|
|
11
|
-
DocBuilder,
|
|
12
12
|
table,
|
|
13
13
|
tdCursor,
|
|
14
14
|
tdEmpty,
|
|
@@ -19,13 +19,10 @@ import { selectColumns, selectRows } from '@atlaskit/editor-test-helpers/table';
|
|
|
19
19
|
|
|
20
20
|
import tablePlugin from '../../../plugins/table-plugin';
|
|
21
21
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
import FloatingDeleteButton, {
|
|
27
|
-
Props as FloatingDeleteButtonProps,
|
|
28
|
-
} from '../../../plugins/table/ui/FloatingDeleteButton';
|
|
22
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
23
|
+
import { TableCssClassName } from '../../../plugins/table/types';
|
|
24
|
+
import type { Props as FloatingDeleteButtonProps } from '../../../plugins/table/ui/FloatingDeleteButton';
|
|
25
|
+
import FloatingDeleteButton from '../../../plugins/table/ui/FloatingDeleteButton';
|
|
29
26
|
import * as tableColumnControlsUtils from '../../../plugins/table/utils/column-controls';
|
|
30
27
|
|
|
31
28
|
describe('Floating Delete Button', () => {
|
|
@@ -36,7 +33,9 @@ describe('Floating Delete Button', () => {
|
|
|
36
33
|
doc,
|
|
37
34
|
editorProps: {
|
|
38
35
|
allowTables: false,
|
|
39
|
-
dangerouslyAppendPlugins: {
|
|
36
|
+
dangerouslyAppendPlugins: {
|
|
37
|
+
__plugins: [tablePlugin({ config: undefined })],
|
|
38
|
+
},
|
|
40
39
|
},
|
|
41
40
|
pluginKey,
|
|
42
41
|
});
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { render, screen } from '@testing-library/react';
|
|
4
4
|
import { createIntl, IntlProvider } from 'react-intl-next';
|
|
5
5
|
|
|
6
|
-
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
6
|
+
import type { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
7
7
|
import {
|
|
8
8
|
ACTION,
|
|
9
9
|
ACTION_SUBJECT,
|
|
@@ -12,11 +12,11 @@ import {
|
|
|
12
12
|
} from '@atlaskit/editor-common/analytics';
|
|
13
13
|
import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
14
14
|
import * as prosemirrorUtils from '@atlaskit/editor-prosemirror/utils';
|
|
15
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
15
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
16
16
|
import { createEditorFactory } from '@atlaskit/editor-test-helpers/create-editor';
|
|
17
|
+
import type { DocBuilder } from '@atlaskit/editor-test-helpers/doc-builder';
|
|
17
18
|
import {
|
|
18
19
|
doc,
|
|
19
|
-
DocBuilder,
|
|
20
20
|
table,
|
|
21
21
|
tdCursor,
|
|
22
22
|
tdEmpty,
|
|
@@ -33,11 +33,9 @@ import tablePlugin from '../../../plugins/table-plugin';
|
|
|
33
33
|
import { setEditorFocus, setTableRef } from '../../../plugins/table/commands';
|
|
34
34
|
import { getPluginState } from '../../../plugins/table/pm-plugins/plugin-factory';
|
|
35
35
|
import { pluginKey } from '../../../plugins/table/pm-plugins/plugin-key';
|
|
36
|
-
import { TablePluginState } from '../../../plugins/table/types';
|
|
37
|
-
import {
|
|
38
|
-
|
|
39
|
-
Props as FloatingInsertButtonProps,
|
|
40
|
-
} from '../../../plugins/table/ui/FloatingInsertButton';
|
|
36
|
+
import type { TablePluginState } from '../../../plugins/table/types';
|
|
37
|
+
import type { Props as FloatingInsertButtonProps } from '../../../plugins/table/ui/FloatingInsertButton';
|
|
38
|
+
import { FloatingInsertButton } from '../../../plugins/table/ui/FloatingInsertButton';
|
|
41
39
|
|
|
42
40
|
jest.mock('@atlaskit/editor-prosemirror/utils', () => {
|
|
43
41
|
// Unblock prosemirror bump:
|
|
@@ -61,7 +59,9 @@ const editor = (doc: DocBuilder) =>
|
|
|
61
59
|
doc,
|
|
62
60
|
editorProps: {
|
|
63
61
|
allowTables: false,
|
|
64
|
-
dangerouslyAppendPlugins: {
|
|
62
|
+
dangerouslyAppendPlugins: {
|
|
63
|
+
__plugins: [tablePlugin({ config: undefined })],
|
|
64
|
+
},
|
|
65
65
|
},
|
|
66
66
|
pluginKey,
|
|
67
67
|
});
|
package/src/index.ts
CHANGED
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
tableRow,
|
|
8
8
|
tableWithCustomWidth,
|
|
9
9
|
} from '@atlaskit/adf-schema';
|
|
10
|
+
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
10
11
|
import {
|
|
11
12
|
ACTION,
|
|
12
13
|
ACTION_SUBJECT,
|
|
13
14
|
ACTION_SUBJECT_ID,
|
|
14
|
-
AnalyticsEventPayload,
|
|
15
15
|
EVENT_TYPE,
|
|
16
16
|
INPUT_METHOD,
|
|
17
17
|
TABLE_ACTION,
|
|
@@ -31,11 +31,11 @@ import type {
|
|
|
31
31
|
} from '@atlaskit/editor-common/types';
|
|
32
32
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
33
33
|
import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
|
|
34
|
-
import type {
|
|
35
|
-
import type {
|
|
36
|
-
import type {
|
|
37
|
-
import type {
|
|
38
|
-
import { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
34
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
35
|
+
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
36
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
37
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
38
|
+
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
39
39
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
40
40
|
import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
41
41
|
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
pluginKey as tableWidthPluginKey,
|
|
63
63
|
} from './pm-plugins/table-width';
|
|
64
64
|
import { getToolbarConfig } from './toolbar';
|
|
65
|
-
import { ColumnResizingPluginState, PluginConfig } from './types';
|
|
65
|
+
import type { ColumnResizingPluginState, PluginConfig } from './types';
|
|
66
66
|
import FloatingContextualButton from './ui/FloatingContextualButton';
|
|
67
67
|
import FloatingContextualMenu from './ui/FloatingContextualMenu';
|
|
68
68
|
import FloatingDeleteButton from './ui/FloatingDeleteButton';
|
|
@@ -88,7 +88,7 @@ type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
|
88
88
|
|
|
89
89
|
const defaultGetEditorFeatureFlags = () => ({});
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
export type TablePlugin = NextEditorPlugin<
|
|
92
92
|
'table',
|
|
93
93
|
{
|
|
94
94
|
pluginConfiguration: TablePluginOptions | undefined;
|
|
@@ -96,21 +96,23 @@ const tablesPlugin: NextEditorPlugin<
|
|
|
96
96
|
insertTable: InsertTableAction;
|
|
97
97
|
};
|
|
98
98
|
dependencies: [
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
AnalyticsPlugin,
|
|
100
|
+
ContentInsertionPlugin,
|
|
101
|
+
WidthPlugin,
|
|
102
|
+
GuidelinePlugin,
|
|
103
103
|
];
|
|
104
104
|
}
|
|
105
|
-
|
|
105
|
+
>;
|
|
106
|
+
|
|
107
|
+
const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
106
108
|
const editorViewRef: Record<'current', EditorView | null> = { current: null };
|
|
107
109
|
const defaultGetEditorContainerWidth: GetEditorContainerWidth = () => {
|
|
108
110
|
const defaultState = {
|
|
109
111
|
width: document?.body?.offsetWidth ?? 500,
|
|
110
112
|
};
|
|
111
|
-
return api?.
|
|
113
|
+
return api?.width.sharedState.currentState() ?? defaultState;
|
|
112
114
|
};
|
|
113
|
-
const editorAnalyticsAPI = api?.
|
|
115
|
+
const editorAnalyticsAPI = api?.analytics?.actions;
|
|
114
116
|
|
|
115
117
|
return {
|
|
116
118
|
name: 'table',
|
|
@@ -124,7 +126,7 @@ const tablesPlugin: NextEditorPlugin<
|
|
|
124
126
|
});
|
|
125
127
|
|
|
126
128
|
return (
|
|
127
|
-
api?.
|
|
129
|
+
api?.contentInsertion?.actions?.insert({
|
|
128
130
|
state,
|
|
129
131
|
dispatch,
|
|
130
132
|
node,
|
|
@@ -119,9 +119,9 @@ export const ResizableTableContainer = ({
|
|
|
119
119
|
const displayGuideline = useCallback(
|
|
120
120
|
(guidelines: GuidelineConfig[]) => {
|
|
121
121
|
return (
|
|
122
|
-
pluginInjectionApi?.
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
pluginInjectionApi?.guideline?.actions?.displayGuideline(editorView)({
|
|
123
|
+
guidelines,
|
|
124
|
+
}) ?? false
|
|
125
125
|
);
|
|
126
126
|
},
|
|
127
127
|
[pluginInjectionApi, editorView],
|
|
@@ -129,7 +129,7 @@ export const ResizableTableContainer = ({
|
|
|
129
129
|
|
|
130
130
|
const attachAnalyticsEvent = useCallback(
|
|
131
131
|
(payload: TableEventPayload) => {
|
|
132
|
-
return pluginInjectionApi?.
|
|
132
|
+
return pluginInjectionApi?.analytics?.actions.attachAnalyticsEvent(
|
|
133
133
|
payload,
|
|
134
134
|
);
|
|
135
135
|
},
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
8
|
-
import type {
|
|
7
|
+
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
8
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
9
9
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
10
|
-
import type {
|
|
10
|
+
import type { ContentInsertionPlugin } from '@atlaskit/editor-plugin-content-insertion';
|
|
11
11
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
12
12
|
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
13
|
-
import type {
|
|
13
|
+
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
14
14
|
import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
15
15
|
import type { TableLayout } from '@atlaskit/adf-schema';
|
|
16
|
-
import type {
|
|
16
|
+
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
17
17
|
|
|
18
18
|
// @public (undocumented)
|
|
19
19
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
@@ -69,6 +69,20 @@ interface PluginConfig {
|
|
|
69
69
|
tableRenderOptimization?: boolean;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
// @public (undocumented)
|
|
73
|
+
export type TablePlugin = NextEditorPlugin<'table', {
|
|
74
|
+
pluginConfiguration: TablePluginOptions | undefined;
|
|
75
|
+
actions: {
|
|
76
|
+
insertTable: InsertTableAction;
|
|
77
|
+
};
|
|
78
|
+
dependencies: [
|
|
79
|
+
AnalyticsPlugin,
|
|
80
|
+
ContentInsertionPlugin,
|
|
81
|
+
WidthPlugin,
|
|
82
|
+
GuidelinePlugin
|
|
83
|
+
];
|
|
84
|
+
}>;
|
|
85
|
+
|
|
72
86
|
// @public (undocumented)
|
|
73
87
|
interface TablePluginOptions {
|
|
74
88
|
// (undocumented)
|
|
@@ -90,18 +104,7 @@ interface TablePluginOptions {
|
|
|
90
104
|
}
|
|
91
105
|
|
|
92
106
|
// @public (undocumented)
|
|
93
|
-
export const tablesPlugin:
|
|
94
|
-
pluginConfiguration: TablePluginOptions | undefined;
|
|
95
|
-
actions: {
|
|
96
|
-
insertTable: InsertTableAction;
|
|
97
|
-
};
|
|
98
|
-
dependencies: [
|
|
99
|
-
typeof analyticsPlugin,
|
|
100
|
-
typeof contentInsertionPlugin,
|
|
101
|
-
typeof widthPlugin,
|
|
102
|
-
typeof guidelinePlugin
|
|
103
|
-
];
|
|
104
|
-
}>;
|
|
107
|
+
export const tablesPlugin: TablePlugin;
|
|
105
108
|
|
|
106
109
|
// (No @packageDocumentation comment for this package)
|
|
107
110
|
|