@atlaskit/editor-plugin-table 7.6.14 → 7.7.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 (108) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/commands/misc.js +0 -2
  3. package/dist/cjs/nodeviews/OverflowShadowsObserver.js +1 -3
  4. package/dist/cjs/nodeviews/TableComponent.js +3 -18
  5. package/dist/cjs/nodeviews/TableContainer.js +2 -18
  6. package/dist/cjs/nodeviews/table.js +0 -2
  7. package/dist/cjs/plugin.js +3 -20
  8. package/dist/cjs/pm-plugins/main.js +1 -2
  9. package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +7 -21
  10. package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +32 -57
  11. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -2
  12. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +16 -28
  13. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +2 -12
  14. package/dist/cjs/reducer.js +0 -2
  15. package/dist/cjs/transforms/column-width.js +3 -5
  16. package/dist/cjs/types.js +0 -1
  17. package/dist/cjs/ui/ColumnResizeWidget/index.js +5 -1
  18. package/dist/cjs/ui/common-styles.js +5 -12
  19. package/dist/cjs/ui/ui-styles.js +7 -12
  20. package/dist/cjs/utils/index.js +0 -6
  21. package/dist/cjs/utils/nodes.js +5 -18
  22. package/dist/es2019/commands/misc.js +0 -2
  23. package/dist/es2019/nodeviews/OverflowShadowsObserver.js +1 -3
  24. package/dist/es2019/nodeviews/TableComponent.js +3 -18
  25. package/dist/es2019/nodeviews/TableContainer.js +1 -16
  26. package/dist/es2019/nodeviews/table.js +0 -2
  27. package/dist/es2019/plugin.js +5 -24
  28. package/dist/es2019/pm-plugins/main.js +1 -2
  29. package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +8 -22
  30. package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +30 -53
  31. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +1 -2
  32. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +14 -24
  33. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +2 -12
  34. package/dist/es2019/reducer.js +0 -5
  35. package/dist/es2019/transforms/column-width.js +3 -5
  36. package/dist/es2019/types.js +0 -1
  37. package/dist/es2019/ui/ColumnResizeWidget/index.js +5 -1
  38. package/dist/es2019/ui/common-styles.js +15 -46
  39. package/dist/es2019/ui/ui-styles.js +34 -41
  40. package/dist/es2019/utils/index.js +1 -1
  41. package/dist/es2019/utils/nodes.js +0 -15
  42. package/dist/esm/commands/misc.js +0 -2
  43. package/dist/esm/nodeviews/OverflowShadowsObserver.js +1 -3
  44. package/dist/esm/nodeviews/TableComponent.js +3 -18
  45. package/dist/esm/nodeviews/TableContainer.js +2 -18
  46. package/dist/esm/nodeviews/table.js +0 -2
  47. package/dist/esm/plugin.js +5 -22
  48. package/dist/esm/pm-plugins/main.js +1 -2
  49. package/dist/esm/pm-plugins/table-resizing/event-handlers.js +8 -22
  50. package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +32 -57
  51. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +1 -2
  52. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +16 -28
  53. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +2 -12
  54. package/dist/esm/reducer.js +0 -2
  55. package/dist/esm/transforms/column-width.js +3 -5
  56. package/dist/esm/types.js +0 -1
  57. package/dist/esm/ui/ColumnResizeWidget/index.js +5 -1
  58. package/dist/esm/ui/common-styles.js +6 -13
  59. package/dist/esm/ui/ui-styles.js +7 -12
  60. package/dist/esm/utils/index.js +1 -1
  61. package/dist/esm/utils/nodes.js +0 -13
  62. package/dist/types/nodeviews/TableContainer.d.ts +1 -2
  63. package/dist/types/nodeviews/types.d.ts +0 -1
  64. package/dist/types/plugin.d.ts +0 -1
  65. package/dist/types/pm-plugins/main.d.ts +1 -1
  66. package/dist/types/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -1
  67. package/dist/types/types.d.ts +0 -9
  68. package/dist/types/ui/FloatingContextualButton/index.d.ts +0 -2
  69. package/dist/types/utils/index.d.ts +1 -1
  70. package/dist/types/utils/nodes.d.ts +0 -1
  71. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +1 -2
  72. package/dist/types-ts4.5/nodeviews/types.d.ts +0 -1
  73. package/dist/types-ts4.5/plugin.d.ts +0 -1
  74. package/dist/types-ts4.5/pm-plugins/main.d.ts +1 -1
  75. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/scale-table.d.ts +0 -1
  76. package/dist/types-ts4.5/types.d.ts +0 -9
  77. package/dist/types-ts4.5/ui/FloatingContextualButton/index.d.ts +0 -2
  78. package/dist/types-ts4.5/utils/index.d.ts +1 -1
  79. package/dist/types-ts4.5/utils/nodes.d.ts +0 -1
  80. package/package.json +2 -5
  81. package/src/commands/misc.ts +0 -2
  82. package/src/nodeviews/OverflowShadowsObserver.ts +1 -6
  83. package/src/nodeviews/TableComponent.tsx +2 -25
  84. package/src/nodeviews/TableContainer.tsx +2 -26
  85. package/src/nodeviews/table.tsx +0 -2
  86. package/src/nodeviews/types.ts +0 -1
  87. package/src/plugin.tsx +4 -43
  88. package/src/pm-plugins/main.ts +0 -2
  89. package/src/pm-plugins/table-resizing/event-handlers.ts +8 -37
  90. package/src/pm-plugins/table-resizing/utils/colgroup.ts +40 -61
  91. package/src/pm-plugins/table-resizing/utils/misc.ts +4 -6
  92. package/src/pm-plugins/table-resizing/utils/resize-state.ts +18 -29
  93. package/src/pm-plugins/table-resizing/utils/scale-table.ts +2 -13
  94. package/src/reducer.ts +0 -3
  95. package/src/transforms/column-width.ts +2 -10
  96. package/src/types.ts +0 -8
  97. package/src/ui/ColumnResizeWidget/index.tsx +10 -1
  98. package/src/ui/FloatingContextualButton/index.tsx +0 -2
  99. package/src/ui/common-styles.ts +15 -53
  100. package/src/ui/ui-styles.ts +34 -47
  101. package/src/utils/index.ts +0 -1
  102. package/src/utils/nodes.ts +0 -23
  103. package/dist/cjs/ui/LayoutButton/index.js +0 -206
  104. package/dist/es2019/ui/LayoutButton/index.js +0 -168
  105. package/dist/esm/ui/LayoutButton/index.js +0 -196
  106. package/dist/types/ui/LayoutButton/index.d.ts +0 -21
  107. package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +0 -21
  108. package/src/ui/LayoutButton/index.tsx +0 -217
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { table, tableCell, tableHeader, tableRow, tableWithCustomWidth } from '@atlaskit/adf-schema';
2
+ import { table, tableCell, tableHeader, tableRow } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
4
4
  import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
