UNPKG

@atlaskit/editor-plugin-table

Version:

Table plugin for the @atlaskit/editor

559 lines (558 loc) 25.3 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; 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; } 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; } import { tableBackgroundColorPalette } from '@atlaskit/adf-schema'; import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_DISPLAY_MODE } from '@atlaskit/editor-common/analytics'; import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset'; import { CellSelection } from '@atlaskit/editor-tables/cell-selection'; import { TableMap } from '@atlaskit/editor-tables/table-map'; import { findCellClosestToPos, findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils'; import { getPluginState } from '../plugin-factory'; import { distributeColumnsWidths } from '../table-resizing/commands'; import { deleteRows } from '../transforms/delete-rows'; import { mergeCells } from '../transforms/merge'; import { withEditorAnalyticsAPI, getSelectedCellInfo, getSelectedTableInfo } from '../utils/analytics'; import { checkIfNumberColumnEnabled } from '../utils/nodes'; import { clearMultipleCells } from './clear'; import { wrapTableInExpand } from './collapse'; import { changeColumnWidthByStep } from './column-resize'; import { deleteColumnsCommand } from './delete'; import { setTableDisplayMode } from './display-mode'; import { insertColumn, insertRow } from './insert'; import { deleteTable, deleteTableIfSelected, getTableSelectionType, setMultipleCellAttrs, setTableAlignment, setTableAlignmentWithTableContentWithPos } from './misc'; import { sortByColumn } from './sort'; import { splitCell } from './split-cell'; import { toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn } from './toggle'; // #region Analytics wrappers export var emptyMultipleCellsWithAnalytics = function emptyMultipleCellsWithAnalytics(editorAnalyticsAPI) { return function (inputMethod, targetCellPosition) { return withEditorAnalyticsAPI(function (_ref) { var selection = _ref.selection; var _getSelectedCellInfo = getSelectedCellInfo(selection), horizontalCells = _getSelectedCellInfo.horizontalCells, verticalCells = _getSelectedCellInfo.verticalCells, totalRowCount = _getSelectedCellInfo.totalRowCount, totalColumnCount = _getSelectedCellInfo.totalColumnCount; return { action: TABLE_ACTION.CLEARED, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { inputMethod: inputMethod, horizontalCells: horizontalCells, verticalCells: verticalCells, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(clearMultipleCells(targetCellPosition)); }; }; export var mergeCellsWithAnalytics = function mergeCellsWithAnalytics(editorAnalyticsAPI) { return function (inputMethod) { return withEditorAnalyticsAPI(function (_ref2) { var selection = _ref2.selection; var _getSelectedCellInfo2 = getSelectedCellInfo(selection), horizontalCells = _getSelectedCellInfo2.horizontalCells, verticalCells = _getSelectedCellInfo2.verticalCells, totalCells = _getSelectedCellInfo2.totalCells, totalRowCount = _getSelectedCellInfo2.totalRowCount, totalColumnCount = _getSelectedCellInfo2.totalColumnCount; return { action: TABLE_ACTION.MERGED, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { inputMethod: inputMethod, horizontalCells: horizontalCells, verticalCells: verticalCells, totalCells: totalCells, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(function (state, dispatch) { if (dispatch) { dispatch(mergeCells(state.tr)); } return true; }); }; }; export var splitCellWithAnalytics = function splitCellWithAnalytics(editorAnalyticsAPI) { return function (inputMethod) { return withEditorAnalyticsAPI(function (_ref3) { var selection = _ref3.selection; var _getSelectedCellInfo3 = getSelectedCellInfo(selection), totalRowCount = _getSelectedCellInfo3.totalRowCount, totalColumnCount = _getSelectedCellInfo3.totalColumnCount; var cell = findCellClosestToPos(selection.$anchor); if (cell) { var _cell$node$attrs = cell.node.attrs, verticalCells = _cell$node$attrs.rowspan, horizontalCells = _cell$node$attrs.colspan; return { action: TABLE_ACTION.SPLIT, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { inputMethod: inputMethod, horizontalCells: horizontalCells, verticalCells: verticalCells, totalCells: horizontalCells * verticalCells, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; } return; })(editorAnalyticsAPI)(splitCell); }; }; export var setColorWithAnalytics = function setColorWithAnalytics(editorAnalyticsAPI) { return function (inputMethod, cellColor, editorView) { return withEditorAnalyticsAPI(function (_ref4) { var selection = _ref4.selection; var _getSelectedCellInfo4 = getSelectedCellInfo(selection), horizontalCells = _getSelectedCellInfo4.horizontalCells, verticalCells = _getSelectedCellInfo4.verticalCells, totalCells = _getSelectedCellInfo4.totalCells, totalRowCount = _getSelectedCellInfo4.totalRowCount, totalColumnCount = _getSelectedCellInfo4.totalColumnCount; return { action: TABLE_ACTION.COLORED, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { inputMethod: inputMethod, cellColor: (tableBackgroundColorPalette.get(cellColor.toLowerCase()) || cellColor).toLowerCase(), horizontalCells: horizontalCells, verticalCells: verticalCells, totalCells: totalCells, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(setMultipleCellAttrs({ background: cellColor }, editorView)); }; }; export var addRowAroundSelection = function addRowAroundSelection(editorAnalyticsAPI) { return function (side) { return function (state, dispatch) { var selection = state.selection; var isCellSelection = selection instanceof CellSelection; var rect = isCellSelection ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from); if (!rect) { return false; } var position = isCellSelection && side === 'TOP' ? rect.top : rect.bottom - 1; var offset = side === 'BOTTOM' ? 1 : 0; return insertRowWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, { index: position + offset, moveCursorToInsertedRow: false })(state, dispatch); }; }; }; export var insertRowWithAnalytics = function insertRowWithAnalytics(editorAnalyticsAPI) { return function (inputMethod, options) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo = getSelectedTableInfo(state.selection), totalRowCount = _getSelectedTableInfo.totalRowCount, totalColumnCount = _getSelectedTableInfo.totalColumnCount; return { action: TABLE_ACTION.ADDED_ROW, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { inputMethod: inputMethod, position: options.index, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(insertRow(options.index, options.moveCursorToInsertedRow)); }; }; export var changeColumnWidthByStepWithAnalytics = function changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI, api) { return function (stepSize, getEditorContainerWidth, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, isCommentEditor, inputMethod, ariaNotify, getIntl) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo2 = getSelectedTableInfo(state.selection), table = _getSelectedTableInfo2.table, totalRowCount = _getSelectedTableInfo2.totalRowCount, totalColumnCount = _getSelectedTableInfo2.totalColumnCount; var _getPluginState = getPluginState(state), colIndex = _getPluginState.hoveredCell.colIndex; return { action: TABLE_ACTION.COLUMN_RESIZED, actionSubject: ACTION_SUBJECT.TABLE, eventType: EVENT_TYPE.TRACK, attributes: { colIndex: colIndex, resizedDelta: stepSize, isLastColumn: colIndex === totalColumnCount - 1, tableWidth: table === null || table === void 0 ? void 0 : table.node.attrs.width, inputMethod: inputMethod, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount } }; })(editorAnalyticsAPI)(changeColumnWidthByStep({ stepSize: stepSize, getEditorContainerWidth: getEditorContainerWidth, isTableScalingEnabled: isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled: isTableFixedColumnWidthsOptionEnabled, isCommentEditor: isCommentEditor, ariaNotify: ariaNotify, getIntl: getIntl, api: api })); }; }; export var insertColumnWithAnalytics = function insertColumnWithAnalytics(api, editorAnalyticsAPI) { var isTableScalingEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var isTableFixedColumnWidthsOptionEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; var shouldUseIncreasedScalingPercent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; var isCommentEditor = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; return function (inputMethod, position) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo3 = getSelectedTableInfo(state.selection), totalRowCount = _getSelectedTableInfo3.totalRowCount, totalColumnCount = _getSelectedTableInfo3.totalColumnCount; return { action: TABLE_ACTION.ADDED_COLUMN, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { inputMethod: inputMethod, position: position, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(insertColumn(api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)(position)); }; }; export var deleteRowsWithAnalytics = function deleteRowsWithAnalytics(editorAnalyticsAPI) { return function (inputMethod, rect, isHeaderRowRequired) { return withEditorAnalyticsAPI(function (_ref5) { var selection = _ref5.selection; var _getSelectedTableInfo4 = getSelectedTableInfo(selection), totalRowCount = _getSelectedTableInfo4.totalRowCount, totalColumnCount = _getSelectedTableInfo4.totalColumnCount; return { action: TABLE_ACTION.DELETED_ROW, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { inputMethod: inputMethod, position: rect.top, count: rect.bottom - rect.top, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(function (state, dispatch) { if (dispatch) { dispatch(deleteRows(rect, isHeaderRowRequired)(state.tr)); } return true; }); }; }; export var deleteColumnsWithAnalytics = function deleteColumnsWithAnalytics(editorAnalyticsAPI, api) { var isTableScalingEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var isTableFixedColumnWidthsOptionEnabled = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; var shouldUseIncreasedScalingPercent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; var isCommentEditor = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; return function (inputMethod, rect) { return withEditorAnalyticsAPI(function (_ref6) { var selection = _ref6.selection; var _getSelectedTableInfo5 = getSelectedTableInfo(selection), totalRowCount = _getSelectedTableInfo5.totalRowCount, totalColumnCount = _getSelectedTableInfo5.totalColumnCount; return { action: TABLE_ACTION.DELETED_COLUMN, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { inputMethod: inputMethod, position: rect.left, count: rect.right - rect.left, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(deleteColumnsCommand(rect, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor)); }; }; export var deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut = function deleteSelectedRowsOrColumnsWithAnalyticsViaShortcut(editorAnalyticsAPI, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent) { return function (state, dispatch) { var selection = state.selection; var isCellSelection = selection instanceof CellSelection; if (!isCellSelection) { return false; } var rect = getSelectionRect(selection); if (!rect) { return false; } var selectionType = getTableSelectionType(selection); if (selectionType === 'row') { var _getPluginState2 = getPluginState(state), pluginConfig = _getPluginState2.pluginConfig; var isHeaderRowRequired = pluginConfig.isHeaderRowRequired || false; return deleteRowsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.SHORTCUT, rect, isHeaderRowRequired)(state, dispatch); } else if (selectionType === 'column') { return deleteColumnsWithAnalytics(editorAnalyticsAPI, api, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(INPUT_METHOD.SHORTCUT, rect)(state, dispatch); } else { return false; } }; }; var getTableDeletedAnalytics = function getTableDeletedAnalytics(selection, inputMethod) { var _getSelectedTableInfo6 = getSelectedTableInfo(selection), totalRowCount = _getSelectedTableInfo6.totalRowCount, totalColumnCount = _getSelectedTableInfo6.totalColumnCount; return { action: TABLE_ACTION.DELETED, actionSubject: ACTION_SUBJECT.TABLE, attributes: { inputMethod: inputMethod, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; }; export var deleteTableWithAnalytics = function deleteTableWithAnalytics(editorAnalyticsAPI) { return withEditorAnalyticsAPI(function (_ref7) { var selection = _ref7.selection; return getTableDeletedAnalytics(selection, INPUT_METHOD.FLOATING_TB); })(editorAnalyticsAPI)(deleteTable); }; export var deleteTableIfSelectedWithAnalytics = function deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI) { return function (inputMethod) { return withEditorAnalyticsAPI(function (_ref8) { var selection = _ref8.selection; return getTableDeletedAnalytics(selection, inputMethod); })(editorAnalyticsAPI)(deleteTableIfSelected); }; }; export var toggleHeaderRowWithAnalytics = function toggleHeaderRowWithAnalytics(editorAnalyticsAPI) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo7 = getSelectedTableInfo(state.selection), totalRowCount = _getSelectedTableInfo7.totalRowCount, totalColumnCount = _getSelectedTableInfo7.totalColumnCount; var _getPluginState3 = getPluginState(state), isHeaderRowEnabled = _getPluginState3.isHeaderRowEnabled; return { action: TABLE_ACTION.TOGGLED_HEADER_ROW, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { newState: !isHeaderRowEnabled, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(toggleHeaderRow); }; export var toggleHeaderColumnWithAnalytics = function toggleHeaderColumnWithAnalytics(editorAnalyticsAPI) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo8 = getSelectedTableInfo(state.selection), totalRowCount = _getSelectedTableInfo8.totalRowCount, totalColumnCount = _getSelectedTableInfo8.totalColumnCount; var _getPluginState4 = getPluginState(state), isHeaderColumnEnabled = _getPluginState4.isHeaderColumnEnabled; return { action: TABLE_ACTION.TOGGLED_HEADER_COLUMN, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { newState: !isHeaderColumnEnabled, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(toggleHeaderColumn); }; export var toggleNumberColumnWithAnalytics = function toggleNumberColumnWithAnalytics(editorAnalyticsAPI) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo9 = getSelectedTableInfo(state.selection), totalRowCount = _getSelectedTableInfo9.totalRowCount, totalColumnCount = _getSelectedTableInfo9.totalColumnCount; return { action: TABLE_ACTION.TOGGLED_NUMBER_COLUMN, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { newState: !checkIfNumberColumnEnabled(state.selection), totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(toggleNumberColumn); }; export var sortColumnWithAnalytics = function sortColumnWithAnalytics(editorAnalyticsAPI) { return function (inputMethod, columnIndex, sortOrder) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo0 = getSelectedTableInfo(state.selection), totalRowCount = _getSelectedTableInfo0.totalRowCount, totalColumnCount = _getSelectedTableInfo0.totalColumnCount; return { action: TABLE_ACTION.SORTED_COLUMN, actionSubject: ACTION_SUBJECT.TABLE, attributes: { inputMethod: inputMethod, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount, position: columnIndex, sortOrder: sortOrder, mode: 'editor' }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(sortByColumn(columnIndex, sortOrder)); }; }; export var distributeColumnsWidthsWithAnalytics = function distributeColumnsWidthsWithAnalytics(editorAnalyticsAPI, api) { return function (inputMethod, _ref9) { var resizeState = _ref9.resizeState, table = _ref9.table, attributes = _ref9.attributes; return withEditorAnalyticsAPI(function () { return { action: TABLE_ACTION.DISTRIBUTED_COLUMNS_WIDTHS, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: _objectSpread({ inputMethod: inputMethod }, attributes), eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(function (state, dispatch) { if (dispatch) { distributeColumnsWidths(resizeState, table, api)(state, dispatch); } return true; }); }; }; export var wrapTableInExpandWithAnalytics = function wrapTableInExpandWithAnalytics(editorAnalyticsAPI) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo1 = getSelectedTableInfo(state.selection), totalRowCount = _getSelectedTableInfo1.totalRowCount, totalColumnCount = _getSelectedTableInfo1.totalColumnCount; return { action: TABLE_ACTION.COLLAPSED, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, attributes: { totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(wrapTableInExpand); }; export var toggleFixedColumnWidthsOptionAnalytics = function toggleFixedColumnWidthsOptionAnalytics(editorAnalyticsAPI, inputMethod) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo10 = getSelectedTableInfo(state.selection), table = _getSelectedTableInfo10.table, totalRowCount = _getSelectedTableInfo10.totalRowCount, totalColumnCount = _getSelectedTableInfo10.totalColumnCount; var previousDisplayMode; var newDisplayMode; switch (table === null || table === void 0 ? void 0 : table.node.attrs.displayMode) { case 'fixed': previousDisplayMode = TABLE_DISPLAY_MODE.FIXED; newDisplayMode = TABLE_DISPLAY_MODE.DEFAULT; break; case 'default': previousDisplayMode = TABLE_DISPLAY_MODE.DEFAULT; newDisplayMode = TABLE_DISPLAY_MODE.FIXED; break; case null: default: previousDisplayMode = TABLE_DISPLAY_MODE.INITIAL; newDisplayMode = TABLE_DISPLAY_MODE.FIXED; } return { action: TABLE_ACTION.CHANGED_DISPLAY_MODE, actionSubject: ACTION_SUBJECT.TABLE, attributes: { inputMethod: inputMethod, previousDisplayMode: previousDisplayMode, newDisplayMode: newDisplayMode, tableWidth: table === null || table === void 0 ? void 0 : table.node.attrs.width, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount }, eventType: EVENT_TYPE.TRACK }; })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableDisplayMode)); }; export var setTableAlignmentWithAnalytics = function setTableAlignmentWithAnalytics(editorAnalyticsAPI, isCommentEditor) { return function (newAlignment, previousAlignment, inputMethod, reason) { return withEditorAnalyticsAPI(function (state) { var _getSelectedTableInfo11 = getSelectedTableInfo(state.selection), table = _getSelectedTableInfo11.table, totalRowCount = _getSelectedTableInfo11.totalRowCount, totalColumnCount = _getSelectedTableInfo11.totalColumnCount; return { action: TABLE_ACTION.CHANGED_ALIGNMENT, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, eventType: EVENT_TYPE.TRACK, attributes: { tableWidth: table === null || table === void 0 ? void 0 : table.node.attrs.width, newAlignment: newAlignment, previousAlignment: previousAlignment === 'center' || previousAlignment === 'align-start' ? previousAlignment : null, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount, inputMethod: inputMethod, reason: reason } }; })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableAlignment(newAlignment, isCommentEditor))); }; }; export var setTableAlignmentWithTableContentWithPosWithAnalytics = function setTableAlignmentWithTableContentWithPosWithAnalytics(editorAnalyticsAPI) { return function (newAlignment, previousAlignment, tableNodeWithPos, inputMethod, reason) { return withEditorAnalyticsAPI(function () { var map = TableMap.get(tableNodeWithPos.node); var totalRowCount = map.height; var totalColumnCount = map.width; var attributes = { tableWidth: tableNodeWithPos.node.attrs.width, newAlignment: newAlignment, previousAlignment: previousAlignment, totalRowCount: totalRowCount, totalColumnCount: totalColumnCount, inputMethod: inputMethod, reason: reason }; return { action: TABLE_ACTION.CHANGED_ALIGNMENT, actionSubject: ACTION_SUBJECT.TABLE, actionSubjectId: null, eventType: EVENT_TYPE.TRACK, attributes: attributes }; })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableAlignmentWithTableContentWithPos(newAlignment, tableNodeWithPos))); }; };