@atlaskit/editor-plugin-table 5.4.6 → 5.4.7
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 +6 -0
- package/dist/cjs/plugins/table/commands/insert.js +12 -2
- package/dist/cjs/plugins/table/commands/misc.js +49 -1
- package/dist/cjs/plugins/table/index.js +46 -35
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +12 -16
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +1 -1
- package/dist/cjs/plugins/table/nodeviews/table.js +3 -1
- package/dist/cjs/plugins/table/pm-plugins/analytics/actions.js +14 -0
- package/dist/cjs/plugins/table/pm-plugins/analytics/commands.js +45 -0
- package/dist/cjs/plugins/table/pm-plugins/analytics/plugin-factory.js +13 -0
- package/dist/cjs/plugins/table/pm-plugins/analytics/plugin-key.js +8 -0
- package/dist/cjs/plugins/table/pm-plugins/analytics/plugin.js +74 -0
- package/dist/cjs/plugins/table/pm-plugins/analytics/reducer.js +26 -0
- package/dist/cjs/plugins/table/pm-plugins/analytics/types.js +13 -0
- package/dist/cjs/plugins/table/pm-plugins/analytics/utils/moved-event.js +38 -0
- package/dist/cjs/plugins/table/pm-plugins/main.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-analytics.js +1 -1
- package/dist/es2019/plugins/table/commands/insert.js +12 -3
- package/dist/es2019/plugins/table/commands/misc.js +49 -0
- package/dist/es2019/plugins/table/index.js +14 -4
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +13 -17
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +1 -1
- package/dist/es2019/plugins/table/nodeviews/table.js +3 -1
- package/dist/es2019/plugins/table/pm-plugins/analytics/actions.js +8 -0
- package/dist/es2019/plugins/table/pm-plugins/analytics/commands.js +33 -0
- package/dist/es2019/plugins/table/pm-plugins/analytics/plugin-factory.js +8 -0
- package/dist/es2019/plugins/table/pm-plugins/analytics/plugin-key.js +2 -0
- package/dist/es2019/plugins/table/pm-plugins/analytics/plugin.js +72 -0
- package/dist/es2019/plugins/table/pm-plugins/analytics/reducer.js +21 -0
- package/dist/es2019/plugins/table/pm-plugins/analytics/types.js +7 -0
- package/dist/es2019/plugins/table/pm-plugins/analytics/utils/moved-event.js +30 -0
- package/dist/es2019/plugins/table/pm-plugins/main.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-analytics.js +1 -1
- package/dist/esm/plugins/table/commands/insert.js +12 -3
- package/dist/esm/plugins/table/commands/misc.js +48 -0
- package/dist/esm/plugins/table/index.js +43 -32
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +13 -17
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +1 -1
- package/dist/esm/plugins/table/nodeviews/table.js +3 -1
- package/dist/esm/plugins/table/pm-plugins/analytics/actions.js +8 -0
- package/dist/esm/plugins/table/pm-plugins/analytics/commands.js +39 -0
- package/dist/esm/plugins/table/pm-plugins/analytics/plugin-factory.js +8 -0
- package/dist/esm/plugins/table/pm-plugins/analytics/plugin-key.js +2 -0
- package/dist/esm/plugins/table/pm-plugins/analytics/plugin.js +68 -0
- package/dist/esm/plugins/table/pm-plugins/analytics/reducer.js +19 -0
- package/dist/esm/plugins/table/pm-plugins/analytics/types.js +7 -0
- package/dist/esm/plugins/table/pm-plugins/analytics/utils/moved-event.js +31 -0
- package/dist/esm/plugins/table/pm-plugins/main.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-analytics.js +1 -1
- package/dist/types/plugins/table/commands/misc.d.ts +5 -1
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +2 -0
- package/dist/types/plugins/table/nodeviews/table.d.ts +2 -1
- package/dist/types/plugins/table/nodeviews/types.d.ts +2 -0
- package/dist/types/plugins/table/pm-plugins/analytics/actions.d.ts +17 -0
- package/dist/types/plugins/table/pm-plugins/analytics/commands.d.ts +5 -0
- package/dist/types/plugins/table/pm-plugins/analytics/plugin-factory.d.ts +1 -0
- package/dist/types/plugins/table/pm-plugins/analytics/plugin-key.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/analytics/plugin.d.ts +4 -0
- package/dist/types/plugins/table/pm-plugins/analytics/reducer.d.ts +3 -0
- package/dist/types/plugins/table/pm-plugins/analytics/types.d.ts +11 -0
- package/dist/types/plugins/table/pm-plugins/analytics/utils/moved-event.d.ts +6 -0
- package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +5 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +2 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/actions.d.ts +17 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/commands.d.ts +5 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/plugin-factory.d.ts +1 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/plugin.d.ts +4 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/reducer.d.ts +3 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/types.d.ts +11 -0
- package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/utils/moved-event.d.ts +6 -0
- package/package.json +4 -1
- package/src/__tests__/unit/index-with-fake-timers.ts +1 -0
- package/src/__tests__/unit/nodeviews/table.ts +1 -0
- package/src/__tests__/unit/pm-plugins/analytics.ts +327 -0
- package/src/plugins/table/commands/insert.ts +23 -2
- package/src/plugins/table/commands/misc.ts +84 -1
- package/src/plugins/table/index.tsx +13 -6
- package/src/plugins/table/nodeviews/TableComponent.tsx +15 -22
- package/src/plugins/table/nodeviews/TableResizer.tsx +1 -2
- package/src/plugins/table/nodeviews/table.tsx +4 -0
- package/src/plugins/table/nodeviews/types.ts +2 -0
- package/src/plugins/table/pm-plugins/analytics/actions.ts +23 -0
- package/src/plugins/table/pm-plugins/analytics/commands.ts +53 -0
- package/src/plugins/table/pm-plugins/analytics/plugin-factory.ts +7 -0
- package/src/plugins/table/pm-plugins/analytics/plugin-key.ts +7 -0
- package/src/plugins/table/pm-plugins/analytics/plugin.ts +98 -0
- package/src/plugins/table/pm-plugins/analytics/reducer.ts +27 -0
- package/src/plugins/table/pm-plugins/analytics/types.ts +20 -0
- package/src/plugins/table/pm-plugins/analytics/utils/moved-event.ts +51 -0
- package/src/plugins/table/pm-plugins/main.ts +1 -0
- package/src/plugins/table/pm-plugins/table-analytics.ts +1 -1
- package/tsconfig.dev.json +3 -0
|
@@ -12,6 +12,8 @@ import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
|
|
|
12
12
|
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
13
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
14
|
import { pluginConfig } from './create-plugin-config';
|
|
15
|
+
import { createPlugin as createTableAnalyticsPlugin } from './pm-plugins/analytics/plugin';
|
|
16
|
+
import { pluginKey as tableAnalyticsPluginKey } from './pm-plugins/analytics/plugin-key';
|
|
15
17
|
import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
|
|
16
18
|
import { createPlugin as createDragAndDropPlugin, pluginKey as dragAndDropPluginKey } from './pm-plugins/drag-and-drop';
|
|
17
19
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
@@ -19,7 +21,7 @@ import { createPlugin } from './pm-plugins/main';
|
|
|
19
21
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
20
22
|
import { createPlugin as createTableSafariDeleteCompositionTextIssueWorkaroundPlugin } from './pm-plugins/safari-delete-composition-text-issue-workaround';
|
|
21
23
|
import { createPlugin as createStickyHeadersPlugin, findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from './pm-plugins/sticky-headers';
|
|
22
|
-
import { createPlugin as
|
|
24
|
+
import { createPlugin as createTableOverflowAnalyticsPlugin } from './pm-plugins/table-analytics';
|
|
23
25
|
import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
|
|
24
26
|
import { createPlugin as createFlexiResizingPlugin, pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
|
|
25
27
|
import { tableSelectionKeymapPlugin } from './pm-plugins/table-selection-keymap';
|
|
@@ -191,13 +193,22 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
191
193
|
dispatch = _ref10.dispatch;
|
|
192
194
|
return options !== null && options !== void 0 && options.tableResizingEnabled ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
|
|
193
195
|
}
|
|
194
|
-
},
|
|
195
|
-
|
|
196
|
+
},
|
|
197
|
+
// TODO: should be deprecated and eventually replaced with 'tableAnalyticsPlugin'
|
|
198
|
+
{
|
|
199
|
+
name: 'tableOverflowAnalyticsPlugin',
|
|
196
200
|
plugin: function plugin(_ref11) {
|
|
197
201
|
var _options$tableResizin;
|
|
198
202
|
var dispatch = _ref11.dispatch,
|
|
199
203
|
dispatchAnalyticsEvent = _ref11.dispatchAnalyticsEvent;
|
|
200
|
-
return getBooleanFF('platform.editor.table.overflow-state-analytics') ?
|
|
204
|
+
return getBooleanFF('platform.editor.table.overflow-state-analytics') ? createTableOverflowAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false) : undefined;
|
|
205
|
+
}
|
|
206
|
+
}, {
|
|
207
|
+
name: 'tableAnalyticsPlugin',
|
|
208
|
+
plugin: function plugin(_ref12) {
|
|
209
|
+
var dispatch = _ref12.dispatch,
|
|
210
|
+
dispatchAnalyticsEvent = _ref12.dispatchAnalyticsEvent;
|
|
211
|
+
return getBooleanFF('platform.editor.table.analytics-plugin-moved-event') ? createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent) : undefined;
|
|
201
212
|
}
|
|
202
213
|
}, {
|
|
203
214
|
name: 'tableGetEditorViewReferencePlugin',
|
|
@@ -227,12 +238,12 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
227
238
|
}
|
|
228
239
|
return plugins;
|
|
229
240
|
},
|
|
230
|
-
contentComponent: function contentComponent(
|
|
231
|
-
var editorView =
|
|
232
|
-
popupsMountPoint =
|
|
233
|
-
popupsBoundariesElement =
|
|
234
|
-
popupsScrollableElement =
|
|
235
|
-
dispatchAnalyticsEvent =
|
|
241
|
+
contentComponent: function contentComponent(_ref13) {
|
|
242
|
+
var editorView = _ref13.editorView,
|
|
243
|
+
popupsMountPoint = _ref13.popupsMountPoint,
|
|
244
|
+
popupsBoundariesElement = _ref13.popupsBoundariesElement,
|
|
245
|
+
popupsScrollableElement = _ref13.popupsScrollableElement,
|
|
246
|
+
dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent;
|
|
236
247
|
return /*#__PURE__*/React.createElement(ErrorBoundary, {
|
|
237
248
|
component: ACTION_SUBJECT.TABLES_PLUGIN,
|
|
238
249
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
@@ -246,30 +257,30 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
246
257
|
stickyHeadersState: stickyHeadersPluginKey,
|
|
247
258
|
dragAndDropState: dragAndDropPluginKey
|
|
248
259
|
},
|
|
249
|
-
render: function render(
|
|
250
|
-
var resizingPluginState =
|
|
251
|
-
stickyHeadersState =
|
|
252
|
-
tablePluginState =
|
|
253
|
-
tableWidthPluginState =
|
|
254
|
-
dragAndDropState =
|
|
260
|
+
render: function render(_ref14) {
|
|
261
|
+
var resizingPluginState = _ref14.tableResizingPluginState,
|
|
262
|
+
stickyHeadersState = _ref14.stickyHeadersState,
|
|
263
|
+
tablePluginState = _ref14.tablePluginState,
|
|
264
|
+
tableWidthPluginState = _ref14.tableWidthPluginState,
|
|
265
|
+
dragAndDropState = _ref14.dragAndDropState;
|
|
255
266
|
var state = editorView.state;
|
|
256
267
|
var isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
|
|
257
268
|
var isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
|
|
258
269
|
var isResizing = isColumnResizing || isTableResizing;
|
|
259
|
-
var
|
|
260
|
-
tableNode =
|
|
261
|
-
tablePos =
|
|
262
|
-
targetCellPosition =
|
|
263
|
-
isContextualMenuOpen =
|
|
264
|
-
layout =
|
|
265
|
-
tableRef =
|
|
266
|
-
pluginConfig =
|
|
267
|
-
insertColumnButtonIndex =
|
|
268
|
-
insertRowButtonIndex =
|
|
269
|
-
isHeaderColumnEnabled =
|
|
270
|
-
isHeaderRowEnabled =
|
|
271
|
-
isDragAndDropEnabled =
|
|
272
|
-
tableWrapperTarget =
|
|
270
|
+
var _ref15 = tablePluginState,
|
|
271
|
+
tableNode = _ref15.tableNode,
|
|
272
|
+
tablePos = _ref15.tablePos,
|
|
273
|
+
targetCellPosition = _ref15.targetCellPosition,
|
|
274
|
+
isContextualMenuOpen = _ref15.isContextualMenuOpen,
|
|
275
|
+
layout = _ref15.layout,
|
|
276
|
+
tableRef = _ref15.tableRef,
|
|
277
|
+
pluginConfig = _ref15.pluginConfig,
|
|
278
|
+
insertColumnButtonIndex = _ref15.insertColumnButtonIndex,
|
|
279
|
+
insertRowButtonIndex = _ref15.insertRowButtonIndex,
|
|
280
|
+
isHeaderColumnEnabled = _ref15.isHeaderColumnEnabled,
|
|
281
|
+
isHeaderRowEnabled = _ref15.isHeaderRowEnabled,
|
|
282
|
+
isDragAndDropEnabled = _ref15.isDragAndDropEnabled,
|
|
283
|
+
tableWrapperTarget = _ref15.tableWrapperTarget;
|
|
273
284
|
var allowControls = pluginConfig.allowControls;
|
|
274
285
|
var stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
|
|
275
286
|
var LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
|
|
@@ -347,8 +358,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
|
|
|
347
358
|
}));
|
|
348
359
|
},
|
|
349
360
|
pluginsOptions: {
|
|
350
|
-
quickInsert: function quickInsert(
|
|
351
|
-
var formatMessage =
|
|
361
|
+
quickInsert: function quickInsert(_ref16) {
|
|
362
|
+
var formatMessage = _ref16.formatMessage;
|
|
352
363
|
return [{
|
|
353
364
|
id: 'table',
|
|
354
365
|
title: formatMessage(messages.table),
|
|
@@ -14,10 +14,9 @@ import classnames from 'classnames';
|
|
|
14
14
|
import memoizeOne from 'memoize-one';
|
|
15
15
|
import rafSchedule from 'raf-schd';
|
|
16
16
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
17
|
-
import { createDispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
18
17
|
import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
|
|
19
18
|
import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
20
|
-
import {
|
|
19
|
+
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
21
20
|
import { MAX_BROWSER_SCROLLBAR_HEIGHT, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
22
21
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
23
22
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
@@ -190,25 +189,22 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
190
189
|
_defineProperty(_assertThisInitialized(_this), "setTimerToSendInitialOverflowCaptured", function (isOverflowing) {
|
|
191
190
|
var _this$state;
|
|
192
191
|
var _this$props3 = _this.props,
|
|
193
|
-
|
|
192
|
+
dispatchAnalyticsEvent = _this$props3.dispatchAnalyticsEvent,
|
|
194
193
|
containerWidth = _this$props3.containerWidth,
|
|
195
194
|
options = _this$props3.options;
|
|
196
|
-
var dispatch = createDispatch(eventDispatcher);
|
|
197
195
|
var parentWidth = ((_this$state = _this.state) === null || _this$state === void 0 ? void 0 : _this$state.parentWidth) || 0;
|
|
198
196
|
_this.initialOverflowCaptureTimerId = setTimeout(function () {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
parentWidth: parentWidth
|
|
211
|
-
}
|
|
197
|
+
dispatchAnalyticsEvent({
|
|
198
|
+
action: TABLE_ACTION.INITIAL_OVERFLOW_CAPTURED,
|
|
199
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
200
|
+
actionSubjectId: null,
|
|
201
|
+
eventType: EVENT_TYPE.TRACK,
|
|
202
|
+
attributes: {
|
|
203
|
+
editorWidth: containerWidth.width || 0,
|
|
204
|
+
isOverflowing: isOverflowing,
|
|
205
|
+
tableResizingEnabled: (options === null || options === void 0 ? void 0 : options.isTableResizingEnabled) || false,
|
|
206
|
+
width: _this.node.attrs.width || 0,
|
|
207
|
+
parentWidth: parentWidth
|
|
212
208
|
}
|
|
213
209
|
});
|
|
214
210
|
_this.isInitialOverflowSent = true;
|
|
@@ -135,10 +135,10 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
135
135
|
isResizing.current = true;
|
|
136
136
|
var dispatch = editorView.dispatch,
|
|
137
137
|
tr = editorView.state.tr;
|
|
138
|
+
displayGapCursor(false);
|
|
138
139
|
tr.setMeta(tableWidthPluginKey, {
|
|
139
140
|
resizing: true
|
|
140
141
|
});
|
|
141
|
-
displayGapCursor(false);
|
|
142
142
|
tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
|
|
143
143
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
144
144
|
});
|
|
@@ -177,6 +177,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
177
177
|
containerWidth: containerWidth,
|
|
178
178
|
contentDOM: forwardRef,
|
|
179
179
|
getEditorFeatureFlags: props.getEditorFeatureFlags,
|
|
180
|
+
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
180
181
|
pluginInjectionApi: props.pluginInjectionApi
|
|
181
182
|
});
|
|
182
183
|
}
|
|
@@ -243,7 +244,7 @@ var TableView = /*#__PURE__*/function (_ReactNodeView) {
|
|
|
243
244
|
return TableView;
|
|
244
245
|
}(ReactNodeView);
|
|
245
246
|
export { TableView as default };
|
|
246
|
-
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi) {
|
|
247
|
+
export var createTableView = function createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi) {
|
|
247
248
|
var _getPluginState2 = getPluginState(view.state),
|
|
248
249
|
pluginConfig = _getPluginState2.pluginConfig,
|
|
249
250
|
isBreakoutEnabled = _getPluginState2.isBreakoutEnabled,
|
|
@@ -270,6 +271,7 @@ export var createTableView = function createTableView(node, view, getPos, portal
|
|
|
270
271
|
},
|
|
271
272
|
getEditorContainerWidth: getEditorContainerWidth,
|
|
272
273
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
274
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
273
275
|
hasIntlContext: hasIntlContext,
|
|
274
276
|
pluginInjectionApi: pluginInjectionApi
|
|
275
277
|
}).init();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export var AnalyticPluginTypes = /*#__PURE__*/function (AnalyticPluginTypes) {
|
|
2
|
+
AnalyticPluginTypes[AnalyticPluginTypes["UpdateOverflowTriggerNameAction"] = 0] = "UpdateOverflowTriggerNameAction";
|
|
3
|
+
AnalyticPluginTypes[AnalyticPluginTypes["UpdateRowOrColumnMovedAction"] = 1] = "UpdateRowOrColumnMovedAction";
|
|
4
|
+
AnalyticPluginTypes[AnalyticPluginTypes["RemoveRowOrColumnMovedAction"] = 2] = "RemoveRowOrColumnMovedAction";
|
|
5
|
+
AnalyticPluginTypes[AnalyticPluginTypes["RemoveOverFlowTriggerNameAction"] = 3] = "RemoveOverFlowTriggerNameAction";
|
|
6
|
+
AnalyticPluginTypes[AnalyticPluginTypes["UpdateRowOrColumnMovedAndOverflowTrigger"] = 4] = "UpdateRowOrColumnMovedAndOverflowTrigger";
|
|
7
|
+
return AnalyticPluginTypes;
|
|
8
|
+
}({});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AnalyticPluginTypes } from './actions';
|
|
2
|
+
import { createCommand, getPluginState } from './plugin-factory';
|
|
3
|
+
import { pluginKey } from './plugin-key';
|
|
4
|
+
import { getMovedPayload } from './utils/moved-event';
|
|
5
|
+
export var updateRowOrColumnMoved = function updateRowOrColumnMoved(nextState, nextAction) {
|
|
6
|
+
return createCommand(function (state) {
|
|
7
|
+
var _getPluginState = getPluginState(state),
|
|
8
|
+
rowOrColumnMoved = _getPluginState.rowOrColumnMoved;
|
|
9
|
+
var data = getMovedPayload(nextState, nextAction, rowOrColumnMoved);
|
|
10
|
+
return {
|
|
11
|
+
type: AnalyticPluginTypes.UpdateRowOrColumnMovedAction,
|
|
12
|
+
data: data
|
|
13
|
+
};
|
|
14
|
+
}, function (tr) {
|
|
15
|
+
return tr.setMeta('addToHistory', false);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// --- transforms, prefer these over commands to avoid an extra 'dispatch'
|
|
20
|
+
export var resetRowOrColumnMovedTransform = function resetRowOrColumnMovedTransform() {
|
|
21
|
+
return function (tr) {
|
|
22
|
+
var payload = {
|
|
23
|
+
type: AnalyticPluginTypes.RemoveRowOrColumnMovedAction
|
|
24
|
+
};
|
|
25
|
+
return tr.setMeta(pluginKey, payload);
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export var updateRowOrColumnMovedTransform = function updateRowOrColumnMovedTransform(nextState, nextAction) {
|
|
29
|
+
return function (state, tr) {
|
|
30
|
+
var _getPluginState2 = getPluginState(state),
|
|
31
|
+
rowOrColumnMoved = _getPluginState2.rowOrColumnMoved;
|
|
32
|
+
var data = getMovedPayload(nextState, nextAction, rowOrColumnMoved);
|
|
33
|
+
var payload = {
|
|
34
|
+
type: AnalyticPluginTypes.UpdateRowOrColumnMovedAction,
|
|
35
|
+
data: data
|
|
36
|
+
};
|
|
37
|
+
return tr.setMeta(pluginKey, payload);
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { pluginFactory } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { pluginKey } from './plugin-key';
|
|
3
|
+
import { reducer } from './reducer';
|
|
4
|
+
var _pluginFactory = pluginFactory(pluginKey, reducer),
|
|
5
|
+
createPluginState = _pluginFactory.createPluginState,
|
|
6
|
+
createCommand = _pluginFactory.createCommand,
|
|
7
|
+
getPluginState = _pluginFactory.getPluginState;
|
|
8
|
+
export { createPluginState, createCommand, getPluginState };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { countCellsInSlice, getTableElementMoveTypeBySlice, getTableSelectionType, isInsideFirstCellOfRowOrColumn } from '../../commands/misc';
|
|
5
|
+
import { resetRowOrColumnMovedTransform, updateRowOrColumnMoved } from './commands';
|
|
6
|
+
import { createPluginState } from './plugin-factory';
|
|
7
|
+
import { pluginKey } from './plugin-key';
|
|
8
|
+
import { defaultState } from './types';
|
|
9
|
+
export var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent) {
|
|
10
|
+
return new SafePlugin({
|
|
11
|
+
key: pluginKey,
|
|
12
|
+
state: createPluginState(dispatch, defaultState),
|
|
13
|
+
appendTransaction: function appendTransaction(transactions, oldState, newState) {
|
|
14
|
+
var tr = transactions.find(function (tr) {
|
|
15
|
+
var _tr$getMeta;
|
|
16
|
+
return (_tr$getMeta = tr.getMeta(pluginKey)) === null || _tr$getMeta === void 0 || (_tr$getMeta = _tr$getMeta.data) === null || _tr$getMeta === void 0 || (_tr$getMeta = _tr$getMeta.currentActions) === null || _tr$getMeta === void 0 ? void 0 : _tr$getMeta.includes('pasted');
|
|
17
|
+
});
|
|
18
|
+
if (tr) {
|
|
19
|
+
var _tr$getMeta2;
|
|
20
|
+
dispatchAnalyticsEvent({
|
|
21
|
+
action: TABLE_ACTION.ROW_OR_COLUMN_MOVED,
|
|
22
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
23
|
+
actionSubjectId: null,
|
|
24
|
+
eventType: EVENT_TYPE.TRACK,
|
|
25
|
+
attributes: {
|
|
26
|
+
type: (_tr$getMeta2 = tr.getMeta(pluginKey)) === null || _tr$getMeta2 === void 0 || (_tr$getMeta2 = _tr$getMeta2.data) === null || _tr$getMeta2 === void 0 ? void 0 : _tr$getMeta2.type
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return resetRowOrColumnMovedTransform()(tr);
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
},
|
|
33
|
+
props: {
|
|
34
|
+
handlePaste: function handlePaste(_ref, event, slice) {
|
|
35
|
+
var state = _ref.state,
|
|
36
|
+
dispatch = _ref.dispatch;
|
|
37
|
+
if (getBooleanFF('platform.editor.table.analytics-plugin-moved-event')) {
|
|
38
|
+
var schema = state.schema;
|
|
39
|
+
var type = getTableElementMoveTypeBySlice(slice, state);
|
|
40
|
+
|
|
41
|
+
// if the selection wasn't in the first cell of a row or column, don't count it
|
|
42
|
+
if (!isInsideFirstCellOfRowOrColumn(state.selection, type)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
var count = countCellsInSlice(slice, schema, type);
|
|
46
|
+
updateRowOrColumnMoved({
|
|
47
|
+
numberOfCells: count,
|
|
48
|
+
type: type
|
|
49
|
+
}, 'pasted')(state, dispatch);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
transformCopied: function transformCopied(slice, _ref2) {
|
|
53
|
+
var state = _ref2.state,
|
|
54
|
+
dispatch = _ref2.dispatch;
|
|
55
|
+
if (getBooleanFF('platform.editor.table.analytics-plugin-moved-event')) {
|
|
56
|
+
var schema = state.schema;
|
|
57
|
+
var type = getTableSelectionType(state.selection);
|
|
58
|
+
var count = countCellsInSlice(slice, schema, type);
|
|
59
|
+
updateRowOrColumnMoved({
|
|
60
|
+
numberOfCells: count,
|
|
61
|
+
type: type
|
|
62
|
+
}, 'copyOrCut')(state, dispatch);
|
|
63
|
+
}
|
|
64
|
+
return slice;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { AnalyticPluginTypes } from './actions';
|
|
5
|
+
import { defaultState } from './types';
|
|
6
|
+
export var reducer = function reducer(state, action) {
|
|
7
|
+
switch (action.type) {
|
|
8
|
+
case AnalyticPluginTypes.UpdateRowOrColumnMovedAction:
|
|
9
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
10
|
+
rowOrColumnMoved: _objectSpread(_objectSpread({}, state.rowOrColumnMoved), action.data)
|
|
11
|
+
});
|
|
12
|
+
case AnalyticPluginTypes.RemoveRowOrColumnMovedAction:
|
|
13
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
14
|
+
rowOrColumnMoved: defaultState.rowOrColumnMoved
|
|
15
|
+
});
|
|
16
|
+
default:
|
|
17
|
+
return state;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { defaultState } from '../types';
|
|
3
|
+
var getNextActionType = function getNextActionType(nextState, nextAction, prevState) {
|
|
4
|
+
if (nextAction === 'pasted') {
|
|
5
|
+
if (prevState && prevState.currentActions.includes('copyOrCut') && prevState.currentActions.includes('addRowOrColumn') && prevState.numberOfCells === nextState.numberOfCells && prevState.type === nextState.type) {
|
|
6
|
+
return 'pasted';
|
|
7
|
+
}
|
|
8
|
+
return 'none';
|
|
9
|
+
}
|
|
10
|
+
return nextAction;
|
|
11
|
+
};
|
|
12
|
+
export var getMovedPayload = function getMovedPayload(nextState, nextAction, prevState) {
|
|
13
|
+
var nextActionType = getNextActionType(nextState, nextAction, prevState);
|
|
14
|
+
if (nextActionType === 'none') {
|
|
15
|
+
return defaultState.rowOrColumnMoved;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// a new workflow has started in the opposite axis (e.g. inserted a row, but copied a column) remove old state
|
|
19
|
+
if (prevState.type !== nextState.type) {
|
|
20
|
+
return {
|
|
21
|
+
currentActions: [nextActionType],
|
|
22
|
+
numberOfCells: nextState === null || nextState === void 0 ? void 0 : nextState.numberOfCells,
|
|
23
|
+
type: nextState.type
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
currentActions: prevState.currentActions.includes(nextActionType) ? prevState.currentActions : [].concat(_toConsumableArray(prevState.currentActions), [nextActionType]),
|
|
28
|
+
numberOfCells: (nextState === null || nextState === void 0 ? void 0 : nextState.numberOfCells) || prevState.numberOfCells,
|
|
29
|
+
type: nextState === null || nextState === void 0 ? void 0 : nextState.type
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -225,7 +225,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
|
|
|
225
225
|
},
|
|
226
226
|
nodeViews: {
|
|
227
227
|
table: function table(node, view, getPos) {
|
|
228
|
-
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi);
|
|
228
|
+
return createTableView(node, view, getPos, portalProviderAPI, eventDispatcher, getEditorContainerWidth, getEditorFeatureFlags, dispatchAnalyticsEvent, pluginInjectionApi);
|
|
229
229
|
},
|
|
230
230
|
tableRow: function tableRow(node, view, getPos) {
|
|
231
231
|
return new TableRow(node, view, getPos, eventDispatcher);
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
8
8
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
9
9
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
10
|
-
export var pluginKey = new PluginKey('
|
|
10
|
+
export var pluginKey = new PluginKey('tableOverflowAnalyticsPlugin');
|
|
11
11
|
export var META_KEYS = {
|
|
12
12
|
OVERFLOW_TRIGGER: 'tableOverflowTrigger',
|
|
13
13
|
OVERFLOW_STATE_CHANGED: 'tableOverflowStateChanged'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
export declare const setEditorFocus: (editorHasFocus: boolean) => Command;
|
|
@@ -10,6 +10,10 @@ export declare const triggerUnlessTableHeader: (command: Command) => Command;
|
|
|
10
10
|
export declare const transformSliceRemoveCellBackgroundColor: (slice: Slice, schema: Schema) => Slice;
|
|
11
11
|
export declare const transformSliceToAddTableHeaders: (slice: Slice, schema: Schema) => Slice;
|
|
12
12
|
export declare const transformSliceToRemoveColumnsWidths: (slice: Slice, schema: Schema) => Slice;
|
|
13
|
+
export declare const countCellsInSlice: (slice: Slice, schema: Schema, type?: 'row' | 'column') => number;
|
|
14
|
+
export declare const getTableSelectionType: (selection: Selection) => "row" | "column" | undefined;
|
|
15
|
+
export declare const getTableElementMoveTypeBySlice: (slice: Slice, state: EditorState) => "row" | "column" | undefined;
|
|
16
|
+
export declare const isInsideFirstCellOfRowOrColumn: (selection: Selection, type?: 'row' | 'column') => boolean | undefined;
|
|
13
17
|
export declare const deleteTable: Command;
|
|
14
18
|
export declare const deleteTableIfSelected: Command;
|
|
15
19
|
export declare const convertFirstRowToHeader: (schema: Schema) => (tr: Transaction) => Transaction;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
3
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
5
|
import type { EditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
6
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -26,6 +27,7 @@ export interface ComponentProps {
|
|
|
26
27
|
ordering: TableColumnOrdering;
|
|
27
28
|
isResizing?: boolean;
|
|
28
29
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
30
|
+
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
29
31
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
30
32
|
}
|
|
31
33
|
interface TableState {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
4
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
5
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
@@ -29,5 +30,5 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
29
30
|
}): boolean;
|
|
30
31
|
destroy(): void;
|
|
31
32
|
}
|
|
32
|
-
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, pluginInjectionApi?: PluginInjectionAPI) => NodeView;
|
|
33
|
+
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI) => NodeView;
|
|
33
34
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
3
4
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
@@ -22,6 +23,7 @@ export interface Props {
|
|
|
22
23
|
options?: TableOptions;
|
|
23
24
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
24
25
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
26
|
+
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
25
27
|
hasIntlContext: boolean;
|
|
26
28
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
27
29
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { RowOrColumnMovedState } from './types';
|
|
2
|
+
export declare enum AnalyticPluginTypes {
|
|
3
|
+
UpdateOverflowTriggerNameAction = 0,
|
|
4
|
+
UpdateRowOrColumnMovedAction = 1,
|
|
5
|
+
RemoveRowOrColumnMovedAction = 2,
|
|
6
|
+
RemoveOverFlowTriggerNameAction = 3,
|
|
7
|
+
UpdateRowOrColumnMovedAndOverflowTrigger = 4
|
|
8
|
+
}
|
|
9
|
+
export type UpdateRowOrColumnMovedAction = {
|
|
10
|
+
type: AnalyticPluginTypes.UpdateRowOrColumnMovedAction;
|
|
11
|
+
data: RowOrColumnMovedState;
|
|
12
|
+
};
|
|
13
|
+
export type RemoveRowOrColumnMovedAction = {
|
|
14
|
+
type: AnalyticPluginTypes.RemoveRowOrColumnMovedAction;
|
|
15
|
+
data: undefined;
|
|
16
|
+
};
|
|
17
|
+
export type AnalyticPluginAction = UpdateRowOrColumnMovedAction | RemoveRowOrColumnMovedAction;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { ActionType, RowOrColumnMovedState } from './types';
|
|
3
|
+
export declare const updateRowOrColumnMoved: (nextState: Omit<RowOrColumnMovedState, 'currentActions'>, nextAction: ActionType) => import("@atlaskit/editor-common/types").Command;
|
|
4
|
+
export declare const resetRowOrColumnMovedTransform: () => (tr: Transaction) => Transaction;
|
|
5
|
+
export declare const updateRowOrColumnMovedTransform: (nextState: Omit<RowOrColumnMovedState, 'currentActions'>, nextAction: ActionType) => (state: EditorState, tr: Transaction) => Transaction;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: import("./types").AnalyticPluginState | ((state: import("prosemirror-state").EditorState) => import("./types").AnalyticPluginState)) => import("prosemirror-state").SafeStateField<import("./types").AnalyticPluginState>, createCommand: <A = import("./actions").AnalyticPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("./types").AnalyticPluginState;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
4
|
+
export declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent) => SafePlugin<import("./types").AnalyticPluginState>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type ActionType = 'none' | 'addRowOrColumn' | 'copyOrCut' | 'pasted';
|
|
2
|
+
export type RowOrColumnMovedState = {
|
|
3
|
+
type?: 'row' | 'column';
|
|
4
|
+
/** used to confirm if same number of cells was copied and pasted */
|
|
5
|
+
numberOfCells?: number;
|
|
6
|
+
currentActions: Array<ActionType>;
|
|
7
|
+
};
|
|
8
|
+
export type AnalyticPluginState = {
|
|
9
|
+
rowOrColumnMoved: RowOrColumnMovedState;
|
|
10
|
+
};
|
|
11
|
+
export declare const defaultState: AnalyticPluginState;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ActionType, RowOrColumnMovedState } from '../types';
|
|
2
|
+
export declare const getMovedPayload: (nextState: Omit<RowOrColumnMovedState, 'currentActions'>, nextAction: ActionType, prevState: RowOrColumnMovedState) => RowOrColumnMovedState | {
|
|
3
|
+
currentActions: string[];
|
|
4
|
+
numberOfCells: number | undefined;
|
|
5
|
+
type: "row" | "column" | undefined;
|
|
6
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
2
2
|
import type { Node as PMNode, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorState, Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
5
5
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
6
6
|
export declare const setEditorFocus: (editorHasFocus: boolean) => Command;
|
|
@@ -10,6 +10,10 @@ export declare const triggerUnlessTableHeader: (command: Command) => Command;
|
|
|
10
10
|
export declare const transformSliceRemoveCellBackgroundColor: (slice: Slice, schema: Schema) => Slice;
|
|
11
11
|
export declare const transformSliceToAddTableHeaders: (slice: Slice, schema: Schema) => Slice;
|
|
12
12
|
export declare const transformSliceToRemoveColumnsWidths: (slice: Slice, schema: Schema) => Slice;
|
|
13
|
+
export declare const countCellsInSlice: (slice: Slice, schema: Schema, type?: 'row' | 'column') => number;
|
|
14
|
+
export declare const getTableSelectionType: (selection: Selection) => "row" | "column" | undefined;
|
|
15
|
+
export declare const getTableElementMoveTypeBySlice: (slice: Slice, state: EditorState) => "row" | "column" | undefined;
|
|
16
|
+
export declare const isInsideFirstCellOfRowOrColumn: (selection: Selection, type?: 'row' | 'column') => boolean | undefined;
|
|
13
17
|
export declare const deleteTable: Command;
|
|
14
18
|
export declare const deleteTableIfSelected: Command;
|
|
15
19
|
export declare const convertFirstRowToHeader: (schema: Schema) => (tr: Transaction) => Transaction;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TableColumnOrdering } from '@atlaskit/custom-steps';
|
|
3
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
4
5
|
import type { EditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
5
6
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -26,6 +27,7 @@ export interface ComponentProps {
|
|
|
26
27
|
ordering: TableColumnOrdering;
|
|
27
28
|
isResizing?: boolean;
|
|
28
29
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
30
|
+
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
29
31
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
30
32
|
}
|
|
31
33
|
interface TableState {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
4
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
5
|
import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
@@ -29,5 +30,5 @@ export default class TableView extends ReactNodeView<Props> {
|
|
|
29
30
|
}): boolean;
|
|
30
31
|
destroy(): void;
|
|
31
32
|
}
|
|
32
|
-
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, pluginInjectionApi?: PluginInjectionAPI) => NodeView;
|
|
33
|
+
export declare const createTableView: (node: PmNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, dispatchAnalyticsEvent: DispatchAnalyticsEvent, pluginInjectionApi?: PluginInjectionAPI) => NodeView;
|
|
33
34
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
1
2
|
import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
2
3
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
3
4
|
import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
@@ -22,6 +23,7 @@ export interface Props {
|
|
|
22
23
|
options?: TableOptions;
|
|
23
24
|
getEditorContainerWidth: GetEditorContainerWidth;
|
|
24
25
|
getEditorFeatureFlags: GetEditorFeatureFlags;
|
|
26
|
+
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
25
27
|
hasIntlContext: boolean;
|
|
26
28
|
pluginInjectionApi?: PluginInjectionAPI;
|
|
27
29
|
}
|