5
5
  import { IconTable } from '@atlaskit/editor-common/icons';
@@ -33,8 +33,7 @@ import FloatingContextualMenu from './ui/FloatingContextualMenu';
33
33
  import FloatingDeleteButton from './ui/FloatingDeleteButton';
34
34
  import FloatingDragMenu from './ui/FloatingDragMenu';
35
35
  import FloatingInsertButton from './ui/FloatingInsertButton';
36
- import LayoutButton from './ui/LayoutButton';
37
- import { createTableWithWidth, isLayoutSupported } from './utils';
36
+ import { createTableWithWidth } from './utils';
38
37
  const defaultGetEditorFeatureFlags = () => ({});
39
38
 
40
39
  // TODO: duplicating type instead of importing media plugin causing a circular dependency
@@ -107,10 +106,9 @@ const tablesPlugin = ({
107
106
  insertTableWithSize: insertTableWithSize(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)
108
107
  },
109
108
  nodes() {
110
- const tableNode = options !== null && options !== void 0 && options.tableResizingEnabled ? tableWithCustomWidth : table;
111
109
  return [{
112
110
  name: 'table',
113
- node: tableNode
111
+ node: table
114
112
  }, {
115
113
  name: 'tableHeader',
116
114
  node: tableHeader
@@ -136,13 +134,12 @@ const tablesPlugin = ({
136
134
  fullWidthEnabled,
137
135
  wasFullWidthEnabled,
138
136
  tableResizingEnabled,
139
- breakoutEnabled,
140
137
  tableOptions,
141
138
  getEditorFeatureFlags,
142
139
  dragAndDropEnabled,
143
140
  isTableScalingEnabled
144
141
  } = options || {};
145
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled);
142
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthEnabled, wasFullWidthEnabled, dragAndDropEnabled, editorAnalyticsAPI, api, isTableScalingEnabled);
146
143
  }
147
144
  }, {
148
145
  name: 'tablePMColResizing',
@@ -305,9 +302,6 @@ const tablesPlugin = ({
305
302
  tableWidthPluginState,
306
303
  dragAndDropState
307
304
  }) => {
308
- const {
309
- state
310
- } = editorView;
311
305
  const isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
312
306
  const isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
313
307
  const isResizing = isColumnResizing || isTableResizing;
@@ -316,7 +310,6 @@ const tablesPlugin = ({
316
310
  tablePos,
317
311
  targetCellPosition,
318
312
  isContextualMenuOpen,
319
- layout,
320
313
  tableRef,
321
314
  pluginConfig,
322
315
  insertColumnButtonIndex,
@@ -330,17 +323,6 @@ const tablesPlugin = ({
330
323
  allowControls
331
324
  } = pluginConfig;
332
325
  const stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
333
- const LayoutContent = options && !options.tableResizingEnabled && isLayoutSupported(state) && options.breakoutEnabled ? /*#__PURE__*/React.createElement(LayoutButton, {
334
- editorView: editorView,
335
- mountPoint: popupsMountPoint,
336
- boundariesElement: popupsBoundariesElement,
337
- scrollableElement: popupsScrollableElement,
338
- targetRef: tableWrapperTarget,
339
- layout: layout,
340
- isResizing: !!resizingPluginState && !!resizingPluginState.dragging,
341
- stickyHeader: stickyHeader,
342
- editorAnalyticsAPI: editorAnalyticsAPI
343
- }) : null;
344
326
  return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
345
327
  isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
346
328
  editorView: editorView,
@@ -350,7 +332,6 @@ const tablesPlugin = ({
350
332
  scrollableElement: popupsScrollableElement,
351
333
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
352
334
  isContextualMenuOpen: isContextualMenuOpen,
353
- layout: layout,
354
335
  stickyHeader: stickyHeader,
355
336
  tableWrapper: tableWrapperTarget
356
337
  }), allowControls && /*#__PURE__*/React.createElement(FloatingInsertButton, {
@@ -403,7 +384,7 @@ const tablesPlugin = ({
403
384
  stickyHeaders: stickyHeader,
404
385
  isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
405
386
  editorAnalyticsAPI: editorAnalyticsAPI
406
- }), LayoutContent);
387
+ }));
407
388
  }
408
389
  }));
