@atlaskit/editor-plugin-table 5.4.6 → 5.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/table/commands/insert.js +12 -2
  3. package/dist/cjs/plugins/table/commands/misc.js +63 -13
  4. package/dist/cjs/plugins/table/index.js +46 -35
  5. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +14 -20
  6. package/dist/cjs/plugins/table/nodeviews/TableResizer.js +1 -1
  7. package/dist/cjs/plugins/table/nodeviews/table.js +3 -1
  8. package/dist/cjs/plugins/table/pm-plugins/analytics/actions.js +14 -0
  9. package/dist/cjs/plugins/table/pm-plugins/analytics/commands.js +45 -0
  10. package/dist/cjs/plugins/table/pm-plugins/analytics/plugin-factory.js +13 -0
  11. package/dist/cjs/plugins/table/pm-plugins/analytics/plugin-key.js +8 -0
  12. package/dist/cjs/plugins/table/pm-plugins/analytics/plugin.js +74 -0
  13. package/dist/cjs/plugins/table/pm-plugins/analytics/reducer.js +26 -0
  14. package/dist/cjs/plugins/table/pm-plugins/analytics/types.js +13 -0
  15. package/dist/cjs/plugins/table/pm-plugins/analytics/utils/moved-event.js +38 -0
  16. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +9 -3
  17. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -3
  18. package/dist/cjs/plugins/table/pm-plugins/main.js +1 -1
  19. package/dist/cjs/plugins/table/pm-plugins/table-analytics.js +1 -1
  20. package/dist/cjs/plugins/table/types.js +2 -1
  21. package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +4 -1
  22. package/dist/cjs/plugins/table/ui/common-styles.js +6 -9
  23. package/dist/cjs/plugins/table/ui/ui-styles.js +12 -16
  24. package/dist/cjs/plugins/table/utils/decoration.js +20 -25
  25. package/dist/es2019/plugins/table/commands/insert.js +12 -3
  26. package/dist/es2019/plugins/table/commands/misc.js +54 -4
  27. package/dist/es2019/plugins/table/index.js +14 -4
  28. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +15 -21
  29. package/dist/es2019/plugins/table/nodeviews/TableResizer.js +1 -1
  30. package/dist/es2019/plugins/table/nodeviews/table.js +3 -1
  31. package/dist/es2019/plugins/table/pm-plugins/analytics/actions.js +8 -0
  32. package/dist/es2019/plugins/table/pm-plugins/analytics/commands.js +33 -0
  33. package/dist/es2019/plugins/table/pm-plugins/analytics/plugin-factory.js +8 -0
  34. package/dist/es2019/plugins/table/pm-plugins/analytics/plugin-key.js +2 -0
  35. package/dist/es2019/plugins/table/pm-plugins/analytics/plugin.js +72 -0
  36. package/dist/es2019/plugins/table/pm-plugins/analytics/reducer.js +21 -0
  37. package/dist/es2019/plugins/table/pm-plugins/analytics/types.js +7 -0
  38. package/dist/es2019/plugins/table/pm-plugins/analytics/utils/moved-event.js +30 -0
  39. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +9 -3
  40. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -3
  41. package/dist/es2019/plugins/table/pm-plugins/main.js +1 -1
  42. package/dist/es2019/plugins/table/pm-plugins/table-analytics.js +1 -1
  43. package/dist/es2019/plugins/table/types.js +2 -1
  44. package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +4 -1
  45. package/dist/es2019/plugins/table/ui/common-styles.js +20 -20
  46. package/dist/es2019/plugins/table/ui/ui-styles.js +18 -21
  47. package/dist/es2019/plugins/table/utils/decoration.js +20 -25
  48. package/dist/esm/plugins/table/commands/insert.js +12 -3
  49. package/dist/esm/plugins/table/commands/misc.js +61 -13
  50. package/dist/esm/plugins/table/index.js +43 -32
  51. package/dist/esm/plugins/table/nodeviews/TableComponent.js +15 -21
  52. package/dist/esm/plugins/table/nodeviews/TableResizer.js +1 -1
  53. package/dist/esm/plugins/table/nodeviews/table.js +3 -1
  54. package/dist/esm/plugins/table/pm-plugins/analytics/actions.js +8 -0
  55. package/dist/esm/plugins/table/pm-plugins/analytics/commands.js +39 -0
  56. package/dist/esm/plugins/table/pm-plugins/analytics/plugin-factory.js +8 -0
  57. package/dist/esm/plugins/table/pm-plugins/analytics/plugin-key.js +2 -0
  58. package/dist/esm/plugins/table/pm-plugins/analytics/plugin.js +68 -0
  59. package/dist/esm/plugins/table/pm-plugins/analytics/reducer.js +19 -0
  60. package/dist/esm/plugins/table/pm-plugins/analytics/types.js +7 -0
  61. package/dist/esm/plugins/table/pm-plugins/analytics/utils/moved-event.js +31 -0
  62. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +9 -3
  63. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +8 -3
  64. package/dist/esm/plugins/table/pm-plugins/main.js +1 -1
  65. package/dist/esm/plugins/table/pm-plugins/table-analytics.js +1 -1
  66. package/dist/esm/plugins/table/types.js +2 -1
  67. package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +4 -1
  68. package/dist/esm/plugins/table/ui/common-styles.js +6 -9
  69. package/dist/esm/plugins/table/ui/ui-styles.js +12 -16
  70. package/dist/esm/plugins/table/utils/decoration.js +20 -25
  71. package/dist/types/plugins/table/commands/misc.d.ts +5 -1
  72. package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +2 -0
  73. package/dist/types/plugins/table/nodeviews/table.d.ts +2 -1
  74. package/dist/types/plugins/table/nodeviews/types.d.ts +2 -0
  75. package/dist/types/plugins/table/pm-plugins/analytics/actions.d.ts +17 -0
  76. package/dist/types/plugins/table/pm-plugins/analytics/commands.d.ts +5 -0
  77. package/dist/types/plugins/table/pm-plugins/analytics/plugin-factory.d.ts +1 -0
  78. package/dist/types/plugins/table/pm-plugins/analytics/plugin-key.d.ts +3 -0
  79. package/dist/types/plugins/table/pm-plugins/analytics/plugin.d.ts +4 -0
  80. package/dist/types/plugins/table/pm-plugins/analytics/reducer.d.ts +3 -0
  81. package/dist/types/plugins/table/pm-plugins/analytics/types.d.ts +11 -0
  82. package/dist/types/plugins/table/pm-plugins/analytics/utils/moved-event.d.ts +6 -0
  83. package/dist/types/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -2
  84. package/dist/types/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +1 -1
  85. package/dist/types/plugins/table/pm-plugins/decorations/utils/types.d.ts +10 -4
  86. package/dist/types/plugins/table/types.d.ts +2 -1
  87. package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +5 -1
  88. package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +2 -0
  89. package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +2 -1
  90. package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +2 -0
  91. package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/actions.d.ts +17 -0
  92. package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/commands.d.ts +5 -0
  93. package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/plugin-factory.d.ts +1 -0
  94. package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/plugin-key.d.ts +3 -0
  95. package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/plugin.d.ts +4 -0
  96. package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/reducer.d.ts +3 -0
  97. package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/types.d.ts +11 -0
  98. package/dist/types-ts4.5/plugins/table/pm-plugins/analytics/utils/moved-event.d.ts +6 -0
  99. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-controls.d.ts +3 -2
  100. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/compose-decorations.d.ts +1 -1
  101. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/types.d.ts +10 -4
  102. package/dist/types-ts4.5/plugins/table/types.d.ts +2 -1
  103. package/package.json +4 -1
  104. package/src/__tests__/unit/event-handlers.ts +37 -38
  105. package/src/__tests__/unit/index-with-fake-timers.ts +1 -0
  106. package/src/__tests__/unit/nodeviews/table.ts +1 -0
  107. package/src/__tests__/unit/pm-plugins/analytics.ts +327 -0
  108. package/src/__tests__/unit/pm-plugins/decorations/column-controls.ts +46 -36
  109. package/src/plugins/table/commands/insert.ts +23 -2
  110. package/src/plugins/table/commands/misc.ts +93 -8
  111. package/src/plugins/table/index.tsx +13 -6
  112. package/src/plugins/table/nodeviews/TableComponent.tsx +35 -44
  113. package/src/plugins/table/nodeviews/TableResizer.tsx +1 -2
  114. package/src/plugins/table/nodeviews/table.tsx +4 -0
  115. package/src/plugins/table/nodeviews/types.ts +2 -0
  116. package/src/plugins/table/pm-plugins/analytics/actions.ts +23 -0
  117. package/src/plugins/table/pm-plugins/analytics/commands.ts +53 -0
  118. package/src/plugins/table/pm-plugins/analytics/plugin-factory.ts +7 -0
  119. package/src/plugins/table/pm-plugins/analytics/plugin-key.ts +7 -0
  120. package/src/plugins/table/pm-plugins/analytics/plugin.ts +98 -0
  121. package/src/plugins/table/pm-plugins/analytics/reducer.ts +27 -0
  122. package/src/plugins/table/pm-plugins/analytics/types.ts +20 -0
  123. package/src/plugins/table/pm-plugins/analytics/utils/moved-event.ts +51 -0
  124. package/src/plugins/table/pm-plugins/decorations/plugin.ts +7 -2
  125. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +20 -11
  126. package/src/plugins/table/pm-plugins/decorations/utils/compose-decorations.ts +2 -4
  127. package/src/plugins/table/pm-plugins/decorations/utils/types.ts +14 -7
  128. package/src/plugins/table/pm-plugins/main.ts +1 -0
  129. package/src/plugins/table/pm-plugins/table-analytics.ts +1 -1
  130. package/src/plugins/table/types.ts +2 -1
  131. package/src/plugins/table/ui/TableFloatingControls/index.tsx +73 -67
  132. package/src/plugins/table/ui/common-styles.ts +20 -23
  133. package/src/plugins/table/ui/ui-styles.ts +18 -21
  134. package/src/plugins/table/utils/decoration.ts +27 -32
  135. package/tsconfig.dev.json +3 -0
