@atlaskit/editor-plugin-table 22.1.4 → 22.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/nodeviews/table-node-views.js +1 -2
  3. package/dist/cjs/pm-plugins/commands/column-resize.js +2 -3
  4. package/dist/cjs/pm-plugins/commands/hover.js +6 -14
  5. package/dist/cjs/pm-plugins/commands/misc.js +13 -17
  6. package/dist/cjs/pm-plugins/decorations/plugin.js +2 -10
  7. package/dist/cjs/pm-plugins/decorations/utils/column-controls.js +9 -26
  8. package/dist/cjs/pm-plugins/utils/decoration.js +6 -10
  9. package/dist/cjs/pm-plugins/utils/sticky-header.js +2 -2
  10. package/dist/cjs/tablePlugin.js +1 -2
  11. package/dist/cjs/ui/FloatingContextualButton/index.js +1 -2
  12. package/dist/cjs/ui/FloatingContextualMenu/index.js +2 -15
  13. package/dist/cjs/ui/TableFloatingColumnControls/index.js +1 -1
  14. package/dist/es2019/nodeviews/table-node-views.js +1 -2
  15. package/dist/es2019/pm-plugins/commands/column-resize.js +2 -3
  16. package/dist/es2019/pm-plugins/commands/hover.js +4 -16
  17. package/dist/es2019/pm-plugins/commands/misc.js +1 -6
  18. package/dist/es2019/pm-plugins/decorations/plugin.js +2 -9
  19. package/dist/es2019/pm-plugins/decorations/utils/column-controls.js +3 -21
  20. package/dist/es2019/pm-plugins/utils/decoration.js +6 -10
  21. package/dist/es2019/pm-plugins/utils/sticky-header.js +2 -2
  22. package/dist/es2019/tablePlugin.js +1 -2
  23. package/dist/es2019/ui/FloatingContextualButton/index.js +1 -2
  24. package/dist/es2019/ui/FloatingContextualMenu/index.js +2 -15
  25. package/dist/es2019/ui/TableFloatingColumnControls/index.js +1 -1
  26. package/dist/esm/nodeviews/table-node-views.js +1 -2
  27. package/dist/esm/pm-plugins/commands/column-resize.js +2 -3
  28. package/dist/esm/pm-plugins/commands/hover.js +6 -14
  29. package/dist/esm/pm-plugins/commands/misc.js +14 -18
  30. package/dist/esm/pm-plugins/decorations/plugin.js +2 -10
  31. package/dist/esm/pm-plugins/decorations/utils/column-controls.js +10 -27
  32. package/dist/esm/pm-plugins/utils/decoration.js +6 -10
  33. package/dist/esm/pm-plugins/utils/sticky-header.js +2 -2
  34. package/dist/esm/tablePlugin.js +1 -2
  35. package/dist/esm/ui/FloatingContextualButton/index.js +1 -2
  36. package/dist/esm/ui/FloatingContextualMenu/index.js +2 -15
  37. package/dist/esm/ui/TableFloatingColumnControls/index.js +1 -1
  38. package/dist/types/pm-plugins/decorations/utils/column-controls.d.ts +2 -2
  39. package/dist/types/pm-plugins/decorations/utils/types.d.ts +1 -7
  40. package/dist/types/pm-plugins/utils/decoration.d.ts +2 -2
  41. package/dist/types/pm-plugins/utils/sticky-header.d.ts +1 -1
  42. package/dist/types-ts4.5/pm-plugins/decorations/utils/column-controls.d.ts +2 -2
  43. package/dist/types-ts4.5/pm-plugins/decorations/utils/types.d.ts +1 -7
  44. package/dist/types-ts4.5/pm-plugins/utils/decoration.d.ts +2 -2
  45. package/dist/types-ts4.5/pm-plugins/utils/sticky-header.d.ts +1 -1
  46. package/package.json +4 -4
@@ -20,7 +20,7 @@ export const createCellHoverDecoration = cells => cells.map(cell => Decoration.n
20
20
  }, {
21
21
  key: TableDecorations.CELL_CONTROLS_HOVER
22
22
  }));
