@atlaskit/editor-plugin-table 3.0.5 → 3.1.1

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 (64) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/plugins/table/commands/insert.js +5 -0
  3. package/dist/cjs/plugins/table/commands/toggle.js +11 -1
  4. package/dist/cjs/plugins/table/index.js +37 -26
  5. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +112 -47
  6. package/dist/cjs/plugins/table/nodeviews/TableResizer.js +9 -4
  7. package/dist/cjs/plugins/table/pm-plugins/table-analytics.js +83 -0
  8. package/dist/cjs/plugins/table/pm-plugins/table-resizing/commands.js +5 -0
  9. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +8 -0
  10. package/dist/cjs/plugins/table/transforms/delete-columns.js +5 -0
  11. package/dist/cjs/plugins/table/ui/common-styles.js +1 -1
  12. package/dist/cjs/plugins/table/ui/consts.js +3 -1
  13. package/dist/cjs/plugins/table/ui/ui-styles.js +1 -1
  14. package/dist/es2019/plugins/table/commands/insert.js +5 -0
  15. package/dist/es2019/plugins/table/commands/toggle.js +11 -1
  16. package/dist/es2019/plugins/table/index.js +12 -0
  17. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +73 -4
  18. package/dist/es2019/plugins/table/nodeviews/TableResizer.js +5 -0
  19. package/dist/es2019/plugins/table/pm-plugins/table-analytics.js +74 -0
  20. package/dist/es2019/plugins/table/pm-plugins/table-resizing/commands.js +5 -0
  21. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +9 -1
  22. package/dist/es2019/plugins/table/transforms/delete-columns.js +5 -0
  23. package/dist/es2019/plugins/table/ui/common-styles.js +4 -1
  24. package/dist/es2019/plugins/table/ui/consts.js +1 -0
  25. package/dist/es2019/plugins/table/ui/ui-styles.js +7 -5
  26. package/dist/esm/plugins/table/commands/insert.js +5 -0
  27. package/dist/esm/plugins/table/commands/toggle.js +11 -1
  28. package/dist/esm/plugins/table/index.js +37 -26
  29. package/dist/esm/plugins/table/nodeviews/TableComponent.js +114 -49
  30. package/dist/esm/plugins/table/nodeviews/TableResizer.js +5 -0
  31. package/dist/esm/plugins/table/pm-plugins/table-analytics.js +75 -0
  32. package/dist/esm/plugins/table/pm-plugins/table-resizing/commands.js +5 -0
  33. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +9 -1
  34. package/dist/esm/plugins/table/transforms/delete-columns.js +5 -0
  35. package/dist/esm/plugins/table/ui/common-styles.js +2 -2
  36. package/dist/esm/plugins/table/ui/consts.js +1 -0
  37. package/dist/esm/plugins/table/ui/ui-styles.js +2 -2
  38. package/dist/types/plugins/table/commands/insert.d.ts +3 -4
  39. package/dist/types/plugins/table/commands/toggle.d.ts +2 -2
  40. package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +4 -1
  41. package/dist/types/plugins/table/pm-plugins/table-analytics.d.ts +23 -0
  42. package/dist/types/plugins/table/pm-plugins/table-resizing/commands.d.ts +4 -4
  43. package/dist/types/plugins/table/transforms/delete-columns.d.ts +2 -2
  44. package/dist/types/plugins/table/ui/consts.d.ts +1 -0
  45. package/dist/types-ts4.5/plugins/table/commands/insert.d.ts +3 -4
  46. package/dist/types-ts4.5/plugins/table/commands/toggle.d.ts +2 -2
  47. package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +4 -1
  48. package/dist/types-ts4.5/plugins/table/pm-plugins/table-analytics.d.ts +23 -0
  49. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/commands.d.ts +4 -4
  50. package/dist/types-ts4.5/plugins/table/transforms/delete-columns.d.ts +2 -2
  51. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +1 -0
  52. package/package.json +8 -2
  53. package/src/plugins/table/commands/insert.ts +12 -4
  54. package/src/plugins/table/commands/toggle.ts +17 -4
  55. package/src/plugins/table/index.tsx +17 -1
  56. package/src/plugins/table/nodeviews/TableComponent.tsx +110 -4
  57. package/src/plugins/table/nodeviews/TableResizer.tsx +6 -0
  58. package/src/plugins/table/pm-plugins/table-analytics.ts +102 -0
  59. package/src/plugins/table/pm-plugins/table-resizing/commands.ts +10 -4
  60. package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +10 -0
  61. package/src/plugins/table/transforms/delete-columns.ts +12 -4
  62. package/src/plugins/table/ui/common-styles.ts +4 -0
  63. package/src/plugins/table/ui/consts.ts +1 -0
  64. package/src/plugins/table/ui/ui-styles.ts +28 -5