@@ -400,27 +400,24 @@ export const floatingColumnControls = props => {
400
400
  `;
401
401
  };
402
402
  export const rowControlsWrapperDotStyle = props => {
403
- if (getBooleanFF('platform.editor.table.drag-and-drop')) {
404
- return css`
405
- div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
406
- display: none;
407
- }
408
- `;
409
- } else {
410
- return css`
411
- div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
412
- content: ' ';
413
- background-color: ${tableBorderColor(props)};
414
- position: absolute;
415
- height: ${lineMarkerSize}px;
416
- width: ${lineMarkerSize}px;
417
- border-radius: 50%;
418
- pointer-events: none;
419
- top: -${tableToolbarSize + tableCellBorderWidth}px;
420
- right: -1px;
421
- }
422
- `;
423
- }
403
+ return css`
404
+ // override for DnD controls
405
+ div.${ClassName.WITH_CONTROLS}>.${ClassName.DRAG_ROW_CONTROLS_WRAPPER}::after {
406
+ display: none;
407
+ }
408
+
409
+ div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
410
+ content: ' ';
411
+ background-color: ${tableBorderColor(props)};
412
+ position: absolute;
413
+ height: ${lineMarkerSize}px;
414
+ width: ${lineMarkerSize}px;
415
+ border-radius: 50%;
416
+ pointer-events: none;
417
+ top: -${tableToolbarSize + tableCellBorderWidth}px;
418
+ right: -1px;
419
+ }
420
+ `;
424
421
  };
425
422
  export const columnControlsDecoration = props => {
426
423
  if (getBooleanFF('platform.editor.table.column-controls-styles-updated')) {
@@ -8,7 +8,6 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
8
8
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
9
9
  import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
10
10
  import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
11
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
12
11
  import { TableCssClassName as ClassName, TableDecorations } from '../types';
13
12
  import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
14
13
  const filterDecorationByKey = (key, decorationSet) => decorationSet.find(undefined, undefined, spec => spec.key.indexOf(key) > -1);
@@ -138,32 +137,28 @@ export const createColumnSelectedDecoration = tr => {
138
137
  };
139
138
  export const createColumnControlsDecoration = selection => {
140
139
  const cells = getCellsInRow(0)(selection) || [];
141
- if (getBooleanFF('platform.editor.table.drag-and-drop')) {
142
- return [];
143
- } else {
144
- let index = 0;
145
- return cells.map(cell => {
146
- const colspan = cell.node.attrs.colspan || 1;
147
- // It's important these values are scoped locally as the widget callback could be executed anytime in the future
148
- // and we want to avoid value leak
149
- const startIndex = index;
150
- const endIndex = startIndex + colspan;
140
+ let index = 0;
141
+ return cells.map(cell => {
142
+ const colspan = cell.node.attrs.colspan || 1;
143
+ // It's important these values are scoped locally as the widget callback could be executed anytime in the future
144
+ // and we want to avoid value leak
145
+ const startIndex = index;
146
+ const endIndex = startIndex + colspan;
151
147
 
152
- // The next cell start index will commence from the current cell end index.
153
- index = endIndex;
154
- return Decoration.widget(cell.pos + 1, () => {
155
- const element = document.createElement('div');
156
- element.classList.add(ClassName.COLUMN_CONTROLS_DECORATIONS);
157
- element.dataset.startIndex = `${startIndex}`;
158
- element.dataset.endIndex = `${endIndex}`;
159
- return element;
160
- }, {
161
- key: `${TableDecorations.COLUMN_CONTROLS_DECORATIONS}_${endIndex}`,
162
- // this decoration should be the first one, even before gap cursor.
163
- side: -100
164
- });
148
+ // The next cell start index will commence from the current cell end index.
149
+ index = endIndex;
150
+ return Decoration.widget(cell.pos + 1, () => {
151
+ const element = document.createElement('div');
152
+ element.classList.add(ClassName.COLUMN_CONTROLS_DECORATIONS);
153
+ element.dataset.startIndex = `${startIndex}`;
154
+ element.dataset.endIndex = `${endIndex}`;
155
+ return element;
156
+ }, {
157
+ key: `${TableDecorations.COLUMN_CONTROLS_DECORATIONS}_${endIndex}`,
158
+ // this decoration should be the first one, even before gap cursor.
159
+ side: -100
165
160
  });
166
- }
161
+ });
167
162
  };
168
163
  export const updateDecorations = (node, decorationSet, decorations, key) => {
169
164
  const filteredDecorations = filterDecorationByKey(key, decorationSet);
@@ -5,13 +5,12 @@ import { Selection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
6
6
  import { TableMap } from '@atlaskit/editor-tables/table-map';
7
7
  import { addColumnAt as addColumnAtPMUtils, addRowAt, createTable as createTableNode, findTable, selectedRect } from '@atlaskit/editor-tables/utils';
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
+ import { updateRowOrColumnMovedTransform } from '../pm-plugins/analytics/commands';
8
10
  import { META_KEYS } from '../pm-plugins/table-analytics';
9
11
  import { rescaleColumns } from '../transforms/column-width';
10
12
  import { checkIfHeaderRowEnabled, copyPreviousRow } from '../utils';
11
13
  import { getAllowAddColumnCustomStep } from '../utils/get-allow-add-column-custom-step';
12
-
13
- // #endregion
14
-
15
14
  function addColumnAtCustomStep(column) {
16
15
  return function (tr) {
17
16
  var table = findTable(tr.selection);
@@ -37,6 +36,11 @@ export function addColumnAt(getEditorContainerWidth) {
37
36
  // [ED-8288] Update colwidths manually to avoid multiple dispatch in TableComponent
38
37
  updatedTr = rescaleColumns(getEditorContainerWidth)(table, view)(updatedTr);
39
38
  }
39
+ if (getBooleanFF('platform.editor.table.analytics-plugin-moved-event') && view) {
40
+ updatedTr = updateRowOrColumnMovedTransform({
41
+ type: 'column'
42
+ }, 'addRowOrColumn')(view.state, updatedTr);
43
+ }
40
44
  updatedTr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
41
45
  name: TABLE_OVERFLOW_CHANGE_TRIGGER.ADDED_COLUMN
42
46
  });
@@ -120,6 +124,11 @@ export var insertRow = function insertRow(row, moveCursorToTheNewRow) {
120
124
  } else {
121
125
  tr.setSelection(selection.map(tr.doc, tr.mapping));
122
126
  }
127
+ if (getBooleanFF('platform.editor.table.analytics-plugin-moved-event')) {
128
+ updateRowOrColumnMovedTransform({
129
+ type: 'row'
130
+ }, 'addRowOrColumn')(state, tr);
131
+ }
123
132
  dispatch(tr);
124
133
  }
125
134
  return true;
@@ -1,8 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
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
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
- // #region Imports
5
-
6
4
  import { closestElement, isParagraph, isTextSelection, mapSlice } from '@atlaskit/editor-common/utils';
7
5
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
8
6
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
@@ -32,7 +30,8 @@ export var setTableRef = function setTableRef(ref) {
32
30
  var tablePos = ref && foundTable ? foundTable.pos : undefined;
33
31
  var tableWrapperTarget = closestElement(tableRef, ".".concat(ClassName.TABLE_NODE_WRAPPER)) || undefined;
34
32
  var layout = tableNode ? tableNode.attrs.layout : undefined;
35
- var decorationSet = updatePluginStateDecorations(state, createColumnControlsDecoration(state.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
33
+ var _getPluginState = getPluginState(state),
34
+ isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
36
35
  return {
37
36
  type: 'SET_TABLE_REF',
38
37
  data: {
@@ -44,7 +43,8 @@ export var setTableRef = function setTableRef(ref) {
44
43
  isNumberColumnEnabled: checkIfNumberColumnEnabled(state.selection),
45
44
  isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
46
45
  isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
47
- decorationSet: decorationSet,
46
+ // decoration set is drawn by the decoration plugin, skip this for DnD as all controls are floating
47
+ decorationSet: !isDragAndDropEnabled ? updatePluginStateDecorations(state, createColumnControlsDecoration(state.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS) : undefined,
48
48
  resizeHandleRowIndex: undefined,
49
49
  resizeHandleColumnIndex: undefined
50
50
  }
@@ -152,6 +152,54 @@ export var transformSliceToRemoveColumnsWidths = function transformSliceToRemove
152
152
  return maybeCell;
153
153
  });
154
154
  };
155
+ export var countCellsInSlice = function countCellsInSlice(slice, schema, type) {
156
+ var _schema$nodes4 = schema.nodes,
157
+ tableHeader = _schema$nodes4.tableHeader,
158
+ tableCell = _schema$nodes4.tableCell;
159
+ var count = 0;
160
+ if (!type) {
161
+ return count;
162
+ }
163
+ slice.content.descendants(function (maybeCell) {
164
+ if (maybeCell.type === tableCell || maybeCell.type === tableHeader) {
165
+ count += type === 'row' ? maybeCell.attrs.colspan : maybeCell.attrs.rowspan;
166
+ return false;
167
+ }
168
+ });
169
+ return count;
170
+ };
171
+ export var getTableSelectionType = function getTableSelectionType(selection) {
172
+ if (selection instanceof CellSelection) {
173
+ return selection.isRowSelection() ? 'row' : selection.isColSelection() ? 'column' : undefined;
174
+ }
175
+ };
176
+ export var getTableElementMoveTypeBySlice = function getTableElementMoveTypeBySlice(slice, state) {
177
+ if (!slice.content.firstChild) {
178
+ return;
179
+ }
180
+ var schema = state.schema;
181
+
182
+ // if the slice only contains one table row, assume it's a row
183
+ if (slice.content.childCount === 1 && slice.content.firstChild.type === schema.nodes.tableRow) {
184
+ return 'row';
185
+ }
186
+ var table = findTable(state.tr.selection);
187
+ var map = TableMap.get(table.node);
188
+ var slicedMap = TableMap.get(slice.content.firstChild);
189
+ return map.width === slicedMap.width ? 'row' : map.height === slicedMap.height ? 'column' : undefined;
190
+ };
191
+ export var isInsideFirstCellOfRowOrColumn = function isInsideFirstCellOfRowOrColumn(selection, type) {
192
+ var table = findTable(selection);
193
+ if (!table || !type) {
194
+ return;
195
+ }
196
+ var map = TableMap.get(table.node);
197
+ var cell = selectionCell(selection);
198
+ var index = map.map.findIndex(function (value) {
199
+ return value === cell.pos - 1;
200
+ });
201
+ return type === 'row' ? index % map.width === 0 : index < map.width;
202
+ };
155
203
  export var deleteTable = function deleteTable(state, dispatch) {
156
204
  if (dispatch) {
157
205
  dispatch(removeTable(state.tr));
@@ -333,9 +381,9 @@ export var hideInsertColumnOrRowButton = function hideInsertColumnOrRowButton()
333
381
  export var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
334
382
  return createCommand(function (state) {
335
383
  var tableNode = findTable(state.selection);
336
- var _getPluginState = getPluginState(state),
337
- allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing,
338
- getIntl = _getPluginState.getIntl;
384
+ var _getPluginState2 = getPluginState(state),
385
+ allowColumnResizing = _getPluginState2.pluginConfig.allowColumnResizing,
386
+ getIntl = _getPluginState2.getIntl;
339
387
  if (!tableNode || !allowColumnResizing) {
340
388
  return false;
341
389
  }
@@ -358,12 +406,12 @@ export var addResizeHandleDecorations = function addResizeHandleDecorations(rowI
358
406
  export var updateResizeHandleDecorations = function updateResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
359
407
  return createCommand(function (state) {
360
408
  var tableNode = findTable(state.selection);
361
- var _getPluginState2 = getPluginState(state),
362
- resizeHandleRowIndex = _getPluginState2.resizeHandleRowIndex,
363
- resizeHandleColumnIndex = _getPluginState2.resizeHandleColumnIndex,
364
- resizeHandleIncludeTooltip = _getPluginState2.resizeHandleIncludeTooltip,
365
- allowColumnResizing = _getPluginState2.pluginConfig.allowColumnResizing,
366
- getIntl = _getPluginState2.getIntl;
409
+ var _getPluginState3 = getPluginState(state),
410
+ resizeHandleRowIndex = _getPluginState3.resizeHandleRowIndex,
411
+ resizeHandleColumnIndex = _getPluginState3.resizeHandleColumnIndex,
412
+ resizeHandleIncludeTooltip = _getPluginState3.resizeHandleIncludeTooltip,
413
+ allowColumnResizing = _getPluginState3.pluginConfig.allowColumnResizing,
414
+ getIntl = _getPluginState3.getIntl;
367
415
  if (!tableNode || !allowColumnResizing) {
368
416
  return false;
369
417
  }
@@ -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 createTableAnalyticsPlugin, pluginKey as tableAnalyticsPluginKey } from './pm-plugins/table-analytics';
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
- name: 'tableAnalyticsPlugin',
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') ? createTableAnalyticsPlugin(dispatch, dispatchAnalyticsEvent, (_options$tableResizin = options === null || options === void 0 ? void 0 : options.tableResizingEnabled) !== null && _options$tableResizin !== void 0 ? _options$tableResizin : false) : undefined;
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(_ref12) {
231
- var editorView = _ref12.editorView,
232
- popupsMountPoint = _ref12.popupsMountPoint,
233
- popupsBoundariesElement = _ref12.popupsBoundariesElement,
234
- popupsScrollableElement = _ref12.popupsScrollableElement,
235
- dispatchAnalyticsEvent = _ref12.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(_ref13) {
250
- var resizingPluginState = _ref13.tableResizingPluginState,
251
- stickyHeadersState = _ref13.stickyHeadersState,
252
- tablePluginState = _ref13.tablePluginState,
253
- tableWidthPluginState = _ref13.tableWidthPluginState,
254
- dragAndDropState = _ref13.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 _ref14 = tablePluginState,
260
- tableNode = _ref14.tableNode,
261
- tablePos = _ref14.tablePos,
262
- targetCellPosition = _ref14.targetCellPosition,
263
- isContextualMenuOpen = _ref14.isContextualMenuOpen,
264
- layout = _ref14.layout,
265
- tableRef = _ref14.tableRef,
266
- pluginConfig = _ref14.pluginConfig,
267
- insertColumnButtonIndex = _ref14.insertColumnButtonIndex,
268
- insertRowButtonIndex = _ref14.insertRowButtonIndex,
269
- isHeaderColumnEnabled = _ref14.isHeaderColumnEnabled,
270
- isHeaderRowEnabled = _ref14.isHeaderRowEnabled,
271
- isDragAndDropEnabled = _ref14.isDragAndDropEnabled,
272
- tableWrapperTarget = _ref14.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(_ref15) {
351
- var formatMessage = _ref15.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 { analyticsEventKey, browser, isValidPosition } from '@atlaskit/editor-common/utils';
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
- eventDispatcher = _this$props3.eventDispatcher,
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
- dispatch(analyticsEventKey, {
200
- payload: {
201
- action: TABLE_ACTION.INITIAL_OVERFLOW_CAPTURED,
202
- actionSubject: ACTION_SUBJECT.TABLE,
203
- actionSubjectId: null,
204
- eventType: EVENT_TYPE.TRACK,
205
- attributes: {
206
- editorWidth: containerWidth.width || 0,
207
- isOverflowing: isOverflowing,
208
- tableResizingEnabled: (options === null || options === void 0 ? void 0 : options.isTableResizingEnabled) || false,
209
- width: _this.node.attrs.width || 0,
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;
@@ -528,9 +524,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
528
524
  var tableRef = this.table || undefined;
529
525
  var headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
530
526
  var hasHeaderRow = containsHeaderRow(node);
531
- var rowControls = /*#__PURE__*/React.createElement("div", {
532
- className: ClassName.ROW_CONTROLS_WRAPPER
533
- }, /*#__PURE__*/React.createElement(TableFloatingControls, {
527
+ var rowControls = /*#__PURE__*/React.createElement(TableFloatingControls, {
534
528
  editorView: view,
535
529
  tableRef: tableRef,
536
530
  tableNode: node,
@@ -550,7 +544,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
550
544
  selection: view.state.selection,
551
545
  headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
552
546
  stickyHeader: this.state.stickyHeader
553
- }));
547
+ });
554
548
  var colControls = isDragAndDropEnabled ? /*#__PURE__*/React.createElement(TableFloatingColumnControls, {
555
549
  editorView: view,
556
550
  tableRef: tableRef,
@@ -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,2 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export var pluginKey = new PluginKey('tableAnalyticPlugin');
@@ -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
+ };