@atlaskit/editor-plugin-table 7.16.16 → 7.16.18

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 (61) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/cjs/commands-with-analytics.js +66 -41
  3. package/dist/cjs/nodeviews/TableContainer.js +14 -12
  4. package/dist/cjs/nodeviews/TableResizer.js +17 -18
  5. package/dist/cjs/plugin.js +3 -2
  6. package/dist/cjs/pm-plugins/keymap.js +6 -0
  7. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -1
  8. package/dist/cjs/toolbar.js +54 -71
  9. package/dist/cjs/ui/icons/index.js +0 -7
  10. package/dist/cjs/utils/snapping.js +2 -2
  11. package/dist/es2019/commands-with-analytics.js +29 -6
  12. package/dist/es2019/nodeviews/TableContainer.js +17 -13
  13. package/dist/es2019/nodeviews/TableResizer.js +17 -18
  14. package/dist/es2019/plugin.js +3 -2
  15. package/dist/es2019/pm-plugins/keymap.js +7 -1
  16. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
  17. package/dist/es2019/toolbar.js +54 -71
  18. package/dist/es2019/ui/icons/index.js +0 -1
  19. package/dist/es2019/utils/snapping.js +3 -3
  20. package/dist/esm/commands-with-analytics.js +66 -41
  21. package/dist/esm/nodeviews/TableContainer.js +15 -13
  22. package/dist/esm/nodeviews/TableResizer.js +20 -21
  23. package/dist/esm/plugin.js +3 -2
  24. package/dist/esm/pm-plugins/keymap.js +7 -1
  25. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +2 -2
  26. package/dist/esm/toolbar.js +55 -72
  27. package/dist/esm/ui/icons/index.js +0 -1
  28. package/dist/esm/utils/snapping.js +3 -3
  29. package/dist/types/commands/toggle.d.ts +1 -1
  30. package/dist/types/commands-with-analytics.d.ts +7 -4
  31. package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  32. package/dist/types/toolbar.d.ts +4 -5
  33. package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -0
  34. package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -0
  35. package/dist/types/ui/TableFloatingControls/index.d.ts +2 -0
  36. package/dist/types/ui/icons/index.d.ts +0 -1
  37. package/dist/types-ts4.5/commands/toggle.d.ts +1 -1
  38. package/dist/types-ts4.5/commands-with-analytics.d.ts +7 -4
  39. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
  40. package/dist/types-ts4.5/toolbar.d.ts +4 -5
  41. package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -0
  42. package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -0
  43. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +2 -0
  44. package/dist/types-ts4.5/ui/icons/index.d.ts +0 -1
  45. package/package.json +9 -6
  46. package/src/commands-with-analytics.ts +80 -40
  47. package/src/nodeviews/TableContainer.tsx +24 -14
  48. package/src/nodeviews/TableResizer.tsx +29 -15
  49. package/src/plugin.tsx +5 -2
  50. package/src/pm-plugins/keymap.ts +30 -0
  51. package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
  52. package/src/toolbar.tsx +80 -83
  53. package/src/ui/TableFloatingControls/index.tsx +0 -1
  54. package/src/ui/icons/index.ts +0 -1
  55. package/src/utils/snapping.ts +4 -4
  56. package/dist/cjs/ui/icons/DisplayModeIcon.js +0 -46
  57. package/dist/es2019/ui/icons/DisplayModeIcon.js +0 -39
  58. package/dist/esm/ui/icons/DisplayModeIcon.js +0 -39
  59. package/dist/types/ui/icons/DisplayModeIcon.d.ts +0 -4
  60. package/dist/types-ts4.5/ui/icons/DisplayModeIcon.d.ts +0 -4
  61. package/src/ui/icons/DisplayModeIcon.tsx +0 -41
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
  import { jsx } from '@emotion/react';
4
4
  import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
5
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
+ import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
6
6
  import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
7
7
  import commonMessages, { tableMessages as messages } from '@atlaskit/editor-common/messages';
8
8
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
@@ -20,22 +20,31 @@ import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
20
20
  import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
21
21
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
22
22
  import { clearHoverSelection, hoverColumns, hoverMergedCells, hoverRows, hoverTable, removeDescendantNodes } from './commands';
23
- import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, setTableAlignmentWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, toggleTableLockWithAnalytics, wrapTableInExpandWithAnalytics } from './commands-with-analytics';
23
+ import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, deleteTableWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, mergeCellsWithAnalytics, setColorWithAnalytics, setTableAlignmentWithAnalytics, sortColumnWithAnalytics, splitCellWithAnalytics, toggleFixedColumnWidthsOptionAnalytics, toggleHeaderColumnWithAnalytics, toggleHeaderRowWithAnalytics, toggleNumberColumnWithAnalytics, wrapTableInExpandWithAnalytics } from './commands-with-analytics';
24
24
  import { getPluginState } from './pm-plugins/plugin-factory';
25
25
  import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing';
26
+ import { getStaticTableScalingPercent } from './pm-plugins/table-resizing/utils/misc';
26
27
  import { getNewResizeStateFromSelectedColumns } from './pm-plugins/table-resizing/utils/resize-state';
27
28
  import { pluginKey as tableWidthPluginKey } from './pm-plugins/table-width';
28
29
  import { canMergeCells } from './transforms';
29
30
  import { TableCssClassName } from './types';
30
31
  import { FloatingAlignmentButtons } from './ui/FloatingAlignmentButtons/FloatingAlignmentButtons';
31
- import { DisplayModeIcon } from './ui/icons';
32
32
  import { getMergedCellsPositions, getSelectedColumnIndexes, getSelectedRowIndexes, isTableNested } from './utils';
33
33
  import { normaliseAlignment } from './utils/alignment';
34
34
  export const getToolbarMenuConfig = (config, state, {
35
35
  formatMessage
36
- }, editorAnalyticsAPI) => {
36
+ }, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown = false, areTableColumnWidthsFixed = false) => {
37
37
  const optionItem = getBooleanFF('platform.editor.a11y-table-floating-toolbar-dropdown-menu_zkb33') ? 'item-checkbox' : 'item';
38
38
  const options = [{
39
+ id: 'editor.table.lockColumnWidths',
40
+ title: formatMessage(messages.lockColumnWidths),
41
+ onClick: toggleFixedColumnWidthsOptionAnalytics(editorAnalyticsAPI, INPUT_METHOD.FLOATING_TB),
42
+ selected: areTableColumnWidthsFixed,
43
+ hidden: !isTableScalingWithFixedColumnWidthsOptionShown,
44
+ domItemOptions: {
45
+ type: optionItem
46
+ }
47
+ }, {
39
48
  id: 'editor.table.headerRow',
40
49
  title: formatMessage(messages.headerRow),
41
50
  onClick: toggleHeaderRowWithAnalytics(editorAnalyticsAPI),
@@ -81,7 +90,8 @@ export const getToolbarMenuConfig = (config, state, {
81
90
  icon: TableOptionsIcon,
82
91
  title: formatMessage(messages.tableOptions),
83
92
  hidden: options.every(option => option.hidden),
84
- options
93
+ options,
94
+ dropdownWidth: isTableScalingWithFixedColumnWidthsOptionShown ? 192 : undefined
85
95
  };
86
96
  } else {
87
97
  return {
@@ -90,7 +100,8 @@ export const getToolbarMenuConfig = (config, state, {
90
100
  testId: 'table_options',
91
101
  title: formatMessage(messages.tableOptions),
92
102
  hidden: options.every(option => option.hidden),
93
- options
103
+ options,
104
+ dropdownWidth: isTableScalingWithFixedColumnWidthsOptionShown ? 192 : undefined
94
105
  };
95
106
  }
96
107
  };
@@ -305,7 +316,7 @@ export const getClosestSelectionOrTableRect = state => {
305
316
  const tableRect = new Rect(0, 0, map.width, map.height);
306
317
  return isSelectionType(selection, 'cell') ? getSelectionRect(selection) : tableRect;
307
318
  };
308
- export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView, options, shouldUseIncreasedScalingPercent = false) => config => (state, intl) => {
319
+ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, getEditorFeatureFlags, getEditorView, options, isTableScalingWithFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent = false) => config => (state, intl) => {
309
320
  const tableObject = findTable(state.selection);
310
321
  const pluginState = getPluginState(state);
311
322
  const resizeState = tableResizingPluginKey.getState(state);
@@ -315,14 +326,26 @@ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, ge
315
326
  const isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
316
327
  if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
317
328
  const nodeType = state.schema.nodes.table;
318
- const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
319
- let alignmentMenu;
320
329
  const isNested = pluginState.tablePos && isTableNested(state, pluginState.tablePos);
321
- alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth) : [];
322
- let cellItems;
323
- cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, shouldUseIncreasedScalingPercent);
324
- let columnSettingsItems;
325
- columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, getEditorView(), intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) : [];
330
+ const isTableScalingWithFixedColumnWidthsOptionShown = isTableScalingWithFixedColumnWidthsOptionEnabled && !isNested;
331
+ const areTableColumWidthsFixed = tableObject.node.attrs.displayMode === 'fixed';
332
+ const editorView = getEditorView();
333
+ const getDomRef = editorView => {
334
+ let element;
335
+ const domAtPos = editorView.domAtPos.bind(editorView);
336
+ const parent = findParentDomRefOfType(nodeType, domAtPos)(state.selection);
337
+ if (parent) {
338
+ const tableRef = parent.querySelector('table') || undefined;
339
+ if (tableRef) {
340
+ element = closestElement(tableRef, `.${TableCssClassName.TABLE_NODE_WRAPPER}`) || undefined;
341
+ }
342
+ }
343
+ return element;
344
+ };
345
+ const menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI, isTableScalingWithFixedColumnWidthsOptionShown, areTableColumWidthsFixed);
346
+ const alignmentMenu = options !== null && options !== void 0 && options.isTableAlignmentEnabled && !isNested ? getAlignmentOptionsConfig(state, intl, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView) : [];
347
+ const cellItems = pluginState.isDragAndDropEnabled ? [] : getCellItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, shouldUseIncreasedScalingPercent);
348
+ const columnSettingsItems = pluginState.isDragAndDropEnabled ? getColumnSettingItems(state, editorView, intl, getEditorContainerWidth, editorAnalyticsAPI, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) : [];
326
349
  const colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI, getEditorView);