23
- export const createControlsHoverDecoration = (cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) => {
23
+ export const createControlsHoverDecoration = (cells, type, tr, hoveredIndexes, danger, selected) => {
24
24
  const table = findTable(tr.selection);
25
25
  if (!table) {
26
26
  return [];
@@ -64,13 +64,9 @@ export const createControlsHoverDecoration = (cells, type, tr, isDragAndDropEnab
64
64
  if (selected) {
65
65
  classes.push(ClassName.SELECTED_CELL);
66
66
  }
67
- if (isDragAndDropEnable) {
68
- if (type === 'column' || type === 'row') {
69
- classes.pop();
70
- classes.push(ClassName.HOVERED_NO_HIGHLIGHT);
71
- }
72
- } else {
73
- classes.push(type === 'column' ? ClassName.HOVERED_COLUMN : type === 'row' ? ClassName.HOVERED_ROW : ClassName.HOVERED_TABLE);
67
+ if (type === 'column' || type === 'row') {
68
+ classes.pop();
69
+ classes.push(ClassName.HOVERED_NO_HIGHLIGHT);
74
70
  }
75
71
  let key;
76
72
  switch (type) {
@@ -366,7 +362,7 @@ export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexT
366
362
  * this function will return two decorations applying a new class `ClassName.WITH_RESIZE_LINE`
367
363
  * only on the cells: `C1` and `D1`.
368
364
  */
369
- export const createColumnLineResize = (selection, cellColumnPositioning, isDragAndDropEnabled) => {
365
+ export const createColumnLineResize = (selection, cellColumnPositioning) => {
370
366
  const table = findTable(selection);
371
367
  if (!table || cellColumnPositioning.right === null) {
372
368
  return [];
@@ -377,7 +373,7 @@ export const createColumnLineResize = (selection, cellColumnPositioning, isDragA
377
373
  if (isLastColumn) {
378
374
  columnIndex -= 1;
379
375
  }
380
- const decorationClassName = isDragAndDropEnabled ? isLastColumn ? ClassName.WITH_DRAG_RESIZE_LINE_LAST_COLUMN : ClassName.WITH_DRAG_RESIZE_LINE : isLastColumn ? ClassName.WITH_RESIZE_LINE_LAST_COLUMN : ClassName.WITH_RESIZE_LINE;
376
+ const decorationClassName = isLastColumn ? ClassName.WITH_DRAG_RESIZE_LINE_LAST_COLUMN : ClassName.WITH_DRAG_RESIZE_LINE;
381
377
  const cellPositions = makeArray(map.height).map(rowIndex => map.map[map.width * rowIndex + columnIndex]).filter((cellPosition, rowIndex) => {
382
378
  if (isLastColumn) {
383
379
  return true; // If is the last column no filter applied
@@ -6,11 +6,11 @@ export const isAnchorSupported = memorizeOne(() => {
6
6
  }
7
7
  return false;
8
8
  });
9
- export const isNativeStickySupported = isDragAndDropEnabled => {
9
+ export const isNativeStickySupported = () => {
10
10
  const safariVersion = getBrowserInfo().safari_version;
11
11
  const isBrowserSafari = !Number.isNaN(safariVersion);
12
12
  return (
13
13
  // Safari has a bug with position: sticky and content editable, so we don't support it
14
- !isBrowserSafari && isAnchorSupported() && isDragAndDropEnabled
14
+ !isBrowserSafari && isAnchorSupported()
15
15
  );
16
16
  };
@@ -347,8 +347,7 @@ const tablePlugin = ({
347
347
  },
348
348
  eventType: EVENT_TYPE.TRACK
349
349
  })(tr);
350
- },
351
- dragAndDropEnabled: true
350
+ }
352
351
  });
353
352
  }
354
353
  }, {
@@ -42,7 +42,6 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
42
42
  tableWrapper,
43
43
  targetCellPosition,
44
44
  isCellMenuOpenByKeyboard,
45
- isDragAndDropEnabled,
46
45
  intl: {
47
46
  formatMessage
48
47
  }
@@ -102,7 +101,7 @@ const FloatingContextualButtonInner = /*#__PURE__*/React.memo(props => {
102
101
  }));
103
102
  const parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
104
103
  const parentStickyNative = targetCellRef.parentElement && (fg('platform_editor_table_sticky_header_patch_4') ? tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.classList.contains(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW) : targetCellRef.parentElement.classList.contains(ClassName.NATIVE_STICKY));
105
- if (parentStickyNative && targetCellRef.nodeName === 'TH' && isNativeStickySupported(isDragAndDropEnabled !== null && isDragAndDropEnabled !== void 0 ? isDragAndDropEnabled : false) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
104
+ if (parentStickyNative && targetCellRef.nodeName === 'TH' && isNativeStickySupported() && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
106
105
  var _targetCellRef$parent;
107
106
  /* We need to default to checking the anchor style because there may be a conflict with the block controls
108
107
  plugin not using the data attribute value and setting the `anchor-name` style property independently of the data attribute.
@@ -8,7 +8,6 @@ import { Popup } from '@atlaskit/editor-common/ui';
8
8
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
9
9
  import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
10
10
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
11
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
11
  import { getPluginState } from '../../pm-plugins/plugin-factory';
13
12
  import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
14
13
 
@@ -31,25 +30,18 @@ const FloatingContextualMenu = ({
31
30
  api,
32
31
  isDragMenuOpen
33
32
  }) => {
34
- if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
33
+ if (!editorView) {
35
34
  return null;
36
35
  }
37
36
 
38
37
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
39
- // Remove ! during platform_editor_hydratable_ui cleanup
40
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
41
38
  const {
42
39
  targetCellPosition,
43
40
  isDragAndDropEnabled
44
41
  } = getPluginState(editorView.state);
45
- // Remove ! during platform_editor_hydratable_ui cleanup
46
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
47
42
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
48
43
  return null;
49
44
  }
50
-
51
- // Remove ! during platform_editor_hydratable_ui cleanup
52
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
53
45
  const {
54
46
  selection
55
47
  } = editorView.state;
@@ -60,8 +52,6 @@ const FloatingContextualMenu = ({
60
52
  if (!selectionRect) {
61
53
  return null;
62
54
  }
63
- // Remove ! during platform_editor_hydratable_ui cleanup
64
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
65
55
  const domAtPos = editorView.domAtPos.bind(editorView);
66
56
  const targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
67
57
  if (!targetCellRef) {
@@ -91,10 +81,7 @@ const FloatingContextualMenu = ({
91
81
  stick: true
92
82
  }, jsx("div", {
93
83
  css: tablePopupStyles(isDragAndDropEnabled)
94
- }, jsx(ContextualMenu
95
- // Remove ! during platform_editor_hydratable_ui cleanup
96
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
97
- , {
84
+ }, jsx(ContextualMenu, {
98
85
  editorView: editorView
99
86
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
100
87
  ,
@@ -74,7 +74,7 @@ const TableFloatingColumnControls = ({
74
74
  containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.style.removeProperty('top');
75
75
  }
76
76
  let anchorStyles = {};
77
- if (isNativeStickySupported(isDragAndDropEnabled !== null && isDragAndDropEnabled !== void 0 ? isDragAndDropEnabled : false) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
77
+ if (isNativeStickySupported() && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
78
78
  var _tableRef$querySelect, _tableRef$querySelect2;
79
79
  const rowAnchorName = (_tableRef$querySelect = tableRef.querySelector('tr')) === null || _tableRef$querySelect === void 0 ? void 0 : _tableRef$querySelect.style.getPropertyValue('anchor-name');
80
80
  // cast here is due to CSSProperties missing valid positionAnchor property
@@ -24,8 +24,7 @@ export var tableHeaderView = function tableHeaderView(options) {
24
24
  };
25
25
  export var tableRowView = function tableRowView(options) {
26
26
  return function (node, view, getPos) {
27
- var _options$isDragAndDro;
28
- if (isNativeStickySupported((_options$isDragAndDro = options.isDragAndDropEnabled) !== null && _options$isDragAndDro !== void 0 ? _options$isDragAndDro : false) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
27
+ if (isNativeStickySupported() && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
29
28
  return new TableRowNativeStickyWithFallback(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
30
29
  } else {
31
30
  return new TableRow(node, view, getPos, options.eventDispatcher, options.pluginInjectionApi);
@@ -27,8 +27,7 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
27
27
  var customTr = state.tr;
28
28
  var _getPluginState = getPluginState(state),
29
29
  allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing,
30
- getIntl = _getPluginState.getIntl,
31
- isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
30
+ getIntl = _getPluginState.getIntl;
32
31
  var fakeDispatch = function fakeDispatch(tr) {
33
32
  customTr = tr;
34
33
  };
@@ -41,7 +40,7 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
41
40
  });
42
41
  var decorationsWithWidgetAndHandle = updateDecorations(customTr.doc, decorationsWithWidget, createColumnLineResize(state.selection, {
43
42
  right: columnIndex
44
- }, isDragAndDropEnabled), TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
43
+ }), TableDecorations.COLUMN_RESIZING_HANDLE_LINE);
45
44
  getTablePluginCommand({
46
45
  type: 'START_KEYBOARD_COLUMN_RESIZE',
47
46
  data: {
@@ -42,12 +42,10 @@ export var hoverMergedCells = function hoverMergedCells() {
42
42
  export var hoverColumns = function hoverColumns(hoveredColumns, isInDanger) {
43
43
  return createCommand(function (state) {
44
44
  var cells = getCellsInColumn(hoveredColumns)(state.tr.selection);
45
- var _getPluginState = getPluginState(state),
46
- isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
47
45
  if (!cells) {
48
46
  return false;
49
47
  }
50
- var decorations = createControlsHoverDecoration(cells, 'column', state.tr, isDragAndDropEnabled, hoveredColumns, isInDanger);
48
+ var decorations = createControlsHoverDecoration(cells, 'column', state.tr, hoveredColumns, isInDanger);
51
49
  return {
52
50
  type: 'HOVER_COLUMNS',
53
51
  data: {
@@ -66,9 +64,7 @@ export var hoverRows = function hoverRows(hoveredRows, isInDanger) {
66
64
  if (!cells) {
67
65
  return false;
68
66
  }
69
- var _getPluginState2 = getPluginState(state),
70
- isDragAndDropEnabled = _getPluginState2.isDragAndDropEnabled;
71
- var decorations = createControlsHoverDecoration(cells, 'row', state.tr, isDragAndDropEnabled, hoveredRows, isInDanger);
67
+ var decorations = createControlsHoverDecoration(cells, 'row', state.tr, hoveredRows, isInDanger);
72
68
  return {
73
69
  type: 'HOVER_ROWS',
74
70
  data: {
@@ -94,9 +90,7 @@ export var hoverTable = function hoverTable(isInDanger, isSelected) {
94
90
  if (!cells) {
95
91
  return false;
96
92
  }
97
- var _getPluginState3 = getPluginState(state),
98
- isDragAndDropEnabled = _getPluginState3.isDragAndDropEnabled;
99
- var decorations = createControlsHoverDecoration(cells, 'table', state.tr, isDragAndDropEnabled, [], isInDanger, isSelected);
93
+ var decorations = createControlsHoverDecoration(cells, 'table', state.tr, [], isInDanger, isSelected);
100
94
  return {
101
95
  type: 'HOVER_TABLE',
102
96
  data: {
@@ -125,12 +119,10 @@ export var clearHoverSelection = function clearHoverSelection() {
125
119
  };
126
120
  export var showResizeHandleLine = function showResizeHandleLine(cellColumnPositioning) {
127
121
  return createCommand(function (state) {
128
- var _getPluginState4 = getPluginState(state),
129
- isDragAndDropEnabled = _getPluginState4.isDragAndDropEnabled;
130
122
  return {
131
123
  type: 'SHOW_RESIZE_HANDLE_LINE',
132
124
  data: {
133
- decorationSet: updatePluginStateDecorations(state, createColumnLineResize(state.selection, cellColumnPositioning, isDragAndDropEnabled), TableDecorations.COLUMN_RESIZING_HANDLE_LINE)
125
+ decorationSet: updatePluginStateDecorations(state, createColumnLineResize(state.selection, cellColumnPositioning), TableDecorations.COLUMN_RESIZING_HANDLE_LINE)
134
126
  }
135
127
  };
136
128
  });
@@ -159,8 +151,8 @@ export var setTableHovered = function setTableHovered(hovered) {
159
151
  };
160
152
  export var hoverCell = function hoverCell(rowIndex, colIndex) {
161
153
  return createCommand(function (state) {
162
- var _getPluginState5 = getPluginState(state),
163
- prevHoveredCell = _getPluginState5.hoveredCell;
154
+ var _getPluginState = getPluginState(state),
155
+ prevHoveredCell = _getPluginState.hoveredCell;
164
156
 
165
157
  // If no arguments have been passed then the intention it to reset the hover cell data
166
158
  var clear = rowIndex === undefined && colIndex === undefined;
@@ -14,7 +14,7 @@ import { getDecorations } from '../decorations/plugin';
14
14
  import { buildColumnResizingDecorations, clearColumnResizingDecorations } from '../decorations/utils/column-resizing';
15
15
  import { createCommand, getPluginState } from '../plugin-factory';
16
16
  import { fixAutoSizedTable } from '../transforms/fix-tables';
17
- import { createColumnControlsDecoration, createColumnSelectedDecoration } from '../utils/decoration';
17
+ import { createColumnSelectedDecoration } from '../utils/decoration';
18
18
  import { checkIfHeaderColumnEnabled, checkIfHeaderRowEnabled, checkIfNumberColumnEnabled, isIsolating } from '../utils/nodes';
19
19
  import { updatePluginStateDecorations } from '../utils/update-plugin-state-decorations';
20
20
  var DARK_MODE_CELL_COLOR = '#1f1f21';
@@ -34,8 +34,6 @@ export var setTableRef = function setTableRef(ref) {
34
34
  var tableNode = ref && foundTable ? foundTable.node : undefined;
35
35
  var tablePos = ref && foundTable ? foundTable.pos : undefined;
36
36
  var tableWrapperTarget = closestElement(tableRef, ".".concat(ClassName.TABLE_NODE_WRAPPER)) || undefined;
37
- var _getPluginState = getPluginState(state),
38
- isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
39
37
  return {
40
38
  type: 'SET_TABLE_REF',
41
39
  data: {
@@ -46,8 +44,6 @@ export var setTableRef = function setTableRef(ref) {
46
44
  isNumberColumnEnabled: checkIfNumberColumnEnabled(state.selection),
47
45
  isHeaderRowEnabled: checkIfHeaderRowEnabled(state.selection),
48
46
  isHeaderColumnEnabled: checkIfHeaderColumnEnabled(state.selection),
49
- // decoration set is drawn by the decoration plugin, skip this for DnD as all controls are floating
50
- decorationSet: !isDragAndDropEnabled ? updatePluginStateDecorations(state, createColumnControlsDecoration(state.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS) : undefined,
51
47
  resizeHandleRowIndex: undefined,
52
48
  resizeHandleColumnIndex: undefined
53
49
  }
@@ -332,8 +328,8 @@ export var setMultipleCellAttrs = function setMultipleCellAttrs(attrs, editorVie
332
328
  return function (state, dispatch) {
333
329
  var cursorPos;
334
330
  var tr = state.tr;
335
- var _getPluginState2 = getPluginState(state),
336
- targetCellPosition = _getPluginState2.targetCellPosition;
331
+ var _getPluginState = getPluginState(state),
332
+ targetCellPosition = _getPluginState.targetCellPosition;
337
333
  if (isSelectionType(tr.selection, 'cell')) {
338
334
  // Ignored via go/ees005
339
335
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -494,9 +490,9 @@ export var hideInsertColumnOrRowButton = function hideInsertColumnOrRowButton()
494
490
  export var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip, nodeViewPortalProviderAPI, isKeyboardResize) {
495
491
  return createCommand(function (state) {
496
492
  var tableNode = findTable(state.selection);
497
- var _getPluginState3 = getPluginState(state),
498
- allowColumnResizing = _getPluginState3.pluginConfig.allowColumnResizing,
499
- getIntl = _getPluginState3.getIntl;
493
+ var _getPluginState2 = getPluginState(state),
494
+ allowColumnResizing = _getPluginState2.pluginConfig.allowColumnResizing,
495
+ getIntl = _getPluginState2.getIntl;
500
496
  if (!tableNode || !allowColumnResizing) {
501
497
  return false;
502
498
  }
@@ -520,12 +516,12 @@ export var addResizeHandleDecorations = function addResizeHandleDecorations(rowI
520
516
  export var updateResizeHandleDecorations = function updateResizeHandleDecorations(nodeViewPortalProviderAPI, rowIndex, columnIndex, includeTooltip) {
521
517
  return createCommand(function (state) {
522
518
  var tableNode = findTable(state.selection);
523
- var _getPluginState4 = getPluginState(state),
524
- resizeHandleRowIndex = _getPluginState4.resizeHandleRowIndex,
525
- resizeHandleColumnIndex = _getPluginState4.resizeHandleColumnIndex,
526
- resizeHandleIncludeTooltip = _getPluginState4.resizeHandleIncludeTooltip,
527
- allowColumnResizing = _getPluginState4.pluginConfig.allowColumnResizing,
528
- getIntl = _getPluginState4.getIntl;
519
+ var _getPluginState3 = getPluginState(state),
520
+ resizeHandleRowIndex = _getPluginState3.resizeHandleRowIndex,
521
+ resizeHandleColumnIndex = _getPluginState3.resizeHandleColumnIndex,
522
+ resizeHandleIncludeTooltip = _getPluginState3.resizeHandleIncludeTooltip,
523
+ allowColumnResizing = _getPluginState3.pluginConfig.allowColumnResizing,
524
+ getIntl = _getPluginState3.getIntl;
529
525
  if (!tableNode || !allowColumnResizing) {
530
526
  return false;
531
527
  }
@@ -599,8 +595,8 @@ export var addBoldInEmptyHeaderCells = function addBoldInEmptyHeaderCells(tableC
599
595
  };
600
596
  export var updateWidthToWidest = function updateWidthToWidest(widthToWidest) {
601
597
  return createCommand(function (state) {
602
- var _getPluginState5 = getPluginState(state),
603
- prevWidthToWidest = _getPluginState5.widthToWidest;
598
+ var _getPluginState4 = getPluginState(state),
599
+ prevWidthToWidest = _getPluginState4.widthToWidest;
604
600
  if (isEqual(widthToWidest, prevWidthToWidest)) {
605
601
  return false;
606
602
  }
@@ -16,8 +16,6 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
16
16
  var isResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(newState)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
17
17
  var wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
18
18
  var _ref = tablePluginKey.getState(newState) || {},
19
- _ref$isDragAndDropEna = _ref.isDragAndDropEnabled,
20
- isDragAndDropEnabled = _ref$isDragAndDropEna === void 0 ? false : _ref$isDragAndDropEna,
21
19
  isInDanger = _ref.isInDanger,
22
20
  isTableHovered = _ref.isTableHovered;
23
21
  var changedResizing = isResizing !== wasResizing;
@@ -28,10 +26,7 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
28
26
  } else if (tr.docChanged || tr.selection instanceof CellSelection || changedResizing) {
29
27
  return buildColumnControlsDecorations({
30
28
  decorationSet: decorationSet,
31
- tr: tr,
32
- options: {
33
- isDragAndDropEnabled: isDragAndDropEnabled
34
- }
29
+ tr: tr
35
30
  });
36
31
  } else if (tr.selectionSet) {
37
32
  var _findTable, _findTable2;
@@ -46,10 +41,7 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
46
41
  if ((isInDanger || isTableHovered) && (!insideTable(newState) || ((_findTable = findTable(newState.selection)) === null || _findTable === void 0 ? void 0 : _findTable.node) !== ((_findTable2 = findTable(oldState.selection)) === null || _findTable2 === void 0 ? void 0 : _findTable2.node))) {
47
42
  return buildColumnControlsDecorations({
48
43
  decorationSet: decorationSet,
49
- tr: tr,
50
- options: {
51
- isDragAndDropEnabled: isDragAndDropEnabled
52
- }
44
+ tr: tr
53
45
  });
54
46
  }
55
47
  }
@@ -1,9 +1,8 @@
1
1
  // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
2
2
 
3
3
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
4
- import { findTable } from '@atlaskit/editor-tables/utils';
5
4
  import { TableDecorations } from '../../../types';
6
- import { createColumnControlsDecoration, createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../utils/decoration';
5
+ import { createColumnSelectedDecoration, findColumnControlSelectedDecoration, findControlsHoverDecoration, updateDecorations } from '../../utils/decoration';
7
6
  import { composeDecorations } from './compose-decorations';
8
7
  var isColumnSelected = function isColumnSelected(tr) {
9
8
  return tr.selection instanceof CellSelection && tr.selection.isColSelection();
@@ -22,27 +21,18 @@ var maybeUpdateColumnSelectedDecoration = function maybeUpdateColumnSelectedDeco
22
21
  }
23
22
  return updateDecorations(tr.doc, decorationSet, createColumnSelectedDecoration(tr), TableDecorations.COLUMN_SELECTED);
24
23
  };
25
- var maybeUpdateColumnControlsDecoration = function maybeUpdateColumnControlsDecoration(_ref3) {
26
- var decorationSet = _ref3.decorationSet,
27
- tr = _ref3.tr;
28
- var table = findTable(tr.selection);
29
- if (!table) {
30
- return decorationSet;
31
- }
32
- return updateDecorations(tr.doc, decorationSet, createColumnControlsDecoration(tr.selection), TableDecorations.COLUMN_CONTROLS_DECORATIONS);
33
- };
34
24
 
35
25
  // @see: https://product-fabric.atlassian.net/browse/ED-7304
36
- var removeColumnControlsSelectedDecoration = function removeColumnControlsSelectedDecoration(_ref4) {
37
- var decorationSet = _ref4.decorationSet;
26
+ var removeColumnControlsSelectedDecoration = function removeColumnControlsSelectedDecoration(_ref3) {
27
+ var decorationSet = _ref3.decorationSet;
38
28
  return decorationSet.remove(findColumnControlSelectedDecoration(decorationSet));
39
29
  };
40
30
  var hasColumnSelectedDecorations = function hasColumnSelectedDecorations(decorationSet) {
41
31
  return !!findColumnControlSelectedDecoration(decorationSet).length;
42
32
  };
43
- export var maybeUpdateColumnControlsSelectedDecoration = function maybeUpdateColumnControlsSelectedDecoration(_ref5) {
44
- var decorationSet = _ref5.decorationSet,
45
- tr = _ref5.tr;
33
+ export var maybeUpdateColumnControlsSelectedDecoration = function maybeUpdateColumnControlsSelectedDecoration(_ref4) {
34
+ var decorationSet = _ref4.decorationSet,
35
+ tr = _ref4.tr;
46
36
  if (!hasColumnSelectedDecorations(decorationSet)) {
47
37
  return decorationSet;
48
38
  }
@@ -51,17 +41,10 @@ export var maybeUpdateColumnControlsSelectedDecoration = function maybeUpdateCol
51
41
  tr: tr
52
42
  });
53
43
  };
54
- export var buildColumnControlsDecorations = function buildColumnControlsDecorations(_ref6) {
55
- var decorationSet = _ref6.decorationSet,
56
- tr = _ref6.tr,
57
- options = _ref6.options;
58
- if (options.isDragAndDropEnabled) {
59
- return composeDecorations([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration])({
60
- decorationSet: decorationSet,
61
- tr: tr
62
- });
63
- }
64
- return composeDecorations([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration, maybeUpdateColumnControlsDecoration])({
44
+ export var buildColumnControlsDecorations = function buildColumnControlsDecorations(_ref5) {
45
+ var decorationSet = _ref5.decorationSet,
46
+ tr = _ref5.tr;
47
+ return composeDecorations([removeColumnControlsSelectedDecoration, removeControlsHoverDecoration, maybeUpdateColumnSelectedDecoration])({
65
48
  decorationSet: decorationSet,
66
49
  tr: tr
67
50
  });
@@ -33,7 +33,7 @@ export var createCellHoverDecoration = function createCellHoverDecoration(cells)
33
33
  });
34
34
  });
35
35
  };
36
- export var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, isDragAndDropEnable, hoveredIndexes, danger, selected) {
36
+ export var createControlsHoverDecoration = function createControlsHoverDecoration(cells, type, tr, hoveredIndexes, danger, selected) {
37
37
  var table = findTable(tr.selection);
38
38
  if (!table) {
39
39
  return [];
@@ -85,13 +85,9 @@ export var createControlsHoverDecoration = function createControlsHoverDecoratio
85
85
  if (selected) {
86
86
  classes.push(ClassName.SELECTED_CELL);
87
87
  }
88
- if (isDragAndDropEnable) {
89
- if (type === 'column' || type === 'row') {
90
- classes.pop();
91
- classes.push(ClassName.HOVERED_NO_HIGHLIGHT);
92
- }
93
- } else {
94
- classes.push(type === 'column' ? ClassName.HOVERED_COLUMN : type === 'row' ? ClassName.HOVERED_ROW : ClassName.HOVERED_TABLE);
88
+ if (type === 'column' || type === 'row') {
89
+ classes.pop();
90
+ classes.push(ClassName.HOVERED_NO_HIGHLIGHT);
95
91
  }
96
92
  var key;
97
93
  switch (type) {
@@ -392,7 +388,7 @@ export var createResizeHandleDecoration = function createResizeHandleDecoration(
392
388
  * this function will return two decorations applying a new class `ClassName.WITH_RESIZE_LINE`
393
389
  * only on the cells: `C1` and `D1`.
394
390
  */
395
- export var createColumnLineResize = function createColumnLineResize(selection, cellColumnPositioning, isDragAndDropEnabled) {
391
+ export var createColumnLineResize = function createColumnLineResize(selection, cellColumnPositioning) {
396
392
  var table = findTable(selection);
397
393
  if (!table || cellColumnPositioning.right === null) {
398
394
  return [];
@@ -403,7 +399,7 @@ export var createColumnLineResize = function createColumnLineResize(selection, c
403
399
  if (isLastColumn) {
404
400
  columnIndex -= 1;
405
401
  }
406
- var decorationClassName = isDragAndDropEnabled ? isLastColumn ? ClassName.WITH_DRAG_RESIZE_LINE_LAST_COLUMN : ClassName.WITH_DRAG_RESIZE_LINE : isLastColumn ? ClassName.WITH_RESIZE_LINE_LAST_COLUMN : ClassName.WITH_RESIZE_LINE;
402
+ var decorationClassName = isLastColumn ? ClassName.WITH_DRAG_RESIZE_LINE_LAST_COLUMN : ClassName.WITH_DRAG_RESIZE_LINE;
407
403
  var cellPositions = makeArray(map.height).map(function (rowIndex) {
408
404
  return map.map[map.width * rowIndex + columnIndex];
409
405
  }).filter(function (cellPosition, rowIndex) {
@@ -6,11 +6,11 @@ export var isAnchorSupported = memorizeOne(function () {
6
6
  }
7
7
  return false;
8
8
  });
9
- export var isNativeStickySupported = function isNativeStickySupported(isDragAndDropEnabled) {
9
+ export var isNativeStickySupported = function isNativeStickySupported() {
10
10
  var safariVersion = getBrowserInfo().safari_version;
11
11
  var isBrowserSafari = !Number.isNaN(safariVersion);
12
12
  return (
13
13
  // Safari has a bug with position: sticky and content editable, so we don't support it
14
- !isBrowserSafari && isAnchorSupported() && isDragAndDropEnabled
14
+ !isBrowserSafari && isAnchorSupported()
15
15
  );
16
16
  };
@@ -350,8 +350,7 @@ var tablePlugin = function tablePlugin(_ref) {
350
350
  },
351
351
  eventType: EVENT_TYPE.TRACK
352
352
  })(tr);
353
- },
354
- dragAndDropEnabled: true
353
+ }
355
354
  });
356
355
  }
357
356
  }, {
@@ -41,7 +41,6 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
41
41
  tableWrapper = props.tableWrapper,
42
42
  targetCellPosition = props.targetCellPosition,
43
43
  isCellMenuOpenByKeyboard = props.isCellMenuOpenByKeyboard,
44
- isDragAndDropEnabled = props.isDragAndDropEnabled,
45
44
  formatMessage = props.intl.formatMessage; // : Props & WrappedComponentProps
46
45
 
47
46
  var handleClick = function handleClick() {
@@ -94,7 +93,7 @@ var FloatingContextualButtonInner = /*#__PURE__*/React.memo(function (props) {
94
93
  }));
95
94
  var parentSticky = targetCellRef.parentElement && targetCellRef.parentElement.className.indexOf('sticky') > -1;
96
95
  var parentStickyNative = targetCellRef.parentElement && (fg('platform_editor_table_sticky_header_patch_4') ? tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.classList.contains(ClassName.TABLE_NODE_WRAPPER_NO_OVERFLOW) : targetCellRef.parentElement.classList.contains(ClassName.NATIVE_STICKY));
97
- if (parentStickyNative && targetCellRef.nodeName === 'TH' && isNativeStickySupported(isDragAndDropEnabled !== null && isDragAndDropEnabled !== void 0 ? isDragAndDropEnabled : false) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
96
+ if (parentStickyNative && targetCellRef.nodeName === 'TH' && isNativeStickySupported() && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
98
97
  var _targetCellRef$parent;
99
98
  /* We need to default to checking the anchor style because there may be a conflict with the block controls
100
99
  plugin not using the data attribute value and setting the `anchor-name` style property independently of the data attribute.
@@ -8,7 +8,6 @@ import { Popup } from '@atlaskit/editor-common/ui';
8
8
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
9
9
  import { akEditorFloatingDialogZIndex, akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
10
10
  import { findCellRectClosestToPos, getSelectionRect, isSelectionType } from '@atlaskit/editor-tables/utils';
11
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
12
11
  import { getPluginState } from '../../pm-plugins/plugin-factory';
13
12
  import { contextualMenuDropdownWidth, contextualMenuDropdownWidthDnD, contextualMenuTriggerSize, tablePopupMenuFitHeight } from '../consts';
14
13
 
@@ -30,24 +29,17 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
30
29
  isCommentEditor = _ref.isCommentEditor,
31
30
  api = _ref.api,
32
31
  isDragMenuOpen = _ref.isDragMenuOpen;
33
- if (expValEquals('platform_editor_hydratable_ui', 'isEnabled', true) && !editorView) {
32
+ if (!editorView) {
34
33
  return null;
35
34
  }
36
35
 
37
36
  // TargetCellPosition could be outdated: https://product-fabric.atlassian.net/browse/ED-8129
38
- // Remove ! during platform_editor_hydratable_ui cleanup
39
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
40
37
  var _getPluginState = getPluginState(editorView.state),
41
38
  targetCellPosition = _getPluginState.targetCellPosition,
42
39
  isDragAndDropEnabled = _getPluginState.isDragAndDropEnabled;
43
- // Remove ! during platform_editor_hydratable_ui cleanup
44
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
45
40
  if (!isOpen || !targetCellPosition || editorView.state.doc.nodeSize <= targetCellPosition) {
46
41
  return null;
47
42
  }
48
-
49
- // Remove ! during platform_editor_hydratable_ui cleanup
50
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
51
43
  var selection = editorView.state.selection;
52
44
  var selectionRect = isSelectionType(selection, 'cell') ?
53
45
  // Ignored via go/ees005
@@ -56,8 +48,6 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
56
48
  if (!selectionRect) {
57
49
  return null;
58
50
  }
59
- // Remove ! during platform_editor_hydratable_ui cleanup
60
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
61
51
  var domAtPos = editorView.domAtPos.bind(editorView);
62
52
  var targetCellRef = findDomRefAtPos(targetCellPosition, domAtPos);
63
53
  if (!targetCellRef) {
@@ -87,10 +77,7 @@ var FloatingContextualMenu = function FloatingContextualMenu(_ref) {
87
77
  stick: true
88
78
  }, jsx("div", {
89
79
  css: tablePopupStyles(isDragAndDropEnabled)
90
- }, jsx(ContextualMenu
91
- // Remove ! during platform_editor_hydratable_ui cleanup
92
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
93
- , {
80
+ }, jsx(ContextualMenu, {
94
81
  editorView: editorView
95
82
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
96
83
  ,
@@ -75,7 +75,7 @@ var TableFloatingColumnControls = function TableFloatingColumnControls(_ref) {
75
75
  containerRef === null || containerRef === void 0 || (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 || _containerRef$current2.style.removeProperty('top');
76
76
  }
77
77
  var anchorStyles = {};
78
- if (isNativeStickySupported(isDragAndDropEnabled !== null && isDragAndDropEnabled !== void 0 ? isDragAndDropEnabled : false) && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
78
+ if (isNativeStickySupported() && expValEquals('platform_editor_table_sticky_header_improvements', 'cohort', 'test_with_overflow')) {
79
79
  var _tableRef$querySelect, _tableRef$querySelect2;
80
80
  var rowAnchorName = (_tableRef$querySelect = tableRef.querySelector('tr')) === null || _tableRef$querySelect === void 0 ? void 0 : _tableRef$querySelect.style.getPropertyValue('anchor-name');
81
81
  // cast here is due to CSSProperties missing valid positionAnchor property
@@ -1,4 +1,4 @@
1
1
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
- import type { BuildDecorationTransformerParams, DecorationTransformer } from './types';
2
+ import type { DecorationTransformer, DecorationTransformerParams } from './types';
3
3
  export declare const maybeUpdateColumnControlsSelectedDecoration: DecorationTransformer;
4
- export declare const buildColumnControlsDecorations: ({ decorationSet, tr, options, }: BuildDecorationTransformerParams) => DecorationSet;
4
+ export declare const buildColumnControlsDecorations: ({ decorationSet, tr, }: DecorationTransformerParams) => DecorationSet;
@@ -1,13 +1,7 @@
1
1
  import type { ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
3
  export type DecorationTransformer = (params: DecorationTransformerParams) => DecorationSet;
4
- type DecorationTransformerParams = {
4
+ export type DecorationTransformerParams = {
5
5
  decorationSet: DecorationSet;
6
6
  tr: Transaction | ReadonlyTransaction;
7
7
  };
8
- export type BuildDecorationTransformerParams = DecorationTransformerParams & {
9
- options: {
10
- isDragAndDropEnabled: boolean;
11
- };
12
- };
13
- export {};
@@ -9,11 +9,11 @@ import { TableDecorations } from '../../types';
9
9
  export declare const findColumnControlSelectedDecoration: (decorationSet: DecorationSet) => Decoration[];
10
10
  export declare const findControlsHoverDecoration: (decorationSet: DecorationSet) => Decoration[];
11
11
  export declare const createCellHoverDecoration: (cells: Cell[]) => Decoration[];
12
- export declare const createControlsHoverDecoration: (cells: Cell[], type: "row" | "column" | "table", tr: Transaction | ReadonlyTransaction, isDragAndDropEnable: boolean | undefined, hoveredIndexes: number[], danger?: boolean, selected?: boolean) => Decoration[];
12
+ export declare const createControlsHoverDecoration: (cells: Cell[], type: "row" | "column" | "table", tr: Transaction | ReadonlyTransaction, hoveredIndexes: number[], danger?: boolean, selected?: boolean) => Decoration[];
13
13
  export declare const createColumnSelectedDecoration: (tr: Transaction | ReadonlyTransaction) => Decoration[];
14
14
  export declare const createColumnControlsDecoration: (selection: Selection) => Decoration[];
15
15
  export declare const updateDecorations: (node: PmNode, decorationSet: DecorationSet, decorations: Decoration[], key: TableDecorations) => DecorationSet;
16
16
  export declare const createResizeHandleDecoration: (tr: Transaction | ReadonlyTransaction, rowIndexTarget: number, columnEndIndexTarget: Omit<CellColumnPositioning, "left">, includeTooltip: boolean | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI) => [Decoration[], Decoration[]];
17
- export declare const createColumnLineResize: (selection: Selection, cellColumnPositioning: Omit<CellColumnPositioning, "left">, isDragAndDropEnabled?: boolean) => Decoration[];
17
+ export declare const createColumnLineResize: (selection: Selection, cellColumnPositioning: Omit<CellColumnPositioning, "left">) => Decoration[];
18
18
  export declare const createColumnInsertLine: (columnIndex: number, selection: Selection, hasMergedCells: boolean) => Decoration[];
19
19
  export declare const createRowInsertLine: (rowIndex: number, selection: Selection, hasMergedCells: boolean) => Decoration[];
@@ -1,2 +1,2 @@
1
1
  export declare const isAnchorSupported: import("memoize-one").MemoizedFn<() => boolean>;
2
- export declare const isNativeStickySupported: (isDragAndDropEnabled: boolean) => boolean;
2
+ export declare const isNativeStickySupported: () => boolean;
@@ -1,4 +1,4 @@
1
1
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
- import type { BuildDecorationTransformerParams, DecorationTransformer } from './types';
2
+ import type { DecorationTransformer, DecorationTransformerParams } from './types';
3
3
  export declare const maybeUpdateColumnControlsSelectedDecoration: DecorationTransformer;
4
- export declare const buildColumnControlsDecorations: ({ decorationSet, tr, options, }: BuildDecorationTransformerParams) => DecorationSet;
4
+ export declare const buildColumnControlsDecorations: ({ decorationSet, tr, }: DecorationTransformerParams) => DecorationSet;