@@ -6,14 +6,25 @@ import memoizeOne from 'memoize-one';
6
6
  import rafSchedule from 'raf-schd';
7
7
 
8
8
  import type { TableColumnOrdering } from '@atlaskit/adf-schema/steps';
9
+ import {
10
+ ACTION_SUBJECT,
11
+ EVENT_TYPE,
12
+ TABLE_ACTION,
13
+ } from '@atlaskit/editor-common/analytics';
14
+ import type { AnalyticsDispatch } from '@atlaskit/editor-common/analytics';
9
15
  import type { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
16
+ import { createDispatch } from '@atlaskit/editor-common/event-dispatcher';
10
17
  import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
11
18
  import { tableMarginSides } from '@atlaskit/editor-common/styles';
12
19
  import type {
13
20
  EditorContainerWidth,
14
21
  GetEditorFeatureFlags,
15
22
  } from '@atlaskit/editor-common/types';
16
- import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
23
+ import {
24
+ analyticsEventKey,
25
+ browser,
26
+ isValidPosition,
27
+ } from '@atlaskit/editor-common/utils';
17
28
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
18
29
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
19
30
  import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
@@ -30,6 +41,7 @@ import {
30
41
  findStickyHeaderForTable,
31
42
  pluginKey as stickyHeadersPluginKey,
32
43
  } from '../pm-plugins/sticky-headers';
44
+ import { META_KEYS } from '../pm-plugins/table-analytics';
33
45
  import {
34
46
  getLayoutSize,
35
47
  insertColgroupFromNode as recreateResizeColsByNode,
@@ -39,7 +51,10 @@ import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup
39
51
  import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
40
52
  import type { PluginInjectionAPI } from '../types';
41
53
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
42
- import { tableOverflowShadowWidth } from '../ui/consts';
54
+ import {
55
+ tableOverflowShadowWidth,
56
+ tableOverflowShadowWidthWide,
57
+ } from '../ui/consts';
43
58
  import TableFloatingControls from '../ui/TableFloatingControls';
44
59
  import {
45
60
  containsHeaderRow,
@@ -53,6 +68,10 @@ import { TableContainer } from './TableContainer';
53
68
  import type { TableOptions } from './types';
54
69
 
55
70
  const isIE11 = browser.ie_version === 11;
71
+ // When table is inserted via paste, keyboard shortcut or quickInsert,
72
+ // componentDidUpdate is called multiple times. The isOverflowing value is correct only on the last update.
73
+ // To make sure we capture the last update, we use setTimeout.
74
+ const initialOverflowCaptureTimeroutDelay = 300;
56
75
  export interface ComponentProps {
57
76
  view: EditorView;
58
77
  getNode: () => PmNode;
@@ -81,6 +100,7 @@ interface TableState {
81
100
  [ShadowEvent.SHOW_BEFORE_SHADOW]: boolean;
82
101
  [ShadowEvent.SHOW_AFTER_SHADOW]: boolean;
83
102
  }
103
+
84
104
  class TableComponent extends React.Component<ComponentProps, TableState> {
85
105
  static displayName = 'TableComponent';
86
106
 
@@ -98,11 +118,15 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
98
118
  private layoutSize?: number;
99
119
  private overflowShadowsObserver?: OverflowShadowsObserver;
100
120
 
121
+ private isInitialOverflowSent: boolean;
122
+ private initialOverflowCaptureTimerId?: ReturnType<typeof setTimeout>;
123
+
101
124
  constructor(props: ComponentProps) {
102
125
  super(props);
103
126
  const { options, containerWidth, getNode } = props;
104
127
  this.node = getNode();
105
128
  this.containerWidth = containerWidth;
129
+ this.isInitialOverflowSent = false;
106
130
 
107
131
  // store table size using previous full-width mode so can detect if it has changed
108
132
  const isFullWidthModeEnabled = options
@@ -153,6 +177,14 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
153
177
  }
154
178
 
155
179
  eventDispatcher.on((stickyHeadersPluginKey as any).key, this.onStickyState);
180
+
181
+ if (getBooleanFF('platform.editor.table.overflow-state-analytics')) {
182
+ const initialIsOveflowing =
183
+ this.state[ShadowEvent.SHOW_BEFORE_SHADOW] ||
184
+ this.state[ShadowEvent.SHOW_AFTER_SHADOW];
185
+
186
+ this.setTimerToSendInitialOverflowCaptured(initialIsOveflowing);
187
+ }
156
188
  }
157
189
 
158
190
  componentWillUnmount() {
@@ -181,9 +213,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
181
213
  (stickyHeadersPluginKey as any).key,
182
214
  this.onStickyState,
183
215
  );
216
+
217
+ if (this.initialOverflowCaptureTimerId) {
218
+ clearTimeout(this.initialOverflowCaptureTimerId);
219
+ }
184
220
  }
185
221
 
186
- componentDidUpdate() {
222
+ componentDidUpdate(_: any, prevState: TableState) {
187
223
  const {
188
224
  view,
189
225
  getNode,
@@ -249,6 +285,44 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
249
285
 
250
286
  this.handleTableResizingDebounced();
251
287
  }
288
+
289
+ if (getBooleanFF('platform.editor.table.overflow-state-analytics')) {
290
+ const newIsOverflowing =
291
+ this.state[ShadowEvent.SHOW_BEFORE_SHADOW] ||
292
+ this.state[ShadowEvent.SHOW_AFTER_SHADOW];
293
+
294
+ const prevIsOverflowing =
295
+ prevState[ShadowEvent.SHOW_BEFORE_SHADOW] ||
296
+ prevState[ShadowEvent.SHOW_AFTER_SHADOW];
297
+
298
+ if (this.initialOverflowCaptureTimerId) {
299
+ clearTimeout(this.initialOverflowCaptureTimerId);
300
+ }
301
+
302
+ if (!this.isInitialOverflowSent) {
303
+ this.setTimerToSendInitialOverflowCaptured(newIsOverflowing);
304
+ }
305
+
306
+ if (
307
+ this.isInitialOverflowSent &&
308
+ prevIsOverflowing !== newIsOverflowing
309
+ ) {
310
+ const {
311
+ dispatch,
312
+ state: { tr },
313
+ } = this.props.view;
314
+
315
+ dispatch(
316
+ tr.setMeta(META_KEYS.OVERFLOW_STATE_CHANGED, {
317
+ isOverflowing: newIsOverflowing,
318
+ wasOverflowing: prevIsOverflowing,
319
+ editorWidth: this.props.containerWidth.width || 0,
320
+ width: this.node.attrs.width || 0,
321
+ parentWidth: this.state?.parentWidth || 0,
322
+ }),
323
+ );
324
+ }
325
+ }
252
326
  }
253
327
 
254
328
  private updateShadowState = (shadowKey: ShadowEvent, value: boolean) => {
@@ -423,7 +497,13 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
423
497
  style={{
424
498
  position: 'absolute',
425
499
  right: getBooleanFF('platform.editor.custom-table-width')
426
- ? `${tableOverflowShadowWidth}px`
500
+ ? `${
501
+ getBooleanFF(
502
+ 'platform.editor.table.increase-shadow-visibility_lh89r',
503
+ )
504
+ ? tableOverflowShadowWidthWide
505
+ : tableOverflowShadowWidth
506
+ }px`
427
507
  : '-2px',
428
508
  }}
429
509
  >
@@ -577,6 +657,32 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
577
657
  dispatch(tr);
578
658
  };
579
659
 
660
+ private setTimerToSendInitialOverflowCaptured = (isOverflowing: boolean) => {
661
+ const { eventDispatcher, containerWidth, options } = this.props;
662
+ const dispatch: AnalyticsDispatch = createDispatch(eventDispatcher);
663
+ const parentWidth = this.state?.parentWidth || 0;
664
+
665
+ this.initialOverflowCaptureTimerId = setTimeout(() => {
666
+ dispatch(analyticsEventKey, {
667
+ payload: {
668
+ action: TABLE_ACTION.INITIAL_OVERFLOW_CAPTURED,
669
+ actionSubject: ACTION_SUBJECT.TABLE,
670
+ actionSubjectId: null,
671
+ eventType: EVENT_TYPE.TRACK,
672
+ attributes: {
673
+ editorWidth: containerWidth.width || 0,
674
+ isOverflowing,
675
+ tableResizingEnabled: options?.isTableResizingEnabled || false,
676
+ width: this.node.attrs.width || 0,
677
+ parentWidth,
678
+ },
679
+ },
680
+ });
681
+
682
+ this.isInitialOverflowSent = true;
683
+ }, initialOverflowCaptureTimeroutDelay);
684
+ };
685
+
580
686
  private handleAutoSize = () => {
581
687
  if (this.table) {
582
688
  const { view, getNode, getPos, containerWidth } = this.props;
@@ -11,6 +11,7 @@ import rafSchd from 'raf-schd';
11
11
  import { defineMessages, useIntl } from 'react-intl-next';
12
12
 
13
13
  import type { TableEventPayload } from '@atlaskit/editor-common/analytics';
14
+ import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
14
15
  import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
15
16
  import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
16
17
  import type {
@@ -25,6 +26,7 @@ import { findTable } from '@atlaskit/editor-tables/utils';
25
26
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
26
27
 
27
28
  import { getPluginState } from '../pm-plugins/plugin-factory';
29
+ import { META_KEYS } from '../pm-plugins/table-analytics';
28
30
  import {
29
31
  COLUMN_MIN_WIDTH,
30
32
  getColgroupChildrenLength,
@@ -215,6 +217,10 @@ export const TableResizer = ({
215
217
  tr.setMeta(tableWidthPluginKey, { resizing: true });
216
218
  displayGapCursor(false);
217
219
 
220
+ tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
221
+ name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED,
222
+ });
223
+
218
224
  dispatch(tr);
219
225
 
220
226
  const visibleGuidelines = getVisibleGuidelines(
@@ -0,0 +1,102 @@
1
+ /**
2
+ * A plugin is created for collecting payload data for tableOverflowChanged analytics event
3
+ */
4
+ import {
5
+ ACTION_SUBJECT,
6
+ EVENT_TYPE,
7
+ TABLE_ACTION,
8
+ TABLE_OVERFLOW_CHANGE_TRIGGER,
9
+ } from '@atlaskit/editor-common/analytics';
10
+ import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
11
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
12
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
13
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
14
+
15
+ interface LastTrigger {
16
+ name: TABLE_OVERFLOW_CHANGE_TRIGGER;
17
+ }
18
+
19
+ type TableAnalyticsPluginState = {
20
+ lastTrigger: LastTrigger | undefined;
21
+ };
22
+
23
+ export const pluginKey = new PluginKey<TableAnalyticsPluginState>(
24
+ 'tableAnalyticsPlugin',
25
+ );
26
+
27
+ export const META_KEYS = {
28
+ OVERFLOW_TRIGGER: 'tableOverflowTrigger',
29
+ OVERFLOW_STATE_CHANGED: 'tableOverflowStateChanged',
30
+ };
31
+
32
+ const createPlugin = (
33
+ dispatch: Dispatch,
34
+ dispatchAnalyticsEvent: DispatchAnalyticsEvent,
35
+ tableResizingEnabled: boolean,
36
+ ) =>
37
+ new SafePlugin({
38
+ key: pluginKey,
39
+ state: {
40
+ init() {
41
+ return {
42
+ lastTrigger: undefined,
43
+ };
44
+ },
45
+ apply(tr, pluginState) {
46
+ const meta = tr.getMeta(META_KEYS.OVERFLOW_TRIGGER);
47
+ const newState = { ...pluginState };
48
+ if (meta) {
49
+ newState.lastTrigger = { ...meta };
50
+ dispatch(pluginKey, newState);
51
+ return newState;
52
+ }
53
+
54
+ return pluginState;
55
+ },
56
+ },
57
+ appendTransaction: (transactions, oldState, newState) => {
58
+ const newPluginState = pluginKey.getState(newState);
59
+ let hasAnalyticsBeenDispatched = false;
60
+ let lastTriggerName =
61
+ newPluginState?.lastTrigger?.name ||
62
+ // NOTE: We assume that we know and can correctly differentiate
63
+ // between all triggers of table overflow state change.
64
+ // The only trigger we can't identify is viewport width change.
65
+ // However, since there is still a chance that there are other triggers we didn't think of,
66
+ // all these unknown triggers and viwport width change trigger are captured as EXTERNAL.
67
+ TABLE_OVERFLOW_CHANGE_TRIGGER.EXTERNAL;
68
+
69
+ transactions.forEach((tr) => {
70
+ const payload = tr.getMeta(META_KEYS.OVERFLOW_STATE_CHANGED);
71
+
72
+ if (payload) {
73
+ dispatchAnalyticsEvent({
74
+ action: TABLE_ACTION.OVERFLOW_CHANGED,
75
+ actionSubject: ACTION_SUBJECT.TABLE,
76
+ actionSubjectId: null,
77
+ eventType: EVENT_TYPE.TRACK,
78
+ attributes: {
79
+ editorWidth: payload.editorWidth,
80
+ parentWidth: payload.parentWidth,
81
+ isOverflowing: payload.isOverflowing,
82
+ wasOverflowing: payload.wasOverflowing,
83
+ width: payload.width,
84
+ tableResizingEnabled,
85
+ trigger: lastTriggerName,
86
+ },
87
+ });
88
+
89
+ hasAnalyticsBeenDispatched = true;
90
+ }
91
+ });
92
+
93
+ if (hasAnalyticsBeenDispatched) {
94
+ const tr = newState.tr;
95
+ return tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {});
96
+ }
97
+
98
+ return undefined;
99
+ },
100
+ });
101
+
102
+ export { createPlugin };
@@ -1,13 +1,16 @@
1
+ import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
1
2
  import type { Command } from '@atlaskit/editor-common/types';
2
- import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import { Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
3
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
5
+ import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
5
6
  import { isTableSelected } from '@atlaskit/editor-tables/utils';
6
7
 
7
8
  import { updateColumnWidths } from '../../transforms';
9
+ import { META_KEYS } from '../table-analytics';
8
10
 
9
11
  import { createCommand, getPluginState } from './plugin-factory';
10
- import { evenAllColumnsWidths, isClickNear, ResizeState } from './utils';
12
+ import type { ResizeState } from './utils';
13
+ import { evenAllColumnsWidths, isClickNear } from './utils';
11
14
 
12
15
  export const evenColumns =
13
16
  ({
@@ -60,6 +63,9 @@ export const distributeColumnsWidths =
60
63
  table.node,
61
64
  table.start,
62
65
  )(state.tr);
66
+ tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
67
+ name: TABLE_OVERFLOW_CHANGE_TRIGGER.DISTRIBUTED_COLUMNS,
68
+ });
63
69
  stopResizing(tr)(state, dispatch);
64
70
  }
65
71
 
@@ -3,6 +3,7 @@ import {
3
3
  ACTION_SUBJECT,
4
4
  EVENT_TYPE,
5
5
  TABLE_ACTION,
6
+ TABLE_OVERFLOW_CHANGE_TRIGGER,
6
7
  } from '@atlaskit/editor-common/analytics';
7
8
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
8
9
  import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
@@ -20,6 +21,7 @@ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
20
21
  import { updateResizeHandleDecorations } from '../../commands/misc';
21
22
  import { updateColumnWidths } from '../../transforms';
22
23
  import { getSelectedColumnIndexes, updateResizeHandles } from '../../utils';
24
+ import { META_KEYS } from '../table-analytics';
23
25
 
24
26
  import { evenColumns, setDragging, stopResizing } from './commands';
25
27
  import { getPluginState } from './plugin-factory';
@@ -53,6 +55,14 @@ export const handleMouseDown = (
53
55
  }
54
56
  event.preventDefault();
55
57
 
58
+ if (getBooleanFF('platform.editor.table.overflow-state-analytics')) {
59
+ const tr = view.state.tr;
60
+ tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
61
+ name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED_COLUMN,
62
+ });
63
+ dispatch(tr);
64
+ }
65
+
56
66
  const mouseDownTime = event.timeStamp;
57
67
  const cell = state.doc.nodeAt(localResizeHandlePos);
58
68
  const $cell = state.doc.resolve(localResizeHandlePos);
@@ -1,10 +1,15 @@
1
- import { CellAttributes } from '@atlaskit/adf-schema';
1
+ import type { CellAttributes } from '@atlaskit/adf-schema';
2
2
  import { AddColumnStep } from '@atlaskit/adf-schema/steps';
3
- import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
- import { Selection, Transaction } from '@atlaskit/editor-prosemirror/state';
5
- import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
3
+ import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
4
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
5
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
6
+ import { Selection } from '@atlaskit/editor-prosemirror/state';
7
+ import type { Rect } from '@atlaskit/editor-tables/table-map';
8
+ import { TableMap } from '@atlaskit/editor-tables/table-map';
6
9
  import { findTable } from '@atlaskit/editor-tables/utils';
7
10
 
11
+ import { META_KEYS } from '../pm-plugins/table-analytics';
12
+
8
13
  import { splitCellsInColumns } from './split';
9
14
 
10
15
  const deleteColumnsCustomStep =
@@ -244,6 +249,9 @@ function fixRowSpans(table: PMNode): PMNode | null {
244
249
  export const deleteColumns =
245
250
  (rect: Rect, allowAddColumnCustomStep = false) =>
246
251
  (tr: Transaction): Transaction => {
252
+ tr.setMeta(META_KEYS.OVERFLOW_TRIGGER, {
253
+ name: TABLE_OVERFLOW_CHANGE_TRIGGER.DELETED_COLUMN,
254
+ });
247
255
  if (allowAddColumnCustomStep) {
248
256
  return deleteColumnsCustomStep(rect)(tr);
249
257
  }
@@ -42,6 +42,7 @@ import {
42
42
  tableControlsSpacing,
43
43
  tableHeaderCellBackgroundColor,
44
44
  tableInsertColumnButtonSize,
45
+ tableOverflowShadowWidth,
45
46
  tablePadding,
46
47
  tableScrollbarOffset,
47
48
  tableTextColor,
@@ -438,6 +439,9 @@ export const tableStyles = (
438
439
  &.${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
439
440
  padding-left: ${akEditorTableNumberColumnWidth + tablePadding - 1}px;
440
441
  }
442
+ .${ClassName.TABLE_LEFT_SHADOW}, .${ClassName.TABLE_RIGHT_SHADOW} {
443
+ width: ${tableOverflowShadowWidth}px;
444
+ }
441
445
 
442
446
  .${ClassName.TABLE_LEFT_SHADOW} {
443
447
  left: 6px;
@@ -141,6 +141,7 @@ export const stickyRowZIndex = resizeHandlerZIndex + 2;
141
141
  export const stickyRowOffsetTop = 8;
142
142
  export const stickyHeaderBorderBottomWidth = 1;
143
143
  export const tableOverflowShadowWidth = 8;
144
+ export const tableOverflowShadowWidthWide = 32;
144
145
 
145
146
  export const TABLE_SNAP_GAP = 9;
146
147
  export const TABLE_HIGHLIGHT_GAP = 10;
@@ -38,6 +38,7 @@ import {
38
38
  tableHeaderCellBackgroundColor,
39
39
  tableInsertColumnButtonSize,
40
40
  tableOverflowShadowWidth,
41
+ tableOverflowShadowWidthWide,
41
42
  tableToolbarDeleteColor,
42
43
  tableToolbarSelectedColor,
43
44
  tableToolbarSize,
@@ -246,13 +247,22 @@ export const OverflowShadow = (props: ThemeProps) => css`
246
247
  pointer-events: none;
247
248
  top: ${tableMarginTop}px;
248
249
  z-index: ${akEditorShadowZIndex};
249
- width: ${tableOverflowShadowWidth}px;
250
+ width: ${getBooleanFF(
251
+ 'platform.editor.table.increase-shadow-visibility_lh89r',
252
+ )
253
+ ? tableOverflowShadowWidthWide
254
+ : tableOverflowShadowWidth}px;
250
255
  }
251
256
  .${ClassName.TABLE_LEFT_SHADOW} {
252
257
  background: linear-gradient(
253
258
  to left,
254
259
  transparent 0,
255
- ${token('elevation.shadow.overflow.spread', N40A)} 100%
260
+ ${token('elevation.shadow.overflow.spread', N40A)}
261
+ ${getBooleanFF(
262
+ 'platform.editor.table.increase-shadow-visibility_lh89r',
263
+ )
264
+ ? 140
265
+ : 100}%
256
266
  ),
257
267
  linear-gradient(
258
268
  to right,
@@ -268,7 +278,12 @@ export const OverflowShadow = (props: ThemeProps) => css`
268
278
  background: linear-gradient(
269
279
  to right,
270
280
  transparent 0,
271
- ${token('elevation.shadow.overflow.spread', N40A)} 100%
281
+ ${token('elevation.shadow.overflow.spread', N40A)}
282
+ ${getBooleanFF(
283
+ 'platform.editor.table.increase-shadow-visibility_lh89r',
284
+ )
285
+ ? 140
286
+ : 100}%
272
287
  ),
273
288
  linear-gradient(
274
289
  to left,
@@ -276,8 +291,16 @@ export const OverflowShadow = (props: ThemeProps) => css`
276
291
  transparent 1px
277
292
  );
278
293
  left: ${getBooleanFF('platform.editor.custom-table-width')
279
- ? `calc(100% - ${tableOverflowShadowWidth}px)`
280
- : 'calc(100% + 2px)'};
294
+ ? `calc(100% - ${
295
+ getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r')
296
+ ? tableOverflowShadowWidthWide
297
+ : tableOverflowShadowWidth
298
+ }px)`
299
+ : `calc(100% - ${
300
+ getBooleanFF('platform.editor.table.increase-shadow-visibility_lh89r')
301
+ ? tableOverflowShadowWidthWide - 10
302
+ : -2
303
+ }px)`};
281
304
  }
282
305
  .${ClassName.WITH_CONTROLS} {
283
306
  .${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {