@atlaskit/editor-plugin-table 19.0.0 → 20.0.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 (63) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/cjs/nodeviews/TableResizer.js +1 -1
  3. package/dist/cjs/nodeviews/table.js +18 -2
  4. package/dist/cjs/nodeviews/toDOM.js +18 -4
  5. package/dist/cjs/pm-plugins/keymap.js +12 -12
  6. package/dist/cjs/pm-plugins/main.js +41 -7
  7. package/dist/cjs/pm-plugins/table-width.js +10 -0
  8. package/dist/cjs/pm-plugins/transforms/content-mode.js +48 -0
  9. package/dist/cjs/pm-plugins/transforms/fix-tables.js +4 -35
  10. package/dist/cjs/pm-plugins/transforms/table-transform-utils.js +62 -0
  11. package/dist/cjs/pm-plugins/utils/tableMode.js +149 -0
  12. package/dist/cjs/tablePlugin.js +45 -40
  13. package/dist/cjs/ui/ContentComponent.js +1 -0
  14. package/dist/cjs/ui/event-handlers.js +3 -2
  15. package/dist/cjs/ui/global-styles.js +2 -1
  16. package/dist/cjs/ui/toolbar.js +36 -7
  17. package/dist/es2019/nodeviews/TableResizer.js +1 -1
  18. package/dist/es2019/nodeviews/table.js +18 -2
  19. package/dist/es2019/nodeviews/toDOM.js +18 -4
  20. package/dist/es2019/pm-plugins/keymap.js +2 -2
  21. package/dist/es2019/pm-plugins/main.js +41 -7
  22. package/dist/es2019/pm-plugins/table-width.js +10 -0
  23. package/dist/es2019/pm-plugins/transforms/content-mode.js +39 -0
  24. package/dist/es2019/pm-plugins/transforms/fix-tables.js +2 -33
  25. package/dist/es2019/pm-plugins/transforms/table-transform-utils.js +56 -0
  26. package/dist/es2019/pm-plugins/utils/tableMode.js +148 -0
  27. package/dist/es2019/tablePlugin.js +10 -4
  28. package/dist/es2019/ui/ContentComponent.js +1 -0
  29. package/dist/es2019/ui/event-handlers.js +4 -3
  30. package/dist/es2019/ui/global-styles.js +2 -1
  31. package/dist/es2019/ui/toolbar.js +33 -6
  32. package/dist/esm/nodeviews/TableResizer.js +1 -1
  33. package/dist/esm/nodeviews/table.js +18 -2
  34. package/dist/esm/nodeviews/toDOM.js +18 -4
  35. package/dist/esm/pm-plugins/keymap.js +12 -12
  36. package/dist/esm/pm-plugins/main.js +41 -7
  37. package/dist/esm/pm-plugins/table-width.js +10 -0
  38. package/dist/esm/pm-plugins/transforms/content-mode.js +41 -0
  39. package/dist/esm/pm-plugins/transforms/fix-tables.js +2 -33
  40. package/dist/esm/pm-plugins/transforms/table-transform-utils.js +56 -0
  41. package/dist/esm/pm-plugins/utils/tableMode.js +143 -0
  42. package/dist/esm/tablePlugin.js +45 -40
  43. package/dist/esm/ui/ContentComponent.js +1 -0
  44. package/dist/esm/ui/event-handlers.js +4 -3
  45. package/dist/esm/ui/global-styles.js +2 -1
  46. package/dist/esm/ui/toolbar.js +36 -7
  47. package/dist/types/pm-plugins/keymap.d.ts +1 -1
  48. package/dist/types/pm-plugins/main.d.ts +1 -1
  49. package/dist/types/pm-plugins/transforms/content-mode.d.ts +8 -0
  50. package/dist/types/pm-plugins/transforms/table-transform-utils.d.ts +11 -0
  51. package/dist/types/pm-plugins/utils/tableMode.d.ts +22 -0
  52. package/dist/types/tablePluginType.d.ts +6 -0
  53. package/dist/types/types/index.d.ts +3 -0
  54. package/dist/types/ui/global-styles.d.ts +2 -1
  55. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +1 -1
  56. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  57. package/dist/types-ts4.5/pm-plugins/transforms/content-mode.d.ts +8 -0
  58. package/dist/types-ts4.5/pm-plugins/transforms/table-transform-utils.d.ts +11 -0
  59. package/dist/types-ts4.5/pm-plugins/utils/tableMode.d.ts +22 -0
  60. package/dist/types-ts4.5/tablePluginType.d.ts +6 -0
  61. package/dist/types-ts4.5/types/index.d.ts +3 -0
  62. package/dist/types-ts4.5/ui/global-styles.d.ts +2 -1
  63. package/package.json +21 -20
@@ -1,3 +1,4 @@
1
+ import { bind } from 'bind-event-listener';
1
2
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
3
  import { getBrowserInfo } from '@atlaskit/editor-common/browser';
