@atlaskit/editor-plugin-table 1.7.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/plugins/table/index.js +11 -16
- package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +2 -1
- package/dist/cjs/plugins/table/ui/FloatingContextualMenu/index.js +12 -12
- package/dist/cjs/plugins/table/utils/nodes.js +4 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/plugins/table/index.js +11 -16
- package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +4 -1
- package/dist/es2019/plugins/table/ui/FloatingContextualMenu/index.js +1 -1
- package/dist/es2019/plugins/table/utils/nodes.js +3 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/plugins/table/index.js +11 -16
- package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js +2 -1
- package/dist/esm/plugins/table/ui/FloatingContextualMenu/index.js +12 -12
- package/dist/esm/plugins/table/utils/nodes.js +4 -2
- package/dist/esm/version.json +1 -1
- package/dist/types/plugins/table/commands/insert.d.ts +1 -1
- package/dist/types/plugins/table/index.d.ts +0 -2
- package/dist/types/plugins/table/nodeviews/table.d.ts +3 -3
- package/dist/types/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/plugin-factory.d.ts +3 -1
- package/dist/types/plugins/table/pm-plugins/plugin-key.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +2 -2
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -1
- package/dist/types/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-add-width.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-local-id.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +5 -3
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types/plugins/table/utils/collapse.d.ts +3 -3
- package/dist/types/plugins/table/utils/row-controls.d.ts +1 -1
- package/dist/types/plugins/table/utils/update-plugin-state-decorations.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/index.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +3 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-factory.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/plugin-key.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-key.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin-state.d.ts +3 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-add-width.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-local-id.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-factory.d.ts +5 -3
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin-key.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/utils/collapse.d.ts +3 -3
- package/dist/types-ts4.5/plugins/table/utils/row-controls.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/utils/update-plugin-state-decorations.d.ts +1 -1
- package/package.json +7 -14
- package/report.api.md +0 -3
- package/src/__tests__/integration/sticky-header.ts +0 -94
- package/src/__tests__/unit/analytics.ts +20 -10
- package/src/__tests__/unit/keymap.ts +14 -21
- package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +12 -7
- package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-1-snap.png +2 -2
- package/src/__tests__/visual-regression/__image_snapshots__/sticky-header-ts-snapshot-test-table-sticky-header-should-align-with-table-cell-when-active-2-snap.png +2 -2
- package/src/__tests__/visual-regression/sticky-header.ts +3 -2
- package/src/plugins/table/index.tsx +12 -25
- package/src/plugins/table/nodeviews/table.tsx +5 -2
- package/src/plugins/table/pm-plugins/main.ts +1 -1
- package/src/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.ts +1 -1
- package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +1 -1
- package/src/plugins/table/toolbar.tsx +1 -3
- package/src/plugins/table/ui/FloatingContextualMenu/index.tsx +1 -1
- package/src/plugins/table/utils/collapse.ts +3 -3
- package/src/plugins/table/utils/nodes.ts +3 -3
- package/src/plugins/table/utils/update-plugin-state-decorations.ts +1 -1
- package/tmp/api-report-tmp.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`bdb840c6eaa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bdb840c6eaa) - Remove EditorAnalyticsAPI parameter from tables plugin as it now gets this from `editor-plugin-analytics`. This parameter is unused and the action is just to remove it.
|
|
8
|
+
|
|
9
|
+
Fix issue where internal analytics plugin was not being called correctly.
|
|
10
|
+
|
|
11
|
+
## 1.7.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`5f5ba16de66`](https://bitbucket.org/atlassian/atlassian-frontend/commits/5f5ba16de66) - [ED-13910] Fix prosemirror types
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 1.7.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -40,6 +40,7 @@ var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
|
40
40
|
return {};
|
|
41
41
|
};
|
|
42
42
|
var tablesPlugin = function tablesPlugin(options, api) {
|
|
43
|
+
var _api$dependencies$ana;
|
|
43
44
|
var editorViewRef = {
|
|
44
45
|
current: null
|
|
45
46
|
};
|
|
@@ -50,6 +51,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
50
51
|
};
|
|
51
52
|
return (_api$dependencies$wid = api === null || api === void 0 ? void 0 : api.dependencies.width.sharedState.currentState()) !== null && _api$dependencies$wid !== void 0 ? _api$dependencies$wid : defaultState;
|
|
52
53
|
};
|
|
54
|
+
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions;
|
|
53
55
|
return {
|
|
54
56
|
name: 'table',
|
|
55
57
|
actions: {
|
|
@@ -91,19 +93,15 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
91
93
|
var plugins = [{
|
|
92
94
|
name: 'table',
|
|
93
95
|
plugin: function plugin(_ref) {
|
|
94
|
-
var _api$dependencies$ana;
|
|
95
96
|
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
96
97
|
dispatch = _ref.dispatch,
|
|
97
98
|
portalProviderAPI = _ref.portalProviderAPI,
|
|
98
99
|
eventDispatcher = _ref.eventDispatcher;
|
|
99
|
-
var _ref2 = options || {
|
|
100
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions
|
|
101
|
-
},
|
|
100
|
+
var _ref2 = options || {},
|
|
102
101
|
fullWidthEnabled = _ref2.fullWidthEnabled,
|
|
103
102
|
wasFullWidthEnabled = _ref2.wasFullWidthEnabled,
|
|
104
103
|
breakoutEnabled = _ref2.breakoutEnabled,
|
|
105
104
|
tableOptions = _ref2.tableOptions,
|
|
106
|
-
editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
|
|
107
105
|
getEditorFeatureFlags = _ref2.getEditorFeatureFlags;
|
|
108
106
|
return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI);
|
|
109
107
|
}
|
|
@@ -114,7 +112,6 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
114
112
|
var _ref4 = options || {},
|
|
115
113
|
fullWidthEnabled = _ref4.fullWidthEnabled,
|
|
116
114
|
tableOptions = _ref4.tableOptions,
|
|
117
|
-
editorAnalyticsAPI = _ref4.editorAnalyticsAPI,
|
|
118
115
|
getEditorFeatureFlags = _ref4.getEditorFeatureFlags;
|
|
119
116
|
var _pluginConfig = (0, _createPluginConfig.pluginConfig)(tableOptions),
|
|
120
117
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
@@ -133,7 +130,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
133
130
|
{
|
|
134
131
|
name: 'tableKeymap',
|
|
135
132
|
plugin: function plugin() {
|
|
136
|
-
return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth,
|
|
133
|
+
return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth, editorAnalyticsAPI);
|
|
137
134
|
}
|
|
138
135
|
}, {
|
|
139
136
|
name: 'tableSelectionKeymap',
|
|
@@ -145,11 +142,10 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
145
142
|
plugin: function plugin() {
|
|
146
143
|
return (0, _pmPlugins.tableEditing)({
|
|
147
144
|
reportFixedTable: function reportFixedTable(_ref5) {
|
|
148
|
-
var _options$editorAnalyt;
|
|
149
145
|
var state = _ref5.state,
|
|
150
146
|
tr = _ref5.tr,
|
|
151
147
|
reason = _ref5.reason;
|
|
152
|
-
|
|
148
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
153
149
|
action: _analytics.TABLE_ACTION.FIXED,
|
|
154
150
|
actionSubject: _analytics.ACTION_SUBJECT.TABLE,
|
|
155
151
|
actionSubjectId: null,
|
|
@@ -256,7 +252,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
256
252
|
layout: layout,
|
|
257
253
|
isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
|
|
258
254
|
stickyHeader: stickyHeader,
|
|
259
|
-
editorAnalyticsAPI:
|
|
255
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
260
256
|
}) : null;
|
|
261
257
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/_react.default.createElement(_FloatingContextualButton.default, {
|
|
262
258
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
@@ -283,7 +279,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
283
279
|
scrollableElement: popupsScrollableElement,
|
|
284
280
|
hasStickyHeaders: stickyHeader && stickyHeader.sticky,
|
|
285
281
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
286
|
-
editorAnalyticsAPI:
|
|
282
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
287
283
|
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
288
284
|
}), /*#__PURE__*/_react.default.createElement(_FloatingContextualMenu.default, {
|
|
289
285
|
editorView: editorView,
|
|
@@ -292,7 +288,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
292
288
|
targetCellPosition: targetCellPosition,
|
|
293
289
|
isOpen: Boolean(isContextualMenuOpen),
|
|
294
290
|
pluginConfig: pluginConfig,
|
|
295
|
-
editorAnalyticsAPI:
|
|
291
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
296
292
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
297
293
|
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
298
294
|
}), allowControls && /*#__PURE__*/_react.default.createElement(_FloatingDeleteButton.default, {
|
|
@@ -304,7 +300,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
304
300
|
scrollableElement: popupsScrollableElement,
|
|
305
301
|
stickyHeaders: stickyHeader,
|
|
306
302
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
307
|
-
editorAnalyticsAPI:
|
|
303
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
308
304
|
}), LayoutContent);
|
|
309
305
|
}
|
|
310
306
|
}));
|
|
@@ -323,11 +319,10 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
323
319
|
return /*#__PURE__*/_react.default.createElement(_icons.IconTable, null);
|
|
324
320
|
},
|
|
325
321
|
action: function action(insert, state) {
|
|
326
|
-
var _options$editorAnalyt2;
|
|
327
322
|
var tr = insert((0, _utils2.createTable)({
|
|
328
323
|
schema: state.schema
|
|
329
324
|
}));
|
|
330
|
-
|
|
325
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
331
326
|
action: _analytics.ACTION.INSERTED,
|
|
332
327
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
333
328
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.TABLE,
|
|
@@ -340,7 +335,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
340
335
|
}
|
|
341
336
|
}];
|
|
342
337
|
},
|
|
343
|
-
floatingToolbar: (0, _toolbar.getToolbarConfig)(defaultGetEditorContainerWidth,
|
|
338
|
+
floatingToolbar: (0, _toolbar.getToolbarConfig)(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, function () {
|
|
344
339
|
return editorViewRef.current;
|
|
345
340
|
})((0, _createPluginConfig.pluginConfig)(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
346
341
|
}
|
package/dist/cjs/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js
CHANGED
|
@@ -51,7 +51,8 @@ var createPlugin = function createPlugin() {
|
|
|
51
51
|
},
|
|
52
52
|
props: {
|
|
53
53
|
decorations: function decorations(state) {
|
|
54
|
-
|
|
54
|
+
var _tableSafariDeleteCom;
|
|
55
|
+
return (_tableSafariDeleteCom = tableSafariDeleteCompositionTextIssueWorkaroundKey.getState(state)) === null || _tableSafariDeleteCom === void 0 ? void 0 : _tableSafariDeleteCom.decorations;
|
|
55
56
|
},
|
|
56
57
|
handleDOMEvents: {
|
|
57
58
|
beforeinput: function beforeinput(view, event) {
|
|
@@ -19,8 +19,8 @@ var _ContextualMenu = _interopRequireDefault(require("./ContextualMenu"));
|
|
|
19
19
|
|
|
20
20
|
// offset of the contextual menu dropdown
|
|
21
21
|
var calculateOffset = function calculateOffset(targetCellRef, state) {
|
|
22
|
-
var
|
|
23
|
-
tableRef =
|
|
22
|
+
var _ref = _pluginKey.pluginKey.getState(state) || {},
|
|
23
|
+
tableRef = _ref.tableRef;
|
|
24
24
|
var top = -_consts.contextualMenuTriggerSize;
|
|
25
25
|
if (tableRef && targetCellRef) {
|
|
26
26
|
var targetOffset = targetCellRef.getBoundingClientRect();
|
|
@@ -32,16 +32,16 @@ var calculateOffset = function calculateOffset(targetCellRef, state) {
|
|
|
32
32
|
}
|
|
33
33
|
return [_consts.contextualMenuTriggerSize / 2, top];
|
|
34
34
|
};
|
|
35
|
-
var FloatingContextualMenu = function FloatingContextualMenu(
|
|
36
|
-
var mountPoint =
|
|
37
|
-
boundariesElement =
|
|
38
|
-
scrollableElement =
|
|
39
|
-
editorView =
|
|
40
|
-
isOpen =
|
|
41
|
-
pluginConfig =
|
|
42
|
-
editorAnalyticsAPI =
|
|
43
|
-
getEditorContainerWidth =
|
|
44
|
-
getEditorFeatureFlags =
|
|
35
|
+
var FloatingContextualMenu = function FloatingContextualMenu(_ref2) {
|
|
36
|
+
var mountPoint = _ref2.mountPoint,
|
|
37
|
+
boundariesElement = _ref2.boundariesElement,
|
|
38
|
+
scrollableElement = _ref2.scrollableElement,
|
|
39
|
+
editorView = _ref2.editorView,
|
|
40
|
+
isOpen = _ref2.isOpen,
|
|
41
|
+
pluginConfig = _ref2.pluginConfig,
|
|
42
|
+
editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
|
|
43
|
+
getEditorContainerWidth = _ref2.getEditorContainerWidth,
|
|
44
|
+
getEditorFeatureFlags = _ref2.getEditorFeatureFlags;
|
|
45
45
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
46
46
|
var _getPluginState = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
47
47
|
targetCellPosition = _getPluginState.targetCellPosition;
|
|
@@ -62,12 +62,14 @@ var checkIfNumberColumnEnabled = function checkIfNumberColumnEnabled(selection)
|
|
|
62
62
|
};
|
|
63
63
|
exports.checkIfNumberColumnEnabled = checkIfNumberColumnEnabled;
|
|
64
64
|
var isLayoutSupported = function isLayoutSupported(state) {
|
|
65
|
-
var
|
|
65
|
+
var _pluginKey$getState;
|
|
66
|
+
var _ref = ((_pluginKey$getState = _pluginKey.pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.pluginConfig) || {},
|
|
67
|
+
permittedLayouts = _ref.permittedLayouts;
|
|
66
68
|
var _state$schema$nodes = state.schema.nodes,
|
|
67
69
|
bodiedExtension = _state$schema$nodes.bodiedExtension,
|
|
68
70
|
layoutSection = _state$schema$nodes.layoutSection,
|
|
69
71
|
expand = _state$schema$nodes.expand;
|
|
70
|
-
return !(0, _prosemirrorUtils.hasParentNodeOfType)([expand, layoutSection, bodiedExtension])(state.selection) && permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-
|
|
72
|
+
return !(0, _prosemirrorUtils.hasParentNodeOfType)([expand, layoutSection, bodiedExtension])(state.selection) && !!permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-width') > -1);
|
|
71
73
|
};
|
|
72
74
|
exports.isLayoutSupported = isLayoutSupported;
|
|
73
75
|
var getTableWidth = function getTableWidth(node) {
|
package/dist/cjs/version.json
CHANGED
|
@@ -31,6 +31,7 @@ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
|
31
31
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
32
32
|
const defaultGetEditorFeatureFlags = () => ({});
|
|
33
33
|
const tablesPlugin = (options, api) => {
|
|
34
|
+
var _api$dependencies$ana;
|
|
34
35
|
const editorViewRef = {
|
|
35
36
|
current: null
|
|
36
37
|
};
|
|
@@ -41,6 +42,7 @@ const tablesPlugin = (options, api) => {
|
|
|
41
42
|
};
|
|
42
43
|
return (_api$dependencies$wid = api === null || api === void 0 ? void 0 : api.dependencies.width.sharedState.currentState()) !== null && _api$dependencies$wid !== void 0 ? _api$dependencies$wid : defaultState;
|
|
43
44
|
};
|
|
45
|
+
const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions;
|
|
44
46
|
return {
|
|
45
47
|
name: 'table',
|
|
46
48
|
actions: {
|
|
@@ -85,17 +87,13 @@ const tablesPlugin = (options, api) => {
|
|
|
85
87
|
portalProviderAPI,
|
|
86
88
|
eventDispatcher
|
|
87
89
|
}) => {
|
|
88
|
-
var _api$dependencies$ana;
|
|
89
90
|
const {
|
|
90
91
|
fullWidthEnabled,
|
|
91
92
|
wasFullWidthEnabled,
|
|
92
93
|
breakoutEnabled,
|
|
93
94
|
tableOptions,
|
|
94
|
-
editorAnalyticsAPI,
|
|
95
95
|
getEditorFeatureFlags
|
|
96
|
-
} = options || {
|
|
97
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions
|
|
98
|
-
};
|
|
96
|
+
} = options || {};
|
|
99
97
|
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI);
|
|
100
98
|
}
|
|
101
99
|
}, {
|
|
@@ -106,7 +104,6 @@ const tablesPlugin = (options, api) => {
|
|
|
106
104
|
const {
|
|
107
105
|
fullWidthEnabled,
|
|
108
106
|
tableOptions,
|
|
109
|
-
editorAnalyticsAPI,
|
|
110
107
|
getEditorFeatureFlags
|
|
111
108
|
} = options || {};
|
|
112
109
|
const {
|
|
@@ -124,7 +121,7 @@ const tablesPlugin = (options, api) => {
|
|
|
124
121
|
// plugin as it is currently swallowing backspace events inside tables
|
|
125
122
|
{
|
|
126
123
|
name: 'tableKeymap',
|
|
127
|
-
plugin: () => keymapPlugin(defaultGetEditorContainerWidth,
|
|
124
|
+
plugin: () => keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI)
|
|
128
125
|
}, {
|
|
129
126
|
name: 'tableSelectionKeymap',
|
|
130
127
|
plugin: () => tableSelectionKeymapPlugin(options === null || options === void 0 ? void 0 : options.editorSelectionAPI)
|
|
@@ -136,8 +133,7 @@ const tablesPlugin = (options, api) => {
|
|
|
136
133
|
tr,
|
|
137
134
|
reason
|
|
138
135
|
}) => {
|
|
139
|
-
|
|
140
|
-
options === null || options === void 0 ? void 0 : (_options$editorAnalyt = options.editorAnalyticsAPI) === null || _options$editorAnalyt === void 0 ? void 0 : _options$editorAnalyt.attachAnalyticsEvent({
|
|
136
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
141
137
|
action: TABLE_ACTION.FIXED,
|
|
142
138
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
143
139
|
actionSubjectId: null,
|
|
@@ -245,7 +241,7 @@ const tablesPlugin = (options, api) => {
|
|
|
245
241
|
layout: layout,
|
|
246
242
|
isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
|
|
247
243
|
stickyHeader: stickyHeader,
|
|
248
|
-
editorAnalyticsAPI:
|
|
244
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
249
245
|
}) : null;
|
|
250
246
|
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
251
247
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
@@ -272,7 +268,7 @@ const tablesPlugin = (options, api) => {
|
|
|
272
268
|
scrollableElement: popupsScrollableElement,
|
|
273
269
|
hasStickyHeaders: stickyHeader && stickyHeader.sticky,
|
|
274
270
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
275
|
-
editorAnalyticsAPI:
|
|
271
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
276
272
|
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
277
273
|
}), /*#__PURE__*/React.createElement(FloatingContextualMenu, {
|
|
278
274
|
editorView: editorView,
|
|
@@ -281,7 +277,7 @@ const tablesPlugin = (options, api) => {
|
|
|
281
277
|
targetCellPosition: targetCellPosition,
|
|
282
278
|
isOpen: Boolean(isContextualMenuOpen),
|
|
283
279
|
pluginConfig: pluginConfig,
|
|
284
|
-
editorAnalyticsAPI:
|
|
280
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
285
281
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
286
282
|
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
287
283
|
}), allowControls && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
@@ -293,7 +289,7 @@ const tablesPlugin = (options, api) => {
|
|
|
293
289
|
scrollableElement: popupsScrollableElement,
|
|
294
290
|
stickyHeaders: stickyHeader,
|
|
295
291
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
296
|
-
editorAnalyticsAPI:
|
|
292
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
297
293
|
}), LayoutContent);
|
|
298
294
|
}
|
|
299
295
|
}));
|
|
@@ -310,11 +306,10 @@ const tablesPlugin = (options, api) => {
|
|
|
310
306
|
keyshortcut: tooltip(toggleTable),
|
|
311
307
|
icon: () => /*#__PURE__*/React.createElement(IconTable, null),
|
|
312
308
|
action(insert, state) {
|
|
313
|
-
var _options$editorAnalyt2;
|
|
314
309
|
const tr = insert(createTable({
|
|
315
310
|
schema: state.schema
|
|
316
311
|
}));
|
|
317
|
-
|
|
312
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
318
313
|
action: ACTION.INSERTED,
|
|
319
314
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
320
315
|
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
@@ -326,7 +321,7 @@ const tablesPlugin = (options, api) => {
|
|
|
326
321
|
return tr;
|
|
327
322
|
}
|
|
328
323
|
}],
|
|
329
|
-
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth,
|
|
324
|
+
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, () => editorViewRef.current)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
330
325
|
}
|
|
331
326
|
};
|
|
332
327
|
};
|
package/dist/es2019/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js
CHANGED
|
@@ -42,7 +42,10 @@ export const createPlugin = () => {
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
props: {
|
|
45
|
-
decorations: state =>
|
|
45
|
+
decorations: state => {
|
|
46
|
+
var _tableSafariDeleteCom;
|
|
47
|
+
return (_tableSafariDeleteCom = tableSafariDeleteCompositionTextIssueWorkaroundKey.getState(state)) === null || _tableSafariDeleteCom === void 0 ? void 0 : _tableSafariDeleteCom.decorations;
|
|
48
|
+
},
|
|
46
49
|
handleDOMEvents: {
|
|
47
50
|
beforeinput: (view, event) => {
|
|
48
51
|
if ((event === null || event === void 0 ? void 0 : event.inputType) !== 'deleteCompositionText') {
|
|
@@ -14,7 +14,7 @@ import ContextualMenu from './ContextualMenu';
|
|
|
14
14
|
const calculateOffset = (targetCellRef, state) => {
|
|
15
15
|
const {
|
|
16
16
|
tableRef
|
|
17
|
-
} = pluginKey.getState(state);
|
|
17
|
+
} = pluginKey.getState(state) || {};
|
|
18
18
|
let top = -contextualMenuTriggerSize;
|
|
19
19
|
if (tableRef && targetCellRef) {
|
|
20
20
|
const targetOffset = targetCellRef.getBoundingClientRect();
|
|
@@ -40,15 +40,16 @@ export const checkIfHeaderColumnEnabled = selection => filterNearSelection(selec
|
|
|
40
40
|
export const checkIfHeaderRowEnabled = selection => filterNearSelection(selection, findTable, containsHeaderRow, false);
|
|
41
41
|
export const checkIfNumberColumnEnabled = selection => filterNearSelection(selection, findTable, table => !!table.attrs.isNumberColumnEnabled, false);
|
|
42
42
|
export const isLayoutSupported = state => {
|
|
43
|
+
var _pluginKey$getState;
|
|
43
44
|
const {
|
|
44
45
|
permittedLayouts
|
|
45
|
-
} = pluginKey.getState(state).pluginConfig;
|
|
46
|
+
} = ((_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.pluginConfig) || {};
|
|
46
47
|
const {
|
|
47
48
|
bodiedExtension,
|
|
48
49
|
layoutSection,
|
|
49
50
|
expand
|
|
50
51
|
} = state.schema.nodes;
|
|
51
|
-
return !hasParentNodeOfType([expand, layoutSection, bodiedExtension])(state.selection) && permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-
|
|
52
|
+
return !hasParentNodeOfType([expand, layoutSection, bodiedExtension])(state.selection) && !!permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-width') > -1);
|
|
52
53
|
};
|
|
53
54
|
export const getTableWidth = node => {
|
|
54
55
|
return getTableWidths(node).reduce((acc, current) => acc + current, 0);
|
package/dist/es2019/version.json
CHANGED
|
@@ -33,6 +33,7 @@ var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
|
|
|
33
33
|
return {};
|
|
34
34
|
};
|
|
35
35
|
var tablesPlugin = function tablesPlugin(options, api) {
|
|
36
|
+
var _api$dependencies$ana;
|
|
36
37
|
var editorViewRef = {
|
|
37
38
|
current: null
|
|
38
39
|
};
|
|
@@ -43,6 +44,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
43
44
|
};
|
|
44
45
|
return (_api$dependencies$wid = api === null || api === void 0 ? void 0 : api.dependencies.width.sharedState.currentState()) !== null && _api$dependencies$wid !== void 0 ? _api$dependencies$wid : defaultState;
|
|
45
46
|
};
|
|
47
|
+
var editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions;
|
|
46
48
|
return {
|
|
47
49
|
name: 'table',
|
|
48
50
|
actions: {
|
|
@@ -84,19 +86,15 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
84
86
|
var plugins = [{
|
|
85
87
|
name: 'table',
|
|
86
88
|
plugin: function plugin(_ref) {
|
|
87
|
-
var _api$dependencies$ana;
|
|
88
89
|
var dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
89
90
|
dispatch = _ref.dispatch,
|
|
90
91
|
portalProviderAPI = _ref.portalProviderAPI,
|
|
91
92
|
eventDispatcher = _ref.eventDispatcher;
|
|
92
|
-
var _ref2 = options || {
|
|
93
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$dependencies$ana = api.dependencies.analytics) === null || _api$dependencies$ana === void 0 ? void 0 : _api$dependencies$ana.actions
|
|
94
|
-
},
|
|
93
|
+
var _ref2 = options || {},
|
|
95
94
|
fullWidthEnabled = _ref2.fullWidthEnabled,
|
|
96
95
|
wasFullWidthEnabled = _ref2.wasFullWidthEnabled,
|
|
97
96
|
breakoutEnabled = _ref2.breakoutEnabled,
|
|
98
97
|
tableOptions = _ref2.tableOptions,
|
|
99
|
-
editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
|
|
100
98
|
getEditorFeatureFlags = _ref2.getEditorFeatureFlags;
|
|
101
99
|
return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI);
|
|
102
100
|
}
|
|
@@ -107,7 +105,6 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
107
105
|
var _ref4 = options || {},
|
|
108
106
|
fullWidthEnabled = _ref4.fullWidthEnabled,
|
|
109
107
|
tableOptions = _ref4.tableOptions,
|
|
110
|
-
editorAnalyticsAPI = _ref4.editorAnalyticsAPI,
|
|
111
108
|
getEditorFeatureFlags = _ref4.getEditorFeatureFlags;
|
|
112
109
|
var _pluginConfig = pluginConfig(tableOptions),
|
|
113
110
|
allowColumnResizing = _pluginConfig.allowColumnResizing;
|
|
@@ -126,7 +123,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
126
123
|
{
|
|
127
124
|
name: 'tableKeymap',
|
|
128
125
|
plugin: function plugin() {
|
|
129
|
-
return keymapPlugin(defaultGetEditorContainerWidth,
|
|
126
|
+
return keymapPlugin(defaultGetEditorContainerWidth, editorAnalyticsAPI);
|
|
130
127
|
}
|
|
131
128
|
}, {
|
|
132
129
|
name: 'tableSelectionKeymap',
|
|
@@ -138,11 +135,10 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
138
135
|
plugin: function plugin() {
|
|
139
136
|
return tableEditing({
|
|
140
137
|
reportFixedTable: function reportFixedTable(_ref5) {
|
|
141
|
-
var _options$editorAnalyt;
|
|
142
138
|
var state = _ref5.state,
|
|
143
139
|
tr = _ref5.tr,
|
|
144
140
|
reason = _ref5.reason;
|
|
145
|
-
|
|
141
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
146
142
|
action: TABLE_ACTION.FIXED,
|
|
147
143
|
actionSubject: ACTION_SUBJECT.TABLE,
|
|
148
144
|
actionSubjectId: null,
|
|
@@ -249,7 +245,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
249
245
|
layout: layout,
|
|
250
246
|
isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
|
|
251
247
|
stickyHeader: stickyHeader,
|
|
252
|
-
editorAnalyticsAPI:
|
|
248
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
253
249
|
}) : null;
|
|
254
250
|
return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
|
|
255
251
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
@@ -276,7 +272,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
276
272
|
scrollableElement: popupsScrollableElement,
|
|
277
273
|
hasStickyHeaders: stickyHeader && stickyHeader.sticky,
|
|
278
274
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
279
|
-
editorAnalyticsAPI:
|
|
275
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
280
276
|
getEditorContainerWidth: defaultGetEditorContainerWidth
|
|
281
277
|
}), /*#__PURE__*/React.createElement(FloatingContextualMenu, {
|
|
282
278
|
editorView: editorView,
|
|
@@ -285,7 +281,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
285
281
|
targetCellPosition: targetCellPosition,
|
|
286
282
|
isOpen: Boolean(isContextualMenuOpen),
|
|
287
283
|
pluginConfig: pluginConfig,
|
|
288
|
-
editorAnalyticsAPI:
|
|
284
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
289
285
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
290
286
|
getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
|
|
291
287
|
}), allowControls && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
|
|
@@ -297,7 +293,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
297
293
|
scrollableElement: popupsScrollableElement,
|
|
298
294
|
stickyHeaders: stickyHeader,
|
|
299
295
|
isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
|
|
300
|
-
editorAnalyticsAPI:
|
|
296
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
301
297
|
}), LayoutContent);
|
|
302
298
|
}
|
|
303
299
|
}));
|
|
@@ -316,11 +312,10 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
316
312
|
return /*#__PURE__*/React.createElement(IconTable, null);
|
|
317
313
|
},
|
|
318
314
|
action: function action(insert, state) {
|
|
319
|
-
var _options$editorAnalyt2;
|
|
320
315
|
var tr = insert(createTable({
|
|
321
316
|
schema: state.schema
|
|
322
317
|
}));
|
|
323
|
-
|
|
318
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
324
319
|
action: ACTION.INSERTED,
|
|
325
320
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
326
321
|
actionSubjectId: ACTION_SUBJECT_ID.TABLE,
|
|
@@ -333,7 +328,7 @@ var tablesPlugin = function tablesPlugin(options, api) {
|
|
|
333
328
|
}
|
|
334
329
|
}];
|
|
335
330
|
},
|
|
336
|
-
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth,
|
|
331
|
+
floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, function () {
|
|
337
332
|
return editorViewRef.current;
|
|
338
333
|
})(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
|
|
339
334
|
}
|
package/dist/esm/plugins/table/pm-plugins/safari-delete-composition-text-issue-workaround.js
CHANGED
|
@@ -43,7 +43,8 @@ export var createPlugin = function createPlugin() {
|
|
|
43
43
|
},
|
|
44
44
|
props: {
|
|
45
45
|
decorations: function decorations(state) {
|
|
46
|
-
|
|
46
|
+
var _tableSafariDeleteCom;
|
|
47
|
+
return (_tableSafariDeleteCom = tableSafariDeleteCompositionTextIssueWorkaroundKey.getState(state)) === null || _tableSafariDeleteCom === void 0 ? void 0 : _tableSafariDeleteCom.decorations;
|
|
47
48
|
},
|
|
48
49
|
handleDOMEvents: {
|
|
49
50
|
beforeinput: function beforeinput(view, event) {
|
|
@@ -12,8 +12,8 @@ import ContextualMenu from './ContextualMenu';
|
|
|
12
12
|
|
|
13
13
|
// offset of the contextual menu dropdown
|
|
14
14
|
var calculateOffset = function calculateOffset(targetCellRef, state) {
|
|
15
|
-
var
|
|
16
|
-
tableRef =
|
|
15
|
+
var _ref = pluginKey.getState(state) || {},
|
|
16
|
+
tableRef = _ref.tableRef;
|
|
17
17
|
var top = -contextualMenuTriggerSize;
|
|
18
18
|
if (tableRef && targetCellRef) {
|
|
19
19
|
var targetOffset = targetCellRef.getBoundingClientRect();
|
|
@@ -25,16 +25,16 @@ var calculateOffset = function calculateOffset(targetCellRef, state) {
|
|
|
25
25
|
}
|
|
26
26
|
return [contextualMenuTriggerSize / 2, top];
|
|
27
27
|
};
|
|
28
|
-
var FloatingContextualMenu = function FloatingContextualMenu(
|
|
29
|
-
var mountPoint =
|
|
30
|
-
boundariesElement =
|
|
31
|
-
scrollableElement =
|
|
32
|
-
editorView =
|
|
33
|
-
isOpen =
|
|
34
|
-
pluginConfig =
|
|
35
|
-
editorAnalyticsAPI =
|
|
36
|
-
getEditorContainerWidth =
|
|
37
|
-
getEditorFeatureFlags =
|
|
28
|
+
var FloatingContextualMenu = function FloatingContextualMenu(_ref2) {
|
|
29
|
+
var mountPoint = _ref2.mountPoint,
|
|
30
|
+
boundariesElement = _ref2.boundariesElement,
|
|
31
|
+
scrollableElement = _ref2.scrollableElement,
|
|
32
|
+
editorView = _ref2.editorView,
|
|
33
|
+
isOpen = _ref2.isOpen,
|
|
34
|
+
pluginConfig = _ref2.pluginConfig,
|
|
35
|
+
editorAnalyticsAPI = _ref2.editorAnalyticsAPI,
|
|
36
|
+
getEditorContainerWidth = _ref2.getEditorContainerWidth,
|
|
37
|
+
getEditorFeatureFlags = _ref2.getEditorFeatureFlags;
|
|
38
38
|
// TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
|
|
39
39
|
var _getPluginState = getPluginState(editorView.state),
|
|
40
40
|
targetCellPosition = _getPluginState.targetCellPosition;
|
|
@@ -49,12 +49,14 @@ export var checkIfNumberColumnEnabled = function checkIfNumberColumnEnabled(sele
|
|
|
49
49
|
}, false);
|
|
50
50
|
};
|
|
51
51
|
export var isLayoutSupported = function isLayoutSupported(state) {
|
|
52
|
-
var
|
|
52
|
+
var _pluginKey$getState;
|
|
53
|
+
var _ref = ((_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.pluginConfig) || {},
|
|
54
|
+
permittedLayouts = _ref.permittedLayouts;
|
|
53
55
|
var _state$schema$nodes = state.schema.nodes,
|
|
54
56
|
bodiedExtension = _state$schema$nodes.bodiedExtension,
|
|
55
57
|
layoutSection = _state$schema$nodes.layoutSection,
|
|
56
58
|
expand = _state$schema$nodes.expand;
|
|
57
|
-
return !hasParentNodeOfType([expand, layoutSection, bodiedExtension])(state.selection) && permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-
|
|
59
|
+
return !hasParentNodeOfType([expand, layoutSection, bodiedExtension])(state.selection) && !!permittedLayouts && (permittedLayouts === 'all' || permittedLayouts.indexOf('default') > -1 && permittedLayouts.indexOf('wide') > -1 && permittedLayouts.indexOf('full-width') > -1);
|
|
58
60
|
};
|
|
59
61
|
export var getTableWidth = function getTableWidth(node) {
|
|
60
62
|
return getTableWidths(node).reduce(function (acc, current) {
|
package/dist/esm/version.json
CHANGED
|
@@ -2,7 +2,7 @@ import { Transaction } from 'prosemirror-state';
|
|
|
2
2
|
import { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import { EditorView } from 'prosemirror-view';
|
|
4
4
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
5
|
-
export declare function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction
|
|
5
|
+
export declare function addColumnAt(getEditorContainerWidth: GetEditorContainerWidth): (column: number, allowAddColumnCustomStep: boolean | undefined, view: EditorView | undefined) => (tr: Transaction) => Transaction;
|
|
6
6
|
export declare const addColumnBefore: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
7
7
|
export declare const addColumnAfter: (getEditorContainerWidth: GetEditorContainerWidth) => Command;
|
|
8
8
|
export declare const insertColumn: (getEditorContainerWidth: GetEditorContainerWidth) => (column: number) => Command;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
2
|
import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
3
|
import type { EditorSelectionAPI } from '@atlaskit/editor-common/selection';
|
|
5
4
|
import { PluginConfig } from './types';
|
|
6
5
|
import type { GetEditorFeatureFlags, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
@@ -13,7 +12,6 @@ interface TablePluginOptions {
|
|
|
13
12
|
allowContextualMenu?: boolean;
|
|
14
13
|
fullWidthEnabled?: boolean;
|
|
15
14
|
wasFullWidthEnabled?: boolean;
|
|
16
|
-
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
17
15
|
editorSelectionAPI?: EditorSelectionAPI;
|
|
18
16
|
getEditorFeatureFlags?: GetEditorFeatureFlags;
|
|
19
17
|
}
|
|
@@ -16,11 +16,11 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
16
16
|
getPos: getPosHandlerNode;
|
|
17
17
|
constructor(props: Props);
|
|
18
18
|
getContentDOM(): {
|
|
19
|
-
dom:
|
|
20
|
-
contentDOM?:
|
|
19
|
+
dom: HTMLElement;
|
|
20
|
+
contentDOM?: HTMLElement | undefined;
|
|
21
21
|
};
|
|
22
22
|
setDomAttrs(node: PmNode): void;
|
|
23
|
-
getNode: () => PmNode
|
|
23
|
+
getNode: () => PmNode;
|
|
24
24
|
render(props: Props, forwardRef: ForwardRef): JSX.Element;
|
|
25
25
|
private hasHoveredRows;
|
|
26
26
|
viewShouldUpdate(nextNode: PmNode): boolean;
|