327
350
 
328
351
  // Check if we need to show confirm dialog for delete button
@@ -342,18 +365,6 @@ export const getToolbarConfig = (getEditorContainerWidth, editorAnalyticsAPI, ge
342
365
  onConfirm: (isChecked = false) => clickWithCheckboxHandler(isChecked, tableObject.node)
343
366
  });
344
367
  }
345
- const getDomRef = editorView => {
346
- let element;
347
- const domAtPos = editorView.domAtPos.bind(editorView);
348
- const parent = findParentDomRefOfType(nodeType, domAtPos)(state.selection);
349
- if (parent) {
350
- const tableRef = parent.querySelector('table') || undefined;
351
- if (tableRef) {
352
- element = closestElement(tableRef, `.${TableCssClassName.TABLE_NODE_WRAPPER}`) || undefined;
353
- }
354
- }
355
- return element;
356
- };
357
368
  const {
358
369
  stickyScrollbar
359
370
  } = getEditorFeatureFlags();
@@ -424,25 +435,6 @@ const getCellItems = (state, view, {
424
435
  }
425
436
  return [];
426
437
  };
427
- export const getLockBtnConfig = editorAnalyticsAPI => (state, dispatch, editorView) => {
428
- const selectionOrTableRect = getClosestSelectionOrTableRect(state);
429
- if (!editorView || !selectionOrTableRect) {
430
- return false;
431
- }
432
- const {
433
- tr
434
- } = state;
435
- const table = findTable(tr.selection);
436
- if (!table) {
437
- return false;
438
- } else {
439
- const {
440
- displayMode
441
- } = table.node.attrs;
442
- toggleTableLockWithAnalytics(editorAnalyticsAPI)(displayMode, INPUT_METHOD.FLOATING_TB)(state, dispatch);
443
- return true;
444
- }
445
- };
446
438
  export const getDistributeConfig = (getEditorContainerWidth, editorAnalyticsAPI, isTableScalingEnabled = false) => (state, dispatch, editorView) => {
447
439
  const selectionOrTableRect = getClosestSelectionOrTableRect(state);
448
440
  if (!editorView || !selectionOrTableRect) {
@@ -470,25 +462,6 @@ const getColumnSettingItems = (editorState, editorView, {
470
462
  const newResizeStateWithAnalytics = getNewResizeStateFromSelectedColumns(selectionOrTableRect, editorState, editorView.domAtPos.bind(editorView), getEditorContainerWidth, isTableScalingEnabled);
471
463
  const wouldChange = (_newResizeStateWithAn2 = newResizeStateWithAnalytics === null || newResizeStateWithAnalytics === void 0 ? void 0 : newResizeStateWithAnalytics.changed) !== null && _newResizeStateWithAn2 !== void 0 ? _newResizeStateWithAn2 : false;
472
464
  const items = [];
473
- const isNested = pluginState.tablePos && isTableNested(editorState, pluginState.tablePos);
474
- const isTableScalingLockBtnEnabled = !isNested && isTableScalingEnabled && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
475
- if (isTableScalingLockBtnEnabled) {
476
- var _pluginState$tableNod;
477
- const areColumnWidthsLocked = (pluginState === null || pluginState === void 0 ? void 0 : (_pluginState$tableNod = pluginState.tableNode) === null || _pluginState$tableNod === void 0 ? void 0 : _pluginState$tableNod.attrs.displayMode) === 'fixed';
478
- const title = areColumnWidthsLocked ? formatMessage(messages.unlockColumnWidths) : formatMessage(messages.lockColumnWidths);
479
- items.push({
480
- id: 'editor.table.lockColumns',
481
- type: 'button',
482
- title,
483
- icon: () => jsx(DisplayModeIcon, {
484
- size: "medium",
485
- label: title
486
- }),
487
- onClick: (state, dispatch, view) => getLockBtnConfig(editorAnalyticsAPI)(state, dispatch, view),
488
- selected: areColumnWidthsLocked,
489
- testId: 'table-lock-column-widths-btn'
490
- });
491
- }
492
465
  if (pluginState !== null && pluginState !== void 0 && (_pluginState$pluginCo3 = pluginState.pluginConfig) !== null && _pluginState$pluginCo3 !== void 0 && _pluginState$pluginCo3.allowDistributeColumns && pluginState.isDragAndDropEnabled) {
493
466
  items.push({
494
467
  id: 'editor.table.distributeColumns',
@@ -565,7 +538,7 @@ const highlightColumnsHandler = (state, dispatch) => {
565
538
  };
566
539
  export const getAlignmentOptionsConfig = (editorState, {
567
540
  formatMessage
568
- }, editorAnalyticsAPI, getEditorContainerWidth) => {
541
+ }, editorAnalyticsAPI, getEditorContainerWidth, getDomRef, editorView) => {
569
542
  const tableObject = findTable(editorState.selection);
570
543
  if (!tableObject) {
571
544
  return [];
@@ -598,8 +571,8 @@ export const getAlignmentOptionsConfig = (editorState, {
598
571
  icon: icon,
599
572
  title: formatMessage(layoutToMessages[value]),
600
573
  selected: normaliseAlignment(currentLayout) === value,
601
- onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB),
602
- ...(isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth) && {
574
+ onClick: setTableAlignmentWithAnalytics(editorAnalyticsAPI)(value, currentLayout, INPUT_METHOD.FLOATING_TB, CHANGE_ALIGNMENT_REASON.TOOLBAR_OPTION_CHANGED),
575
+ ...(isLayoutOptionDisabled(tableObject.node, getEditorContainerWidth, getDomRef, editorView) && {
603
576
  disabled: value !== 'center'
604
577
  })
605
578
  };
@@ -628,10 +601,20 @@ export const getSelectedAlignmentIcon = (alignmentIcons, selectedNode) => {
628
601
  const selectedAlignment = selectedNode.attrs.layout;
629
602
  return alignmentIcons.find(icon => icon.value === normaliseAlignment(selectedAlignment));
630
603
  };
631
- export const isLayoutOptionDisabled = (selectedNode, getEditorContainerWidth) => {
632
- const lineLength = getEditorContainerWidth().lineLength;
633
- const tableWidth = getTableContainerWidth(selectedNode);
634
- if (selectedNode && lineLength && tableWidth > lineLength) {
604
+ export const isLayoutOptionDisabled = (selectedNode, getEditorContainerWidth, getDomRef, editorView) => {
605
+ const {
606
+ lineLength
607
+ } = getEditorContainerWidth();
608
+ let tableContainerWidth = getTableContainerWidth(selectedNode);
609
+
610
+ // table may be scaled, use the scale percent to calculate the table width
611
+ if (editorView) {
612
+ const tableWrapper = getDomRef(editorView);
613
+ const tableWrapperWidth = (tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.clientWidth) || tableContainerWidth;
614
+ const scalePercent = getStaticTableScalingPercent(selectedNode, tableWrapperWidth);
615
+ tableContainerWidth = tableContainerWidth * scalePercent;
616
+ }
617
+ if (selectedNode && lineLength && tableContainerWidth > lineLength) {
635
618
  return true;
636
619
  }
637
620
  return false;
@@ -1,7 +1,6 @@
1
1
  export { DragHandleIcon } from './DragHandleIcon';
2
2
  export { DragInMotionIcon } from './DragInMotionIcon';
3
3
  export { DragHandleDisabledIcon } from './DragHandleDisabledIcon';
4
- export { DisplayModeIcon } from './DisplayModeIcon';
5
4
  export { MinimisedHandleIcon } from './MinimisedHandle';
6
5
  export { MergeCellsIcon } from './MergeCellsIcon';
7
6
  export { SplitCellIcon } from './SplitCellIcon';
@@ -1,5 +1,5 @@
1
1
  import { isVerticalPosition } from '@atlaskit/editor-common/guideline';
2
- import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
2
+ import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
3
3
  const numberOfLanesInDefaultLayoutWidth = 12;
4
4
  const calculateSubSnappingWidths = (totalLanes, totalWidth) => new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map((v, i) => v * (i + 1) * 2);
5
5
  export const calculateDefaultSnappings = (lengthOffset = 0) => [...calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, akEditorDefaultLayoutWidth + lengthOffset), akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset, akEditorFullWidthLayoutWidth + lengthOffset];
@@ -8,7 +8,7 @@ export const calculateDefaultTablePreserveSnappings = (lengthOffset = 0, editorC
8
8
  innerGuidelines: false,
9
9
  breakoutPoints: false
10
10
  }) => {
11
- const dynamicFullWidthLine = editorContainerWith - akEditorGutterPadding * 2 >= akEditorFullWidthLayoutWidth ? akEditorFullWidthLayoutWidth : editorContainerWith - akEditorGutterPadding * 2;
11
+ const dynamicFullWidthLine = editorContainerWith - akEditorGutterPaddingDynamic() * 2 >= akEditorFullWidthLayoutWidth ? akEditorFullWidthLayoutWidth : editorContainerWith - akEditorGutterPaddingDynamic() * 2;
12
12
  const guides = [dynamicFullWidthLine - lengthOffset];
13
13
  if (!exclude.breakoutPoints) {
14
14
  guides.unshift(akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset);
@@ -25,7 +25,7 @@ export const defaultTablePreserveSnappingWidths = (lengthOffset, editorContainer
25
25
  innerGuidelines: false,
26
26
  breakoutPoints: false
27
27
  }) => {
28
- return editorContainerWidth - akEditorGutterPadding * 2 > akEditorFullWidthLayoutWidth ? calculateDefaultSnappings() : calculateDefaultTablePreserveSnappings(lengthOffset, editorContainerWidth, exclude); // lengthOffset was hardcoded 0 here, created PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
28
+ return editorContainerWidth - akEditorGutterPaddingDynamic() * 2 > akEditorFullWidthLayoutWidth ? calculateDefaultSnappings() : calculateDefaultTablePreserveSnappings(lengthOffset, editorContainerWidth, exclude); // lengthOffset was hardcoded 0 here, created PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
29
29
  };
30
30
 
31
31
  /**
@@ -5,6 +5,7 @@ import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
5
5
  import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_BREAKOUT, TABLE_DISPLAY_MODE } from '@atlaskit/editor-common/analytics';
6
6
  import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
7
7
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
8
+ import { TableMap } from '@atlaskit/editor-tables/table-map';
8
9
  import { findCellClosestToPos, findCellRectClosestToPos, getSelectionRect } from '@atlaskit/editor-tables/utils';
9
10
  import { clearMultipleCells } from './commands/clear';
10
11
  import { wrapTableInExpand } from './commands/collapse';
@@ -12,7 +13,7 @@ import { changeColumnWidthByStep } from './commands/column-resize';
12
13
  import { deleteColumnsCommand } from './commands/delete';
13
14
  import { setTableDisplayMode } from './commands/display-mode';
14
15
  import { insertColumn, insertRow } from './commands/insert';
15
- import { deleteTable, deleteTableIfSelected, getTableSelectionType, setMultipleCellAttrs, setTableAlignment } from './commands/misc';
16
+ import { deleteTable, deleteTableIfSelected, getTableSelectionType, setMultipleCellAttrs, setTableAlignment, setTableAlignmentWithTableContentWithPos } from './commands/misc';
16
17
  import { sortByColumn } from './commands/sort';
17
18
  import { splitCell } from './commands/split-cell';
18
19
  import { getNextLayout, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './commands/toggle';
@@ -493,47 +494,45 @@ export var wrapTableInExpandWithAnalytics = function wrapTableInExpandWithAnalyt
493
494
  };
494
495
  })(editorAnalyticsAPI)(wrapTableInExpand);
495
496
  };
496
- export var toggleTableLockWithAnalytics = function toggleTableLockWithAnalytics(editorAnalyticsAPI) {
497
- return function (displayMode, inputMethod) {
498
- return withEditorAnalyticsAPI(function (state) {
499
- var _getSelectedTableInfo13 = getSelectedTableInfo(state.selection),
500
- table = _getSelectedTableInfo13.table,
501
- totalRowCount = _getSelectedTableInfo13.totalRowCount,
502
- totalColumnCount = _getSelectedTableInfo13.totalColumnCount;
503
- var previousDisplayMode;
504
- var newDisplayMode;
505
- switch (displayMode) {
506
- case 'fixed':
507
- previousDisplayMode = TABLE_DISPLAY_MODE.FIXED;
508
- newDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
509
- break;
510
- case 'default':
511
- previousDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
512
- newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
513
- break;
514
- case null:
515
- default:
516
- previousDisplayMode = TABLE_DISPLAY_MODE.INITIAL;
517
- newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
518
- }
519
- return {
520
- action: TABLE_ACTION.CHANGED_DISPLAY_MODE,
521
- actionSubject: ACTION_SUBJECT.TABLE,
522
- attributes: {
523
- inputMethod: inputMethod,
524
- previousDisplayMode: previousDisplayMode,
525
- newDisplayMode: newDisplayMode,
526
- tableWidth: table === null || table === void 0 ? void 0 : table.node.attrs.width,
527
- totalRowCount: totalRowCount,
528
- totalColumnCount: totalColumnCount
529
- },
530
- eventType: EVENT_TYPE.TRACK
531
- };
532
- })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableDisplayMode));
533
- };
497
+ export var toggleFixedColumnWidthsOptionAnalytics = function toggleFixedColumnWidthsOptionAnalytics(editorAnalyticsAPI, inputMethod) {
498
+ return withEditorAnalyticsAPI(function (state) {
499
+ var _getSelectedTableInfo13 = getSelectedTableInfo(state.selection),
500
+ table = _getSelectedTableInfo13.table,
501
+ totalRowCount = _getSelectedTableInfo13.totalRowCount,
502
+ totalColumnCount = _getSelectedTableInfo13.totalColumnCount;
503
+ var previousDisplayMode;
504
+ var newDisplayMode;
505
+ switch (table === null || table === void 0 ? void 0 : table.node.attrs.displayMode) {
506
+ case 'fixed':
507
+ previousDisplayMode = TABLE_DISPLAY_MODE.FIXED;
508
+ newDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
509
+ break;
510
+ case 'default':
511
+ previousDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
512
+ newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
513
+ break;
514
+ case null:
515
+ default:
516
+ previousDisplayMode = TABLE_DISPLAY_MODE.INITIAL;
517
+ newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
518
+ }
519
+ return {
520
+ action: TABLE_ACTION.CHANGED_DISPLAY_MODE,
521
+ actionSubject: ACTION_SUBJECT.TABLE,
522
+ attributes: {
523
+ inputMethod: inputMethod,
524
+ previousDisplayMode: previousDisplayMode,
525
+ newDisplayMode: newDisplayMode,
526
+ tableWidth: table === null || table === void 0 ? void 0 : table.node.attrs.width,
527
+ totalRowCount: totalRowCount,
528
+ totalColumnCount: totalColumnCount
529
+ },
530
+ eventType: EVENT_TYPE.TRACK
531
+ };
532
+ })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableDisplayMode));
534
533
  };
535
534
  export var setTableAlignmentWithAnalytics = function setTableAlignmentWithAnalytics(editorAnalyticsAPI) {
536
- return function (newAlignment, previousAlignment, inputMethod) {
535
+ return function (newAlignment, previousAlignment, inputMethod, reason) {
537
536
  return withEditorAnalyticsAPI(function (state) {
538
537
  var _getSelectedTableInfo14 = getSelectedTableInfo(state.selection),
539
538
  table = _getSelectedTableInfo14.table,
@@ -550,9 +549,35 @@ export var setTableAlignmentWithAnalytics = function setTableAlignmentWithAnalyt
550
549
  previousAlignment: previousAlignment === 'center' || previousAlignment === 'align-start' ? previousAlignment : null,
551
550
  totalRowCount: totalRowCount,
552
551
  totalColumnCount: totalColumnCount,
553
- inputMethod: inputMethod
552
+ inputMethod: inputMethod,
553
+ reason: reason
554
554
  }
555
555
  };
556
556
  })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableAlignment(newAlignment)));
557
557
  };
558
+ };
559
+ export var setTableAlignmentWithTableContentWithPosWithAnalytics = function setTableAlignmentWithTableContentWithPosWithAnalytics(editorAnalyticsAPI) {
560
+ return function (newAlignment, previousAlignment, tableNodeWithPos, inputMethod, reason) {
561
+ return withEditorAnalyticsAPI(function () {
562
+ var map = TableMap.get(tableNodeWithPos.node);
563
+ var totalRowCount = map.height;
564
+ var totalColumnCount = map.width;
565
+ var attributes = {
566
+ tableWidth: tableNodeWithPos.node.attrs.width,
567
+ newAlignment: newAlignment,
568
+ previousAlignment: previousAlignment,
569
+ totalRowCount: totalRowCount,
570
+ totalColumnCount: totalColumnCount,
571
+ inputMethod: inputMethod,
572
+ reason: reason
573
+ };
574
+ return {
575
+ action: TABLE_ACTION.CHANGED_ALIGNMENT,
576
+ actionSubject: ACTION_SUBJECT.TABLE,
577
+ actionSubjectId: null,
578
+ eventType: EVENT_TYPE.TRACK,
579
+ attributes: attributes
580
+ };
581
+ })(editorAnalyticsAPI)(editorCommandToPMCommand(setTableAlignmentWithTableContentWithPos(newAlignment, tableNodeWithPos)));
582
+ };
558
583
  };
@@ -1,12 +1,14 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import classNames from 'classnames';
4
+ import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
5
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
6
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
6
- import { akEditorDefaultLayoutWidth, akEditorGutterPadding, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
7
- import { setTableAlignmentWithTableContentWithPos } from '../commands/misc';
7
+ import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
8
+ import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
8
9
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
9
10
  import { TableCssClassName as ClassName } from '../types';
11
+ import { ALIGN_CENTER, ALIGN_START } from '../utils/alignment';
10
12
  import { TableResizer } from './TableResizer';
11
13
  export var InnerContainer = /*#__PURE__*/forwardRef(function (_ref, ref) {
12
14
  var className = _ref.className,
@@ -40,25 +42,25 @@ var AlignmentTableContainer = function AlignmentTableContainer(_ref2) {
40
42
  pluginInjectionApi = _ref2.pluginInjectionApi,
41
43
  getPos = _ref2.getPos,
42
44
  editorView = _ref2.editorView;
43
- var alignment = node.attrs.layout;
45
+ var alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
44
46
  var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['table']),
45
47
  tableState = _useSharedPluginState.tableState;
46
48
  useEffect(function () {
47
49
  if (tableState && editorView && getPos) {
48
50
  var wasFullWidthModeEnabled = tableState.wasFullWidthModeEnabled,
49
51
  isFullWidthModeEnabled = tableState.isFullWidthModeEnabled;
50
- if (wasFullWidthModeEnabled && !isFullWidthModeEnabled && node.attrs.width > akEditorDefaultLayoutWidth) {
52
+ var state = editorView.state,
53
+ dispatch = editorView.dispatch;
54
+ if (wasFullWidthModeEnabled && isFullWidthModeEnabled !== undefined && !isFullWidthModeEnabled && alignment !== ALIGN_CENTER && node.attrs.width > akEditorDefaultLayoutWidth) {
55
+ var _pluginInjectionApi$a;
51
56
  var pos = getPos && getPos();
52
57
  if (typeof pos !== 'number') {
53
58
  return;
54
59
  }
55
- var tr = setTableAlignmentWithTableContentWithPos('center', {
60
+ setTableAlignmentWithTableContentWithPosWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(ALIGN_CENTER, alignment, {
56
61
  pos: pos,
57
62
  node: node
58
- })(editorView.state);
59
- if (tr) {
60
- editorView.dispatch(tr);
61
- }
63
+ }, INPUT_METHOD.AUTO, CHANGE_ALIGNMENT_REASON.EDITOR_APPEARANCE_CHANGED)(state, dispatch);
62
64
  }
63
65
  }
64
66
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -171,8 +173,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
171
173
  })) !== null && _pluginInjectionApi$g !== void 0 ? _pluginInjectionApi$g : false;
172
174
  }, [pluginInjectionApi, editorView]);
173
175
  var attachAnalyticsEvent = useCallback(function (payload) {
174
- var _pluginInjectionApi$a;
175
- return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.attachAnalyticsEvent(payload);
176
+ var _pluginInjectionApi$a2;
177
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions.attachAnalyticsEvent(payload);
176
178
  }, [pluginInjectionApi]);
177
179
  var displayGapCursor = useCallback(function (toggle) {
178
180
  var _pluginInjectionApi$c, _pluginInjectionApi$c2, _pluginInjectionApi$s;
@@ -192,13 +194,13 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
192
194
  // When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
193
195
  // When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
194
196
  // scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
195
- responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - akEditorGutterPadding * 2 - resizeHandleSpacing;
197
+ responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
196
198
  } else {
197
199
  // 76 is currently an accepted padding value considering the spacing for resizer handle
198
200
  // containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
199
201
  // a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
200
202
  // padding left = padding right = akEditorGutterPadding = 32
201
- responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPadding * 2 : containerWidth - akEditorGutterPadding * 2 - resizeHandleSpacing;
203
+ responsiveContainerWidth = isTableScalingEnabled ? containerWidth - akEditorGutterPaddingDynamic() * 2 : containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
202
204
  }
203
205
  var width = Math.min(tableWidth, responsiveContainerWidth);
204
206
  if (!isResizing) {
@@ -5,7 +5,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
6
6
  import rafSchd from 'raf-schd';
7
7
  import { useIntl } from 'react-intl-next';
8
- import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
8
+ import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
9
9
  import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
10
10
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
11
11
  import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keymaps';
@@ -13,10 +13,11 @@ import { tableMessages as messages } from '@atlaskit/editor-common/messages';
13
13
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
14
14
  import { browser } from '@atlaskit/editor-common/utils';
15
15
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
16
- import { akEditorGutterPadding } from '@atlaskit/editor-shared-styles';
16
+ import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
17
17
  import { findTable } from '@atlaskit/editor-tables/utils';
18
18
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
19
- import { setTableAlignmentWithTableContentWithPos, updateWidthToWidest } from '../commands/misc';
19
+ import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
20
+ import { updateWidthToWidest } from '../commands/misc';
20
21
  import { META_KEYS } from '../pm-plugins/table-analytics';
21
22
  import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable, TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
22
23
  import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
@@ -84,7 +85,7 @@ var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWi
84
85
  // guidelineVisibleAdjustment is set as a negative value, so we making it positive and adding + 1
85
86
  var preserve_table_widths_adjustment = -1 * PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET + 1;
86
87
  guidelineVisibleAdjustment = isFullWidthModeEnabled ? preserve_table_widths_adjustment // guidelineVisibleAdjustment = -2, if lineLength = 1180, 1181 < 1180 + 2 is true.
87
- : -2 * akEditorGutterPadding + preserve_table_widths_adjustment; // guidelineVisibleAdjustment = -62, if containerWidth is 1244, 1181 < 1244 - 62 = 1182 is true.
88
+ : -2 * akEditorGutterPaddingDynamic() + preserve_table_widths_adjustment; // guidelineVisibleAdjustment = -62, if containerWidth is 1244, 1181 < 1244 - 62 = 1182 is true.
88
89
  }
89
90
  var width = isTableScalingEnabled && isFullWidthModeEnabled ? lineLength : containerWidth;
90
91
  return guidelines.filter(function (guideline) {
@@ -92,7 +93,7 @@ var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWi
92
93
  });
93
94
  };
94
95
  export var TableResizer = function TableResizer(_ref) {
95
- var _findTable, _editorView$state;
96
+ var _findTable, _editorView$state, _pluginInjectionApi$a2;
96
97
  var children = _ref.children,
97
98
  width = _ref.width,
98
99
  maxWidth = _ref.maxWidth,
@@ -150,7 +151,7 @@ export var TableResizer = function TableResizer(_ref) {
150
151
  keys = _ref3.keys;
151
152
  if (gap !== currentGap.current) {
152
153
  currentGap.current = gap;
153
- var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPadding : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
154
+ var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
154
155
  displayGuideline(getGuidelinesWithHighlights(gap, TABLE_SNAP_GAP, keys, visibleGuidelines));
155
156
  }
156
157
  }, [isTableScalingEnabled, excludeGuidelineConfig, containerWidth, displayGuideline, lineLength, isFullWidthModeEnabled]);
@@ -158,40 +159,38 @@ export var TableResizer = function TableResizer(_ref) {
158
159
  return snappingEnabled ? {
159
160
  x: isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET,
160
161
  // was hardcoded to 0, using PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
161
- isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPadding : containerWidth, excludeGuidelineConfig) : defaultSnappingWidths
162
+ isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth, excludeGuidelineConfig) : defaultSnappingWidths
162
163
  } : undefined;
163
164
  }, [snappingEnabled, isTableScalingEnabled, excludeGuidelineConfig, containerWidth, lineLength, isFullWidthModeEnabled]);
164
165
  var switchToCenterAlignment = useCallback(function (pos, node, newWidth, state, dispatch) {
165
166
  if (isTableAlignmentEnabled && node && node.attrs.layout === ALIGN_START && newWidth > lineLength && lineLength < FULL_WIDTH_EDITOR_CONTENT_WIDTH &&
166
167
  // We don't want to switch alignment in Full-width editor
167
168
  isResizing.current) {
169
+ var _pluginInjectionApi$a;
168
170
  var tableNodeWithPos = {
169
171
  pos: pos,
170
172
  node: node
171
173
  };
172
- var _tr = setTableAlignmentWithTableContentWithPos(ALIGN_CENTER, tableNodeWithPos)(state);
173
- if (_tr) {
174
- dispatch(_tr);
175
- }
174
+ setTableAlignmentWithTableContentWithPosWithAnalytics(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions)(ALIGN_CENTER, ALIGN_START, tableNodeWithPos, INPUT_METHOD.AUTO, CHANGE_ALIGNMENT_REASON.EDITOR_APPEARANCE_CHANGED)(state, dispatch);
176
175
  return true;
177
176
  }
178
177
  return false;
179
- }, [lineLength, isTableAlignmentEnabled, isResizing]);
178
+ }, [isTableAlignmentEnabled, lineLength, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a2 === void 0 ? void 0 : _pluginInjectionApi$a2.actions]);
180
179
  useEffect(function () {
181
180
  return function () {
182
181
  // only bring back the cursor if this table was deleted - i.e. if a user was resizing, then another
183
182
  // deleted this table
184
183
  if (isResizing.current) {
185
184
  var dispatch = editorView.dispatch,
186
- _tr2 = editorView.state.tr;
185
+ _tr = editorView.state.tr;
187
186
  displayGapCursor(true);
188
187
  displayGuideline([]);
189
- _tr2.setMeta(tableWidthPluginKey, {
188
+ _tr.setMeta(tableWidthPluginKey, {
190
189
  resizing: false,
191
190
  tableLocalId: '',
192
191
  tableRef: null
193
192
  });
194
- dispatch(_tr2);
193
+ dispatch(_tr);
195
194
  }
196
195
  };
197
196
  }, [editorView, displayGuideline, displayGapCursor]);
@@ -210,7 +209,7 @@ export var TableResizer = function TableResizer(_ref) {
210
209
  name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
211
210
  });
212
211
  dispatch(tr);
213
- var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPadding : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
212
+ var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
214
213
  setSnappingEnabled(displayGuideline(visibleGuidelines));
215
214
  if (onResizeStart) {
216
215
  onResizeStart();
@@ -235,7 +234,7 @@ export var TableResizer = function TableResizer(_ref) {
235
234
  start: pos + 1,
236
235
  parentWidth: newWidth
237
236
  }, editorView.domAtPos.bind(editorView), isTableScalingEnabled);
238
- var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPadding : containerWidth;
237
+ var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth;
239
238
  var closestSnap = findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE);
240
239
  updateActiveGuidelines(closestSnap);
241
240
 
@@ -305,13 +304,13 @@ export var TableResizer = function TableResizer(_ref) {
305
304
  dispatch(tr);
306
305
  if (getBooleanFF('platform.editor.a11y-table-resizing_uapcv')) {
307
306
  if (delta.width < 0) {
308
- var _pluginInjectionApi$a;
309
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 || _pluginInjectionApi$a.actions.ariaNotify(formatMessage(messages.tableSizeDecreaseScreenReaderInformation, {
307
+ var _pluginInjectionApi$a3;
308
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a3 = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a3 === void 0 || _pluginInjectionApi$a3.actions.ariaNotify(formatMessage(messages.tableSizeDecreaseScreenReaderInformation, {
310
309
  newWidth: newWidth
311
310
  }));
312
311
  } else if (delta.width > 0) {
313
- var _pluginInjectionApi$a2;
314
- pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a2 = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a2 === void 0 || _pluginInjectionApi$a2.actions.ariaNotify(formatMessage(messages.tableSizeIncreaseScreenReaderInformation, {
312
+ var _pluginInjectionApi$a4;
313
+ pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a4 = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a4 === void 0 || _pluginInjectionApi$a4.actions.ariaNotify(formatMessage(messages.tableSizeIncreaseScreenReaderInformation, {
315
314
  newWidth: newWidth
316
315
  }));
317
316
  }
@@ -65,7 +65,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
65
65
  };
66
66
  };
67
67
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
68
- var shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button') && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
68
+ var isTableScalingWithFixedColumnWidthsOptionEnabled = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
69
+ var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && getBooleanFF('platform.editor.table.use-increased-scaling-percent');
69
70
  return {
70
71
  name: 'table',
71
72
  // Use getSharedState to store fullWidthEnabled and wasFullWidthModeEnabled to guarantee access
@@ -464,7 +465,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
464
465
  },
465
466
  floatingToolbar: getToolbarConfig(defaultGetEditorContainerWidth, editorAnalyticsAPI, (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags, function () {
466
467
  return editorViewRef.current;
467
- }, options, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
468
+ }, options, isTableScalingWithFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent)(pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions))
468
469
  }
469
470
  };
470
471
  };