3
4
  import { insideTable } from '@atlaskit/editor-common/core-utils';
@@ -24,10 +25,13 @@ import { fixTables } from './transforms/fix-tables';
24
25
  import { replaceSelectedTable } from './transforms/replace-table';
25
26
  import { findControlsHoverDecoration } from './utils/decoration';
26
27
  import { transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable, transformSliceToRemoveNestedTables, isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from './utils/paste';
27
- export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption) => {
28
+ import { applyMeasuredWidthToAllTables, isContentModeSupported } from './utils/tableMode';
29
+ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption) => {
28
30
  var _accessibilityUtils;
29
31
  const state = createPluginState(dispatch, {
30
32
  pluginConfig,
33
+ isCommentEditor,
34
+ isChromelessEditor,
31
35
  isTableHovered: false,
32
36
  insertColumnButtonIndex: undefined,
33
37
  insertRowButtonIndex: undefined,
@@ -35,7 +39,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
35
39
  wasFullWidthModeEnabled: previousFullWidthModeEnabled,
36
40
  isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
37
41
  isHeaderColumnEnabled: false,
38
- isDragAndDropEnabled: true,
42
+ isDragAndDropEnabled: dragAndDropEnabled,
39
43
  isTableScalingEnabled: isTableScalingEnabled,
40
44
  ...defaultHoveredCell,
41
45
  ...defaultTableSelection,
@@ -69,7 +73,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
69
73
  tableRow: tableRowView({
70
74
  eventDispatcher,
71
75
  pluginInjectionApi,
72
- isDragAndDropEnabled: true
76
+ isDragAndDropEnabled: dragAndDropEnabled
73
77
  }),
74
78
  tableCell: tableCellView({
75
79
  eventDispatcher,
@@ -117,8 +121,34 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
117
121
  }
118
122
  },
119
123
  view: editorView => {
124
+ var _pluginInjectionApi$e, _pluginInjectionApi$e2;
120
125
  const domAtPos = editorView.domAtPos.bind(editorView);
121
126
  editorViewRef = editorView;
127
+ let contentModeSizeTableId = null;
128
+ let focusListenerBinding = null;
129
+ if ((pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : (_pluginInjectionApi$e2 = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view' && isContentModeSupported({
130
+ allowColumnResizing: !!pluginConfig.allowColumnResizing,
131
+ allowTableResizing: !!pluginConfig.allowTableResizing,
132
+ isFullPageEditor: !isChromelessEditor && !isCommentEditor
133
+ }) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true)) {
134
+ focusListenerBinding = bind(editorView.dom, {
135
+ type: 'focus',
136
+ listener: () => {
137
+ if (contentModeSizeTableId) {
138
+ return;
139
+ }
140
+ contentModeSizeTableId = requestAnimationFrame(() => {
141
+ if (!editorViewRef) {
142
+ return;
143
+ }
144
+ applyMeasuredWidthToAllTables(editorViewRef, pluginInjectionApi);
145
+ });
146
+ },
147
+ options: {
148
+ once: true
149
+ }
150
+ });
151
+ }
122
152
  return {
123
153
  update: (view, prevState) => {
124
154
  const {
@@ -131,12 +161,12 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
131
161
  const pluginState = getPluginState(state);
132
162
  let tableRef;
133
163
  if (fg('platform_editor_enable_table_dnd')) {
134
- var _pluginInjectionApi$e, _pluginInjectionApi$e2;
164
+ var _pluginInjectionApi$e3, _pluginInjectionApi$e4;
135
165
  const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
136
- let shouldSetTableRef = fg('platform_editor_enable_table_dnd_patch_1') ? parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : (_pluginInjectionApi$e2 = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view' : parent;
166
+ let shouldSetTableRef = fg('platform_editor_enable_table_dnd_patch_1') ? parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : (_pluginInjectionApi$e4 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e4 === void 0 ? void 0 : _pluginInjectionApi$e4.mode) !== 'view' : parent;
137
167
  if (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) && fg('platform_editor_update_table_ref_fix')) {
138
- var _pluginInjectionApi$e3, _pluginInjectionApi$e4, _pluginInjectionApi$i, _pluginInjectionApi$i2;
139
- shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : (_pluginInjectionApi$e4 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e4 === void 0 ? void 0 : _pluginInjectionApi$e4.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 ? void 0 : (_pluginInjectionApi$i2 = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i2 === void 0 ? void 0 : _pluginInjectionApi$i2.interactionState) !== 'hasNotHadInteraction';
168
+ var _pluginInjectionApi$e5, _pluginInjectionApi$e6, _pluginInjectionApi$i, _pluginInjectionApi$i2;
169
+ shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e5 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e5 === void 0 ? void 0 : (_pluginInjectionApi$e6 = _pluginInjectionApi$e5.sharedState.currentState()) === null || _pluginInjectionApi$e6 === void 0 ? void 0 : _pluginInjectionApi$e6.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 ? void 0 : (_pluginInjectionApi$i2 = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i2 === void 0 ? void 0 : _pluginInjectionApi$i2.interactionState) !== 'hasNotHadInteraction';
140
170
  }
141
171
  if (shouldSetTableRef) {
142
172
  tableRef =
@@ -199,6 +229,10 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
199
229
  } else if (pluginState.isResizeHandleWidgetAdded) {
200
230
  removeResizeHandleDecorations()(state, dispatch);
201
231
  }
232
+ },
233
+ destroy: () => {
234
+ contentModeSizeTableId && cancelAnimationFrame(contentModeSizeTableId);
235
+ focusListenerBinding && focusListenerBinding();
202
236
  }
203
237
  };
204
238
  },
@@ -12,6 +12,7 @@ import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWi
12
12
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
13
13
  import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from './table-resizing/utils/consts';
14
14
  import { ALIGN_START } from './utils/alignment';
15
+ import { isTableInContentMode } from './utils/tableMode';
15
16
  export const pluginKey = new PluginKey('tableWidthPlugin');
16
17
  const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor) => {
17
18
  return new SafePlugin({
@@ -61,6 +62,15 @@ const createPlugin = (dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWid
61
62
  const tr = newState.tr;
62
63
  if (isReplaceDocumentOperation && !isCommentEditor) {
63
64
  newState.doc.forEach((node, offset) => {
65
+ if (isTableInContentMode({
66
+ node,
67
+ allowColumnResizing: true,
68
+ allowTableResizing: true,
69
+ isFullPageEditor: true,
70
+ isTableNested: false
71
+ })) {
72
+ return;
73
+ }
64
74
  if (node.type === table) {
65
75
  const width = node.attrs.width;
66
76
  const layout = node.attrs.layout;
@@ -0,0 +1,39 @@
1
+ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
+ import { akEditorFullWidthLayoutWidth, akEditorMaxLayoutWidth } from '@atlaskit/editor-shared-styles';
3
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
+ import { updateCellsMarkup } from './table-transform-utils';
5
+ const tableWidth = contentWidth => {
6
+ const maxEditorWidth = expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true) ? akEditorMaxLayoutWidth : akEditorFullWidthLayoutWidth;
7
+ return Math.min(maxEditorWidth, contentWidth);
8
+ };
9
+ export const getTableMeasurement = tableRef => {
10
+ const colWidths = getRenderedColgroupColumnWidths(tableRef);
11
+ const totalContentWidth = colWidths.reduce((acc, current) => acc + current, 0);
12
+ return {
13
+ colWidths,
14
+ tableWidth: tableWidth(totalContentWidth)
15
+ };
16
+ };
17
+ export const applyTableMeasurement = (tr, tableNode, {
18
+ colWidths,
19
+ tableWidth
20
+ }, tablePos) => {
21
+ tr = updateCellsMarkup(tr, tableNode, tablePos, (cell, _rowIndex, colIndex) => {
22
+ const newColWidths = colWidths.slice(colIndex, colIndex + cell.attrs.colspan);
23
+ return cell.type.createChecked({
24
+ ...cell.attrs,
25
+ colwidth: newColWidths.length ? newColWidths : null
26
+ }, cell.content, cell.marks);
27
+ });
28
+ return tr.setNodeMarkup(tablePos, undefined, {
29
+ ...tableNode.attrs,
30
+ width: tableWidth
31
+ });
32
+ };
33
+ function getRenderedColgroupColumnWidths(tableRef) {
34
+ const cols = Array.from(tableRef.querySelectorAll(':scope > colgroup > col'));
35
+ return cols.map(col => {
36
+ const width = col.getBoundingClientRect().width;
37
+ return Math.max(Math.round(width), tableCellMinWidth);
38
+ });
39
+ }
@@ -3,6 +3,7 @@ import { akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/e
3
3
  import { calculateColumnWidth, getCellsRefsInColumn } from '../table-resizing/utils/column-state';
4
4
  import { contentWidth } from '../table-resizing/utils/content-width';
5
5
  import { getLayoutSize } from '../table-resizing/utils/misc';
6
+ import { replaceCells } from './table-transform-utils';
6
7
  const validateTableCellNodeAttrs = ({
7
8
  colspan,
8
9
  rowspan,
@@ -153,36 +154,4 @@ function parseDOMColumnWidths(domAtPos, tableNode, tableStart, tableRef) {
153
154
  }
154
155
  }
155
156
  return cols;
156
- }
157
-
158
- // TODO: ED-26961 - move to prosemirror-utils
159
- const replaceCells = (tr, table, tablePos, modifyCell) => {
160
- const rows = [];
161
- let modifiedCells = 0;
162
- for (let rowIndex = 0; rowIndex < table.childCount; rowIndex++) {
163
- const row = table.child(rowIndex);
164
- const cells = [];
165
- for (let colIndex = 0; colIndex < row.childCount; colIndex++) {
166
- const cell = row.child(colIndex);
167
-
168
- // TODO: ED-26961 - The rowIndex and colIndex are not accurate in a merged cell scenario
169
- // e.g. table with 5 columns might have only one cell in a row, colIndex will be 1, where it should be 4
170
- const node = modifyCell(cell, rowIndex, colIndex);
171
- if (node.sameMarkup(cell) === false) {
172
- modifiedCells++;
173
- }
174
- cells.push(node);
175
- }
176
- if (cells.length) {
177
- rows.push(row.type.createChecked(row.attrs, cells, row.marks));
178
- }
179
- }
180
-
181
- // Check if the table has changed before replacing.
182
- // If no cells are modified our counter will be zero.
183
- if (rows.length && modifiedCells !== 0) {
184
- const newTable = table.type.createChecked(table.attrs, rows, table.marks);
185
- return tr.replaceWith(tablePos, tablePos + table.nodeSize, newTable);
186
- }
187
- return tr;
188
- };
157
+ }
@@ -0,0 +1,56 @@
1
+ // TODO: ED-26961 - move to prosemirror-utils
2
+ export const replaceCells = (tr, table, tablePos, modifyCell) => {
3
+ const rows = [];
4
+ let modifiedCells = 0;
5
+ for (let rowIndex = 0; rowIndex < table.childCount; rowIndex++) {
6
+ const row = table.child(rowIndex);
7
+ const cells = [];
8
+ for (let colIndex = 0; colIndex < row.childCount; colIndex++) {
9
+ const cell = row.child(colIndex);
10
+
11
+ // TODO: ED-26961 - The rowIndex and colIndex are not accurate in a merged cell scenario
12
+ // e.g. table with 5 columns might have only one cell in a row, colIndex will be 1, where it should be 4
13
+ const node = modifyCell(cell, rowIndex, colIndex);
14
+ if (node.sameMarkup(cell) === false) {
15
+ modifiedCells++;
16
+ }
17
+ cells.push(node);
18
+ }
19
+ if (cells.length) {
20
+ rows.push(row.type.createChecked(row.attrs, cells, row.marks));
21
+ }
22
+ }
23
+
24
+ // Check if the table has changed before replacing.
25
+ // If no cells are modified our counter will be zero.
26
+ if (rows.length && modifiedCells !== 0) {
27
+ const newTable = table.type.createChecked(table.attrs, rows, table.marks);
28
+ return tr.replaceWith(tablePos, tablePos + table.nodeSize, newTable);
29
+ }
30
+ return tr;
31
+ };
32
+
33
+ /**
34
+ * Position-preserving alternative to `replaceCells`.
35
+ *
36
+ * Uses `setNodeMarkup` per cell instead of rebuilding the whole table with
37
+ * `replaceWith`, so document positions inside cells are never invalidated.
38
+ * This preserves any existing selection through `tr.mapping`.
39
+ */
40
+ export const updateCellsMarkup = (tr, table, tablePos, modifyCell) => {
41
+ let rowOffset = tablePos + 1;
42
+ for (let rowIndex = 0; rowIndex < table.childCount; rowIndex++) {
43
+ const row = table.child(rowIndex);
44
+ let cellOffset = rowOffset + 1;
45
+ for (let colIndex = 0; colIndex < row.childCount; colIndex++) {
46
+ const cell = row.child(colIndex);
47
+ const modified = modifyCell(cell, rowIndex, colIndex);
48
+ if (!modified.sameMarkup(cell)) {
49
+ tr.setNodeMarkup(cellOffset, modified.type, modified.attrs, modified.marks);
50
+ }
51
+ cellOffset += cell.nodeSize;
52
+ }
53
+ rowOffset += row.nodeSize;
54
+ }
55
+ return tr;
56
+ };
@@ -0,0 +1,148 @@
1
+ import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
2
+ import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
3
+ import { findTable } from '@atlaskit/editor-tables/utils';
4
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
5
+ import { hasTableColumnBeenResized } from '../table-resizing/utils/colgroup';
6
+ import { applyTableMeasurement, getTableMeasurement } from '../transforms/content-mode';
7
+ import { ALIGN_START } from './alignment';
8
+ export const isTableInContentMode = ({
9
+ allowColumnResizing,
10
+ allowTableResizing,
11
+ isFullPageEditor,
12
+ isTableNested,
13
+ node
14
+ }) => {
15
+ if (!expValEqualsNoExposure('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true)) {
16
+ return false;
17
+ }
18
+ if (!node || isTableNested) {
19
+ return false;
20
+ }
21
+ return isContentModeSupported({
22
+ allowColumnResizing,
23
+ allowTableResizing,
24
+ isFullPageEditor
25
+ }) && !hasTableBeenResized(node) && node.attrs.layout === ALIGN_START;
26
+ };
27
+ export const isContentModeSupported = ({
28
+ allowColumnResizing,
29
+ allowTableResizing,
30
+ isFullPageEditor
31
+ }) => {
32
+ return allowColumnResizing && allowTableResizing && isFullPageEditor;
33
+ };
34
+ export const hasTableBeenResized = node => node.attrs.width !== null || hasTableColumnBeenResized(node);
35
+
36
+ /**
37
+ * Iterates all top-level tables in the document, and for those in content mode,
38
+ * measures rendered column widths and sets colwidth + table width attributes
39
+ * in a single batched transaction.
40
+ */
41
+ export const applyMeasuredWidthToAllTables = (view, pluginInjectionApi) => {
42
+ const {
43
+ state: {
44
+ doc,
45
+ schema
46
+ }
47
+ } = view;
48
+ let tr = view.state.tr;
49
+ const {
50
+ table
51
+ } = schema.nodes;
52
+ let modified = false;
53
+ const measuredTables = [];
54
+
55
+ // modify only top-level tables
56
+ doc.forEach((node, offset) => {
57
+ if (node.type !== table || hasTableBeenResized(node) && node.attrs.layout !== ALIGN_START) {
58
+ return;
59
+ }
60
+ const domNode = view.domAtPos(offset + 1).node;
61
+ const tableWrapper = domNode instanceof HTMLElement ? domNode.closest(`.${TableSharedCssClassName.TABLE_VIEW_CONTENT_WRAP}`) : null;
62
+ const tableRef = tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.querySelector('table');
63
+ if (!tableRef) {
64
+ return;
65
+ }
66
+ measuredTables.push({
67
+ node,
68
+ offset,
69
+ measurement: getTableMeasurement(tableRef)
70
+ });
71
+ });
72
+ measuredTables.forEach(({
73
+ node,
74
+ offset,
75
+ measurement
76
+ }) => {
77
+ tr = applyTableMeasurement(tr, node, measurement, offset);
78
+ modified = true;
79
+ });
80
+ if (modified) {
81
+ var _pluginInjectionApi$a, _pluginInjectionApi$a2, _pluginInjectionApi$w, _pluginInjectionApi$w2, _pluginInjectionApi$w3;
82
+ pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : (_pluginInjectionApi$a2 = _pluginInjectionApi$a.actions) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.attachAnalyticsEvent({
83
+ action: TABLE_ACTION.FIT_TO_CONTENT_AUTO_CONVERTED,
84
+ actionSubject: ACTION_SUBJECT.TABLE,
85
+ actionSubjectId: null,
86
+ eventType: EVENT_TYPE.TRACK,
87
+ attributes: {
88
+ editorContainerWidth: (_pluginInjectionApi$w = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$w2 = pluginInjectionApi.width) === null || _pluginInjectionApi$w2 === void 0 ? void 0 : (_pluginInjectionApi$w3 = _pluginInjectionApi$w2.sharedState.currentState()) === null || _pluginInjectionApi$w3 === void 0 ? void 0 : _pluginInjectionApi$w3.width) !== null && _pluginInjectionApi$w !== void 0 ? _pluginInjectionApi$w : 0,
89
+ totalTablesResized: measuredTables.length,
90
+ measurements: measuredTables.map(({
91
+ measurement
92
+ }) => ({
93
+ tableWidth: measurement.tableWidth,
94
+ totalColumnCount: measurement.colWidths.length
95
+ }))
96
+ }
97
+ })(tr);
98
+ view.dispatch(tr.setMeta('addToHistory', false));
99
+ }
100
+ };
101
+ export const applyMeasuredWidthToSelectedTable = (view, api) => {
102
+ var _api$analytics, _api$analytics$action, _api$width$sharedStat, _api$width, _api$width$sharedStat2;
103
+ const tableObject = findTable(view.state.selection);
104
+ if (!tableObject) {
105
+ return;
106
+ }
107
+ const {
108
+ node,
109
+ pos
110
+ } = tableObject;
111
+ const tableState = api === null || api === void 0 ? void 0 : api.table.sharedState.currentState();
112
+ if (!(tableState !== null && tableState !== void 0 && tableState.tableRef)) {
113
+ return;
114
+ }
115
+ const tableRef = tableState.tableRef;
116
+
117
+ // Instead of dispatching a transaction to "strip widths" and then waiting
118
+ // for a rAF to measure natural column widths, instea directly update the DOM elements and
119
+ // take a measurement.
120
+ const cols = Array.from(tableRef.querySelectorAll(':scope > colgroup > col'));
121
+ const contentWrap = tableRef.closest(`.${TableSharedCssClassName.TABLE_VIEW_CONTENT_WRAP}`);
122
+ const resizerContainer = contentWrap === null || contentWrap === void 0 ? void 0 : contentWrap.querySelector(`.${TableSharedCssClassName.TABLE_RESIZER_CONTAINER}`);
123
+ const resizerItem = resizerContainer === null || resizerContainer === void 0 ? void 0 : resizerContainer.querySelector('.resizer-item.display-handle');
124
+ tableRef.style.width = '';
125
+ tableRef.style.tableLayout = 'auto';
126
+ cols.forEach(col => col.style.width = '');
127
+ if (resizerContainer) {
128
+ resizerContainer.style.width = 'max-content';
129
+ resizerContainer.style.setProperty('--ak-editor-table-width', 'max-content');
130
+ }
131
+ if (resizerItem) {
132
+ resizerItem.style.width = 'max-content';
133
+ }
134
+ const measurement = getTableMeasurement(tableRef);
135
+ const tr = applyTableMeasurement(view.state.tr, node, measurement, pos);
136
+ api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.attachAnalyticsEvent({
137
+ action: TABLE_ACTION.FIT_TO_CONTENT_ON_DEMAND,
138
+ actionSubject: ACTION_SUBJECT.TABLE,
139
+ actionSubjectId: null,
140
+ eventType: EVENT_TYPE.TRACK,
141
+ attributes: {
142
+ editorContainerWidth: (_api$width$sharedStat = api === null || api === void 0 ? void 0 : (_api$width = api.width) === null || _api$width === void 0 ? void 0 : (_api$width$sharedStat2 = _api$width.sharedState.currentState()) === null || _api$width$sharedStat2 === void 0 ? void 0 : _api$width$sharedStat2.width) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : 0,
143
+ tableWidth: measurement.tableWidth,
144
+ totalColumnCount: measurement.colWidths.length
145
+ }
146
+ })(tr);
147
+ view.dispatch(tr);
148
+ };
@@ -63,6 +63,7 @@ const tablePlugin = ({
63
63
  const options = {
64
64
  ...config,
65
65
  tableOptions: (_config$tableOptions = config === null || config === void 0 ? void 0 : config.tableOptions) !== null && _config$tableOptions !== void 0 ? _config$tableOptions : {},
66
+ dragAndDropEnabled: (config === null || config === void 0 ? void 0 : config.dragAndDropEnabled) || fg('platform_editor_enable_table_dnd'),
66
67
  isTableScalingEnabled: (config === null || config === void 0 ? void 0 : config.isTableScalingEnabled) || fg('platform_editor_enable_table_scaling')
67
68
  };
68
69
  const defaultGetEditorContainerWidth = () => {
@@ -279,11 +280,12 @@ const tablePlugin = ({
279
280
  wasFullWidthEnabled,
280
281
  tableOptions,
281
282
  getEditorFeatureFlags,
283
+ dragAndDropEnabled,
282
284
  isTableScalingEnabled,
283
285
  isCommentEditor,
284
286
  isChromelessEditor
285
287
  } = options || {};
286
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
288
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
287
289
  }
288
290
  }, {
289
291
  name: 'tablePMColResizing',
@@ -317,13 +319,14 @@ const tablePlugin = ({
317
319
  nodeViewPortalProviderAPI
318
320
  }) => {
319
321
  const {
322
+ dragAndDropEnabled,
320
323
  isTableScalingEnabled = false,
321
324
  fullWidthEnabled = false,
322
325
  isCommentEditor = false,
323
326
  isChromelessEditor = false,
324
327
  tableOptions
325
328
  } = options || {};
326
- return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, isTableScalingEnabled, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableAlignment, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableResizing);
329
+ return keymapPlugin(defaultGetEditorContainerWidth, api, nodeViewPortalProviderAPI, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableAlignment, fullWidthEnabled, api, getIntl, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableOptions === null || tableOptions === void 0 ? void 0 : tableOptions.allowTableResizing);
327
330
  }
328
331
  }, {
329
332
  name: 'tableSelectionKeymap',
@@ -333,6 +336,9 @@ const tablePlugin = ({
333
336
  }, {
334
337
  name: 'tableEditing',
335
338
  plugin: () => {
339
+ const {
340
+ dragAndDropEnabled
341
+ } = options || {};
336
342
  return tableEditing({
337
343
  reportFixedTable: ({
338
344
  tr,
@@ -348,7 +354,7 @@ const tablePlugin = ({
348
354
  eventType: EVENT_TYPE.TRACK
349
355
  })(tr);
350
356
  },
351
- dragAndDropEnabled: true
357
+ dragAndDropEnabled
352
358
  });
353
359
  }
354
360
  }, {
@@ -361,7 +367,7 @@ const tablePlugin = ({
361
367
  plugin: ({
362
368
  dispatch
363
369
  }) => {
364
- return createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor, api);
370
+ return options !== null && options !== void 0 && options.dragAndDropEnabled ? createDragAndDropPlugin(dispatch, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options.isCommentEditor, api) : undefined;
365
371
  }
366
372
  }, {
367
373
  name: 'tableViewModeSort',
@@ -215,6 +215,7 @@ export const ContentComponent = ({
215
215
  fallbackComponent: null
216
216
  }, /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
217
217
  featureFlags: api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState(),
218
+ isDragAndDropEnabledOption: options === null || options === void 0 ? void 0 : options.dragAndDropEnabled,
218
219
  api: api
219
220
  }), /*#__PURE__*/React.createElement(ContentComponentInternal, {
220
221
  api: api,
@@ -1,7 +1,8 @@
1
1
  import rafSchedule from 'raf-schd';
2
2
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
3
+ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
3
4
  import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
4
- import { browser, closestElement, isElementInTableCell, isLastItemMediaGroup, setNodeSelection } from '@atlaskit/editor-common/utils';
5
+ import { closestElement, isElementInTableCell, isLastItemMediaGroup, setNodeSelection } from '@atlaskit/editor-common/utils';
5
6
  import { Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
7
  import { findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
7
8
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
@@ -30,7 +31,7 @@ export const handleBlur = (view, event) => {
30
31
  } = view;
31
32
  // IE version check for ED-4665
32
33
  // Calendar focus check for ED-10466
33
- if (browser.ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event) && !isFocusingDragHandlesClickableZone(event)) {
34
+ if (getBrowserInfo().ie_version !== 11 && !isFocusingCalendar(event) && !isFocusingModal(event) && !isFocusingFloatingToolbar(event) && !isFocusingDragHandles(event) && !isFocusingDragHandlesClickableZone(event)) {
34
35
  setEditorFocus(false)(state, dispatch);
35
36
  }
36
37
  event.preventDefault();
@@ -361,7 +362,7 @@ export const handleMouseMove = nodeViewPortalProviderAPI => (view, event) => {
361
362
  // a reflow. So for now this will just grab the offsetX value immediately for gecko and chrome will calculate later
362
363
  // in the deferred callback handler.
363
364
  // Bug Tracking: https://bugzilla.mozilla.org/show_bug.cgi?id=1882903
364
- handleMouseMoveDebounce(nodeViewPortalProviderAPI)(view, event, browser.gecko ? event.offsetX : NaN);
365
+ handleMouseMoveDebounce(nodeViewPortalProviderAPI)(view, event, getBrowserInfo().gecko ? event.offsetX : NaN);
365
366
  return false;
366
367
  };
367
368
  export function handleTripleClick(view, pos) {
@@ -8,6 +8,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
8
8
  import { tableStyles } from './common-styles';
9
9
  export const GlobalStylesWrapper = ({
10
10
  featureFlags,
11
+ isDragAndDropEnabledOption,
11
12
  api
12
13
  }) => {
13
14
  const {
@@ -22,7 +23,7 @@ export const GlobalStylesWrapper = ({
22
23
  return jsx(Global, {
23
24
  styles: tableStyles({
24
25
  featureFlags,
25
- isDragAndDropEnabled: !isLivePageViewMode
26
+ isDragAndDropEnabled: isDragAndDropEnabledOption && !isLivePageViewMode
26
27
  })
27
28
  });
28
29
  };
@@ -27,6 +27,7 @@ import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
27
27
  import CopyIcon from '@atlaskit/icon/core/copy';
28
28
  import CustomizeIcon from '@atlaskit/icon/core/customize';
29
29
  import DeleteIcon from '@atlaskit/icon/core/delete';
30
+ import ShrinkHorizontalIcon from '@atlaskit/icon/core/shrink-horizontal';
30
31
  import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
31
32
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
32
33
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
@@ -43,6 +44,7 @@ import { normaliseAlignment } from '../pm-plugins/utils/alignment';
43
44
  import { isTableNested } from '../pm-plugins/utils/nodes';
44
45
  import { getSelectedColumnIndexes, getSelectedRowIndexes } from '../pm-plugins/utils/selection';
45
46
  import { getMergedCellsPositions } from '../pm-plugins/utils/table';
47
+ import { applyMeasuredWidthToSelectedTable, isContentModeSupported } from '../pm-plugins/utils/tableMode';
46
48
  import { TableCssClassName } from '../types';
47
49
  import { FloatingAlignmentButtons } from './FloatingAlignmentButtons/FloatingAlignmentButtons';
48
50
  export const getToolbarMenuConfig = (config, state, {
@@ -395,10 +397,16 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
395
397
  const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
396
398
  if (editorExperiment('platform_editor_controls', 'variant1')) {
397
399
  var _api$editorViewMode, _api$editorViewMode$s;
398
- const {
399
- isDragMenuOpen: isDragHandleMenuOpened = false,
400
- isDragging: isTableRowOrColumnDragged = false
401
- } = getDragDropPluginState(state);
400
+ let isDragHandleMenuOpened = false;
401
+ let isTableRowOrColumnDragged = false;
402
+ if (options !== null && options !== void 0 && options.dragAndDropEnabled) {
403
+ const {
404
+ isDragMenuOpen = false,
405
+ isDragging = false
406
+ } = getDragDropPluginState(state);
407
+ isDragHandleMenuOpened = isDragMenuOpen;
408
+ isTableRowOrColumnDragged = isDragging;
409
+ }
402
410
  const isTableOrColumnResizing = !!(resizeState !== null && resizeState !== void 0 && resizeState.dragging || tableWidthState !== null && tableWidthState !== void 0 && tableWidthState.resizing);
403
411
  const isTableMenuOpened = pluginState.isContextualMenuOpen || isDragHandleMenuOpened;
404
412
  const isTableState = isTableRowOrColumnDragged || isTableOrColumnResizing || isTableMenuOpened;
@@ -419,7 +427,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
419
427
  // We don't want to show floating toolbar while resizing the table
420
428
  const isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
421
429
  if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
422
- var _api$limitedMode$shar, _api$limitedMode, _api$limitedMode$shar2, _api$extension, _api$extension$shared, _api$extension2;
430
+ var _api$limitedMode$shar, _api$limitedMode, _api$limitedMode$shar2, _api$editorViewMode2, _api$editorViewMode2$, _api$extension, _api$extension$shared, _api$extension2;
423
431
  const isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
424
432
  const isTableScalingWithFixedColumnWidthsOptionShown = isTableScalingEnabled && isTableFixedColumnWidthsOptionEnabled && !isNested;
425
433
  const areTableColumWidthsFixed = tableObject.node.attrs.displayMode === 'fixed';
@@ -449,6 +457,25 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
449
457
  const cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, options === null || options === void 0 ? void 0 : options.isCommentEditor, isLimitedModeEnabled);
450
458
  const columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, api, editorAnalyticsAPI, isTableScalingEnabled, isTableFixedColumnWidthsOptionEnabled, options === null || options === void 0 ? void 0 : options.isCommentEditor, isLimitedModeEnabled) : [];
451
459
  const colorPicker = !areAnyNewToolbarFlagsEnabled ? getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView) : [];
460
+ const fitToContentButton = isContentModeSupported({
461
+ allowColumnResizing: !!pluginState.pluginConfig.allowColumnResizing,
462
+ allowTableResizing: !!pluginState.pluginConfig.allowTableResizing,
463
+ isFullPageEditor: !pluginState.isChromelessEditor && !pluginState.isCommentEditor
464
+ }) && !isNested && (api === null || api === void 0 ? void 0 : (_api$editorViewMode2 = api.editorViewMode) === null || _api$editorViewMode2 === void 0 ? void 0 : (_api$editorViewMode2$ = _api$editorViewMode2.sharedState.currentState()) === null || _api$editorViewMode2$ === void 0 ? void 0 : _api$editorViewMode2$.mode) !== 'view' && expValEquals('platform_editor_table_fit_to_content_on_demand', 'isEnabled', true) ? [{
465
+ id: 'editor.table.fitToContent',
466
+ type: 'button',
467
+ title: intl.formatMessage(messages.fitToContent),
468
+ icon: () => jsx(ShrinkHorizontalIcon, {
469
+ spacing: 'spacious',
470
+ label: ''
471
+ }),
472
+ onClick: (_state, _dispatch, view) => {
473
+ if (view) {
474
+ applyMeasuredWidthToSelectedTable(view, api !== null && api !== void 0 ? api : undefined);
475
+ }
476
+ return true;
477
+ }
478
+ }] : [];
452
479
 
453
480
  // Check if we need to show confirm dialog for delete button
454
481
  let confirmDialog;
@@ -518,7 +545,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
518
545
  },
519
546
  zIndex: akEditorFloatingPanelZIndex + 1,
520
547
  // Place the context menu slightly above the others
521
- items: [menu, ...(!areAnyNewToolbarFlagsEnabled ? [separator(menu.hidden)] : []), ...alignmentMenu, ...(!areAnyNewToolbarFlagsEnabled ? [separator(alignmentMenu.length === 0)] : []), ...cellItems, ...columnSettingsItems, ...colorPicker, ...(!areAnyNewToolbarFlagsEnabled ? [{
548
+ items: [menu, ...(!areAnyNewToolbarFlagsEnabled ? [separator(menu.hidden)] : []), ...alignmentMenu, ...(!areAnyNewToolbarFlagsEnabled ? [separator(alignmentMenu.length === 0)] : []), ...cellItems, ...columnSettingsItems, ...fitToContentButton, ...colorPicker, ...(!areAnyNewToolbarFlagsEnabled ? [{
522
549
  type: 'extensions-placeholder',
523
550
  separator: 'end'
524
551
  }, copyButton, {
@@ -508,7 +508,7 @@ export var TableResizer = function TableResizer(_ref) {
508
508
  snap: guidelineSnaps,
509
509
  handlePositioning: "adjacent",
510
510
  isHandleVisible: isTableSelected,
511
- needExtendedResizeZone: expValEquals('platform_editor_table_resizer_extended_zone', 'isEnabled', true) ? true : !isTableSelected,
511
+ needExtendedResizeZone: true,
512
512
  appearance: isTableSelected && isWholeTableInDanger ? 'danger' : undefined,
513
513
  handleHighlight: "shadow"
514
514
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)