409
390
  },
@@ -22,7 +22,7 @@ import { isHeaderRowRequired } from '../utils/paste';
22
22
  import { defaultHoveredCell, defaultTableSelection } from './default-table-selection';
23
23
  import { createPluginState, getPluginState } from './plugin-factory';
24
24
  import { pluginKey } from './plugin-key';
25
- export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled) => {
25
+ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled) => {
26
26
  var _accessibilityUtils;
27
27
  const state = createPluginState(dispatch, {
28
28
  pluginConfig,
@@ -30,7 +30,6 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
30
30
  insertColumnButtonIndex: undefined,
31
31
  insertRowButtonIndex: undefined,
32
32
  isFullWidthModeEnabled: fullWidthModeEnabled,
33
- isBreakoutEnabled: breakoutEnabled,
34
33
  wasFullWidthModeEnabled: previousFullWidthModeEnabled,
35
34
  isTableResizingEnabled: tableResizingEnabled,
36
35
  isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
@@ -1,7 +1,5 @@
1
1
  import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
2
- import { getParentNodeWidth } from '@atlaskit/editor-common/node-width';
3
2
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
4
- import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
5
3
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
4
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
5
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -13,7 +11,7 @@ import { getPluginState as getTablePluginState } from '../plugin-factory';
13
11
  import { META_KEYS } from '../table-analytics';
14
12
  import { evenColumns, setDragging, stopResizing } from './commands';
15
13
  import { getPluginState } from './plugin-factory';
16
- import { currentColWidth, getLayoutSize, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, updateControls } from './utils';
14
+ import { currentColWidth, getResizeState, getTableMaxWidth, pointsAtCell, resizeColumn, updateControls } from './utils';
17
15
  export const handleMouseDown = (view, event, localResizeHandlePos, getEditorContainerWidth, getEditorFeatureFlags, editorAnalyticsAPI) => {
18
16
  const {
19
17
  state,
@@ -47,25 +45,13 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
47
45
  if (dom && dom.nodeName !== 'TABLE') {
48
46
  dom = dom.closest('table');
49
47
  }
50
- let maxSize;
51
- if (!getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
52
- const containerWidth = getEditorContainerWidth();
53
- const parentWidth = getParentNodeWidth(start, state, containerWidth);
54
- maxSize = getBooleanFF('platform.editor.custom-table-width') ? parentWidth ||
55
- // its safe to reference table width from node as this will not have changed
56
- originalTable.attrs.width || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {}) : parentWidth || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {});
57
- if (originalTable.attrs.isNumberColumnEnabled) {
58
- maxSize -= akEditorTableNumberColumnWidth;
59
- }
60
- } else {
61
- maxSize = getTableMaxWidth({
62
- table: originalTable,
63
- tableStart: start,
64
- state,
65
- layout: originalTable.attrs.layout,
66
- getEditorContainerWidth
67
- });
68
- }
48
+ const maxSize = getTableMaxWidth({
49
+ table: originalTable,
50
+ tableStart: start,
51
+ state,
52
+ layout: originalTable.attrs.layout,
53
+ getEditorContainerWidth
54
+ });
69
55
  const shouldScale = tableDepth === 0 && isTableScalingEnabled;
70
56
  const resizeState = getResizeState({
71
57
  minWidth: tableCellMinWidth,
@@ -2,7 +2,6 @@ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
2
  import { getFragmentBackingArray } from '@atlaskit/editor-common/utils';
3
3
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
4
4
  import { TableMap } from '@atlaskit/editor-tables/table-map';
5
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
5
  import { getTableScalingPercent } from './misc';
7
6
  /**
8
7
  * This ensures the combined width of the columns (and tbody) of table is always smaller or equal
@@ -13,62 +12,40 @@ import { getTableScalingPercent } from './misc';
13
12
  export const getColWidthFix = (colwidth, tableColumnCount) => colwidth - 1 / tableColumnCount;
14
13
  export const generateColgroup = (table, tableRef) => {
15
14
  const cols = [];
16
- if (getBooleanFF('platform.editor.custom-table-width')) {
17
- const map = TableMap.get(table);
18
- table.content.firstChild.content.forEach(cell => {
19
- const colspan = cell.attrs.colspan || 1;
20
- if (Array.isArray(cell.attrs.colwidth)) {
21
- // We slice here to guard against our colwidth array having more entries
22
- // Than the we actually span. We'll patch the document at a later point.
23
- if (tableRef) {
24
- const scalePercent = getTableScalingPercent(table, tableRef);
25
- cell.attrs.colwidth.slice(0, colspan).forEach(width => {
26
- const fixedColWidth = getColWidthFix(width, map.width);
27
- const scaledWidth = fixedColWidth * scalePercent;
28
- const finalWidth = Math.max(scaledWidth, tableCellMinWidth);
29
- cols.push(['col', {
30
- style: `width: ${finalWidth}px;`
31
- }]);
32
- });
33
- } else {
34
- cell.attrs.colwidth.slice(0, colspan).forEach(width => {
35
- cols.push(['col', {
36
- style: `width: ${getColWidthFix(width ? Math.max(width, tableCellMinWidth) : tableCellMinWidth, map.width)}px;`
37
- }]);
38
- });
39
- }
40
- } else {
41
- // When we have merged cells on the first row (firstChild),
42
- // We want to ensure we're creating the appropriate amount of
43
- // cols the table still has.
44
- cols.push(...Array.from({
45
- length: colspan
46
- }, _ => ['col', {
47
- style: `width: ${tableCellMinWidth}px;`
48
- }]));
49
- }
50
- });
51
- } else {
52
- table.content.firstChild.content.forEach(cell => {
53
- const colspan = cell.attrs.colspan || 1;
54
- if (Array.isArray(cell.attrs.colwidth)) {
55
- // We slice here to guard against our colwidth array having more entries
56
- // Than the we actually span. We'll patch the document at a later point.
15
+ const map = TableMap.get(table);
16
+ table.content.firstChild.content.forEach(cell => {
17
+ const colspan = cell.attrs.colspan || 1;
18
+ if (Array.isArray(cell.attrs.colwidth)) {
19
+ // We slice here to guard against our colwidth array having more entries
20
+ // Than the we actually span. We'll patch the document at a later point.
21
+ if (tableRef) {
22
+ const scalePercent = getTableScalingPercent(table, tableRef);
57
23
  cell.attrs.colwidth.slice(0, colspan).forEach(width => {
58
- cols.push(['col', width ? {
59
- style: `width: ${width}px;`
60
- } : {}]);
24
+ const fixedColWidth = getColWidthFix(width, map.width);
25
+ const scaledWidth = fixedColWidth * scalePercent;
26
+ const finalWidth = Math.max(scaledWidth, tableCellMinWidth);
27
+ cols.push(['col', {
28
+ style: `width: ${finalWidth}px;`
29
+ }]);
61
30
  });
62
31
  } else {
63
- // When we have merged cells on the first row (firstChild),
64
- // We want to ensure we're creating the appropriate amount of
65
- // cols the table still has.
66
- cols.push(...Array.from({
67
- length: colspan
68
- }, _ => ['col', {}]));
32
+ cell.attrs.colwidth.slice(0, colspan).forEach(width => {
33
+ cols.push(['col', {
34
+ style: `width: ${getColWidthFix(width ? Math.max(width, tableCellMinWidth) : tableCellMinWidth, map.width)}px;`
35
+ }]);
36
+ });
69
37
  }
70
- });
71
- }
38
+ } else {
39
+ // When we have merged cells on the first row (firstChild),
40
+ // We want to ensure we're creating the appropriate amount of
41
+ // cols the table still has.
42
+ cols.push(...Array.from({
43
+ length: colspan
44
+ }, _ => ['col', {
45
+ style: `width: ${tableCellMinWidth}px;`
46
+ }]));
47
+ }
48
+ });
72
49
  return cols;
73
50
  };
74
51
  export const insertColgroupFromNode = (tableRef, table, isTableScalingEnabled = false, shouldRemove = true) => {
@@ -3,7 +3,6 @@ import { calcTableWidth } from '@atlaskit/editor-common/styles';
3
3
  import { getBreakpoint, mapBreakpointToLayoutMaxWidth } from '@atlaskit/editor-common/ui';
4
4
  import { calcTableColumnWidths, containsClassName } from '@atlaskit/editor-common/utils';
5
5
  import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
6
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
6
  import { hasTableBeenResized } from './colgroup';
8
7
  import { MAX_SCALING_PERCENT } from './consts';
9
8
 
@@ -69,7 +68,7 @@ export const getTableMaxWidth = ({
69
68
  }) => {
70
69
  const containerWidth = getEditorContainerWidth();
71
70
  const parentWidth = getParentNodeWidth(tableStart, state, containerWidth);
72
- let maxWidth = getBooleanFF('platform.editor.custom-table-width') ? parentWidth || table.attrs.width || getLayoutSize(layout, containerWidth.width, {}) : parentWidth || getLayoutSize(layout, containerWidth.width, {});
71
+ let maxWidth = parentWidth || table.attrs.width || getLayoutSize(layout, containerWidth.width, {});
73
72
  if (table.attrs.isNumberColumnEnabled) {
74
73
  maxWidth -= akEditorTableNumberColumnWidth;
75
74
  }
@@ -1,7 +1,6 @@
1
1
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
2
2
  import { tableCellMinWidth, tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
3
3
  import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
4
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
4
  import { getSelectedTableInfo } from '../../../utils';
6
5
  import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
7
6
  import { getCellsRefsInColumn, getColumnStateFromDOM } from './column-state';
@@ -74,33 +73,24 @@ export const getResizeState = ({
74
73
  // updates Colgroup DOM node with new widths
75
74
  export const updateColgroup = (state, tableRef, tableNode, isTableScalingEnabled) => {
76
75
  const cols = tableRef.querySelectorAll('col');
77
- if (getBooleanFF('platform.editor.custom-table-width')) {
78
- const columnsCount = cols.length;
79
- if (isTableScalingEnabled && tableNode) {
80
- const scalePercent = getTableScalingPercent(tableNode, tableRef);
81
- state.cols.filter(column => column && !!column.width) // if width is 0, we dont want to apply that.
82
- .forEach((column, i) => {
83
- const fixedColWidth = getColWidthFix(column.width, columnsCount);
84
- const scaledWidth = fixedColWidth * scalePercent;
85
- const finalWidth = Math.max(scaledWidth, tableCellMinWidth);
86
- // we aren't handling the remaining pixels here when the 48px min width is reached
87
- if (cols[i]) {
88
- cols[i].style.width = `${finalWidth}px`;
89
- }
90
- });
91
- } else {
92
- state.cols.filter(column => column && !!column.width) // if width is 0, we dont want to apply that.
93
- .forEach((column, i) => {
94
- if (cols[i]) {
95
- cols[i].style.width = `${getColWidthFix(column.width, columnsCount)}px`;
96
- }
97
- });
98
- }
76
+ const columnsCount = cols.length;
77
+ if (isTableScalingEnabled && tableNode) {
78
+ const scalePercent = getTableScalingPercent(tableNode, tableRef);
79
+ state.cols.filter(column => column && !!column.width) // if width is 0, we dont want to apply that.
80
+ .forEach((column, i) => {
81
+ const fixedColWidth = getColWidthFix(column.width, columnsCount);
82
+ const scaledWidth = fixedColWidth * scalePercent;
83
+ const finalWidth = Math.max(scaledWidth, tableCellMinWidth);
84
+ // we aren't handling the remaining pixels here when the 48px min width is reached
85
+ if (cols[i]) {
86
+ cols[i].style.width = `${finalWidth}px`;
87
+ }
88
+ });
99
89
  } else {
100
90
  state.cols.filter(column => column && !!column.width) // if width is 0, we dont want to apply that.
101
91
  .forEach((column, i) => {
102
92
  if (cols[i]) {
103
- cols[i].style.width = `${column.width}px`;
93
+ cols[i].style.width = `${getColWidthFix(column.width, columnsCount)}px`;
104
94
  }
105
95
  });
106
96
  }
@@ -11,28 +11,18 @@ import { syncStickyRowToTable } from './dom';
11
11
  // Base function to trigger the actual scale on a table node.
12
12
  // Will only resize/scale if a table has been previously resized.
13
13
  export const scale = (tableRef, options, domAtPos, isTableScalingEnabled = false) => {
14
- /**
15
- * isBreakoutEnabled === true -> default center aligned
16
- * isBreakoutEnabled === false -> full width mode
17
- */
18
-
19
14
  const {
20
15
  node,
21
16
  containerWidth,
22
17
  previousContainerWidth,
23
18
  prevNode,
24
19
  start,
25
- isBreakoutEnabled,
26
20
  layoutChanged,
27
21
  isTableResizingEnabled
28
22
  } = options;
29
- const maxSize = isTableResizingEnabled ? getTableContainerWidth(node) : getLayoutSize(node.attrs.layout, containerWidth, {
30
- isBreakoutEnabled
31
- });
23
+ const maxSize = isTableResizingEnabled ? getTableContainerWidth(node) : getLayoutSize(node.attrs.layout, containerWidth, {});
32
24
  const prevTableWidth = getTableWidth(prevNode);
33
- const previousMaxSize = isTableResizingEnabled ? getTableContainerWidth(node) : getLayoutSize(prevNode.attrs.layout, previousContainerWidth, {
34
- isBreakoutEnabled
35
- });
25
+ const previousMaxSize = isTableResizingEnabled ? getTableContainerWidth(node) : getLayoutSize(prevNode.attrs.layout, previousContainerWidth, {});
36
26
  let newWidth = maxSize;
37
27
 
38
28
  // adjust table width if layout is updated
@@ -29,11 +29,6 @@ export default ((pluginState, action) => {
29
29
  ...action.data,
30
30
  isContextualMenuOpen: false
31
31
  };
32
- case 'SET_TABLE_LAYOUT':
33
- return {
34
- ...pluginState,
35
- ...action.data
36
- };
37
32
  case 'TOGGLE_CONTEXTUAL_MENU':
38
33
  return {
39
34
  ...pluginState,
@@ -1,12 +1,10 @@
1
1
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
2
2
  import { AttrStep } from '@atlaskit/editor-prosemirror/transform';
3
3
  import { TableMap } from '@atlaskit/editor-tables/table-map';
4
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
4
  import { getTableContainerElementWidth, getTableElementWidth, hasTableBeenResized } from '../pm-plugins/table-resizing/utils';
6
5
  import { isMinCellWidthTable } from '../pm-plugins/table-resizing/utils/colgroup';
7
6
  import { getResizeState } from '../pm-plugins/table-resizing/utils/resize-state';
8
7
  import { scaleTableTo } from '../pm-plugins/table-resizing/utils/scale-table';
9
- import { insertColumnButtonOffset } from '../ui/common-styles';
10
8
 
11
9
  /**
12
10
  * Given a new ResizeState object, create a transaction that replaces and updates the table node based on new state.
@@ -111,16 +109,16 @@ export const rescaleColumns = (isTableScalingEnabled = false) => (table, view) =
111
109
  if (shouldScale) {
112
110
  previousTableInfo = {
113
111
  width: getTableElementWidth(table.node),
114
- possibleMaxWidth: getBooleanFF('platform.editor.custom-table-width') ? getTableContainerElementWidth(table.node) : getTableContainerElementWidth(table.node) - insertColumnButtonOffset,
112
+ possibleMaxWidth: getTableContainerElementWidth(table.node),
115
113
  isResized
116
114
  };
117
115
  } else {
118
- var _tableRef$parentEleme, _tableRef$parentEleme2;
116
+ var _tableRef$parentEleme;
119
117
  previousTableInfo = {
120
118
  // when table is resized the tableRef client width will be 1px larger than colGroup, which is used in calculations
121
119
  width: isResized ? tableRef.clientWidth - 1 : tableRef.clientWidth,
122
120
  /** the is the width the table can reach before overflowing */
123
- possibleMaxWidth: getBooleanFF('platform.editor.custom-table-width') ? (tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 0 : ((tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$parentEleme2 = tableRef.parentElement) === null || _tableRef$parentEleme2 === void 0 ? void 0 : _tableRef$parentEleme2.clientWidth) || 0) - insertColumnButtonOffset,
121
+ possibleMaxWidth: (tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 0,
124
122
  isResized
125
123
  };
126
124
  }
@@ -69,7 +69,6 @@ export const TableCssClassName = {
69
69
  CONTROLS_INSERT_BUTTON_WRAP: `${tablePrefixSelector}-controls__insert-button-wrap`,
70
70
  CONTROLS_INSERT_LINE: `${tablePrefixSelector}-controls__insert-line`,
71
71
  CONTROLS_BUTTON_OVERLAY: `${tablePrefixSelector}-controls__button-overlay`,
72
- LAYOUT_BUTTON: `${tablePrefixSelector}-layout-button`,
73
72
  DRAG_CONTROLS_INSERT_BUTTON: `${tablePrefixSelector}-controls__drag-insert-button`,
74
73
  DRAG_CONTROLS_INSERT_BUTTON_INNER: `${tablePrefixSelector}-controls__drag-insert-button-inner`,
75
74
  DRAG_CONTROLS_INSERT_BUTTON_INNER_COLUMN: `${tablePrefixSelector}-controls__drag-insert-button-inner-column`,
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
  import { jsx } from '@emotion/react';
4
4
  import { useIntl } from 'react-intl-next';
5
+ import { startColumnResizing, ToolTipContent } from '@atlaskit/editor-common/keymaps';
5
6
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
7
  import Tooltip from '@atlaskit/tooltip';
7
8
  import { TableCssClassName } from '../../types';
@@ -21,7 +22,10 @@ export const ColumnResizeWidget = ({
21
22
  });
22
23
  }
23
24
  return jsx(Tooltip, {
24
- content: formatMessage(messages.adjustColumns),
25
+ content: jsx(ToolTipContent, {
26
+ description: formatMessage(messages.adjustColumns),
27
+ keymap: startColumnResizing
28
+ }),
25
29
  hideTooltipOnClick: true,
26
30
  hideTooltipOnMouseDown: true,
27
31
  position: "mouse",
@@ -6,7 +6,7 @@ import { browser } from '@atlaskit/editor-common/utils';
6
6
  import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, MAX_BROWSER_SCROLLBAR_HEIGHT, relativeFontSizeToBase16, SelectionStyle } from '@atlaskit/editor-shared-styles';
7
7
  import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
- import { B300, N0, N20A, N300, N40A, R500 } from '@atlaskit/theme/colors';
9
+ import { N0, N40A, R500 } from '@atlaskit/theme/colors';
10
10
  import { fontSize } from '@atlaskit/theme/constants';
11
11
  import { TableCssClassName as ClassName } from '../types';
12
12
  import { columnControlsDecorationHeight, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, rowControlsZIndex, stickyHeaderBorderBottomWidth, stickyRowOffsetTop, tableBorderColor, tableBorderDeleteColor, tableBorderRadiusSize, tableBorderSelectedColor, tableCellBackgroundColor, tableCellDeleteColor, tableCellSelectedColor, tableControlsSpacing, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tablePadding, tableScrollbarOffset, tableTextColor, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
@@ -177,35 +177,6 @@ const tableStickyHeaderFirefoxFixStyle = () => {
177
177
  `;
178
178
  }
179
179
  };
180
- const tableWrapperStyles = () => {
181
- if (getBooleanFF('platform.editor.custom-table-width')) {
182
- return css`
183
- .${ClassName.TABLE_NODE_WRAPPER} {
184
- padding-bottom: 0px;
185
- /* fixes gap cursor height */
186
- overflow: auto;
187
- overflow-y: hidden;
188
- position: relative;
189
-
190
- > table[data-number-column='true'] {
191
- width: calc(100% - 1px);
192
- }
193
- }
194
- `;
195
- } else {
196
- return css`
197
- .${ClassName.TABLE_NODE_WRAPPER} {
198
- padding-right: ${insertColumnButtonOffset}px;
199
- margin-right: -${insertColumnButtonOffset}px;
200
- padding-bottom: 0px;
201
- /* fixes gap cursor height */
202
- overflow: auto;
203
- overflow-y: hidden;
204
- position: relative;
205
- }
206
- `;
207
- }
208
- };
209
180
 
210
181
  // re-exporting these styles to use in Gemini test when table node view is rendered outside of PM
211
182
  export const baseTableStyles = props => {
@@ -526,7 +497,7 @@ export const baseTableStyles = props => {
526
497
 
527
498
  .${ClassName.TABLE_CONTAINER}[data-number-column='true'] {
528
499
  .${ClassName.CORNER_CONTROLS}, .${ClassName.CONTROLS_CORNER_BUTTON} {
529
- width: ${getBooleanFF('platform.editor.custom-table-width') ? akEditorTableToolbarSize + akEditorTableNumberColumnWidth + 1 : akEditorTableToolbarSize + akEditorTableNumberColumnWidth}px;
500
+ width: ${akEditorTableToolbarSize + akEditorTableNumberColumnWidth + 1}px;
530
501
  }
531
502
  .${ClassName.ROW_CONTROLS} .${ClassName.CONTROLS_BUTTON} {
532
503
  border-right-width: 0;
@@ -764,7 +735,7 @@ export const baseTableStyles = props => {
764
735
  .${ClassName.NUMBERED_COLUMN} {
765
736
  position: relative;
766
737
  float: right;
767
- margin-left: ${getBooleanFF('platform.editor.custom-table-width') ? akEditorTableToolbarSize : akEditorTableToolbarSize - 1}px;
738
+ margin-left: ${akEditorTableToolbarSize}px;
768
739
  top: ${(_props$featureFlags4 = props.featureFlags) !== null && _props$featureFlags4 !== void 0 && _props$featureFlags4.tableDragAndDrop ? 0 : akEditorTableToolbarSize}px;
769
740
  width: ${akEditorTableNumberColumnWidth + 1}px;
770
741
  box-sizing: border-box;
@@ -813,7 +784,7 @@ export const baseTableStyles = props => {
813
784
  display: block;
814
785
  }
815
786
  .${ClassName.NUMBERED_COLUMN} {
816
- padding-left: ${getBooleanFF('platform.editor.custom-table-width') ? 0 : 1}px;
787
+ padding-left: 0px;
817
788
 
818
789
  .${ClassName.NUMBERED_COLUMN_BUTTON} {
819
790
  border-left: 0 none;
@@ -979,24 +950,22 @@ export const baseTableStyles = props => {
979
950
  z-index: ${akEditorTableCellOnStickyHeaderZIndex - 4};
980
951
  }
981
952
 
982
- ${tableWrapperStyles()}
953
+ .${ClassName.TABLE_NODE_WRAPPER} {
954
+ padding-bottom: 0px;
955
+ /* fixes gap cursor height */
956
+ overflow: auto;
957
+ overflow-y: hidden;
958
+ position: relative;
959
+
960
+ > table[data-number-column='true'] {
961
+ width: calc(100% - 1px);
962
+ }
963
+ }
983
964
  `;
984
965
  };
985
966
 
986
967
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4139
987
968
  export const tableStyles = props => css`
988
- .${ClassName.LAYOUT_BUTTON} button {
989
- background: ${`var(--ds-background-neutral, ${N20A})`};
990
- color: ${`var(--ds-icon, ${N300})`};
991
- cursor: none;
992
- }
993
-
994
- .${ClassName.LAYOUT_BUTTON}:not(.${ClassName.IS_RESIZING}) button:hover {
995
- background: ${`var(--ds-background-neutral-hovered, ${B300})`};
996
- color: ${"var(--ds-icon, white)"} !important;
997
- cursor: pointer;
998
- }
999
-
1000
969
  .ProseMirror {
1001
970
  ${baseTableStyles(props)}
1002
971
  }