@atlaskit/editor-plugin-table 2.10.8 → 2.12.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 (144) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +30 -0
  3. package/dist/cjs/plugins/table/commands/misc.js +60 -7
  4. package/dist/cjs/plugins/table/commands/toggle.js +2 -2
  5. package/dist/cjs/plugins/table/commands-with-analytics.js +2 -2
  6. package/dist/cjs/plugins/table/create-plugin-config.js +2 -2
  7. package/dist/cjs/plugins/table/event-handlers.js +3 -6
  8. package/dist/cjs/plugins/table/handlers.js +2 -2
  9. package/dist/cjs/plugins/table/index.js +7 -2
  10. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +2 -2
  11. package/dist/cjs/plugins/table/nodeviews/TableResizer.js +15 -21
  12. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-resizing.js +18 -5
  13. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/index.js +6 -0
  14. package/dist/cjs/plugins/table/pm-plugins/main.js +9 -5
  15. package/dist/cjs/plugins/table/pm-plugins/plugin-factory.js +2 -2
  16. package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -2
  17. package/dist/cjs/plugins/table/pm-plugins/table-local-id.js +13 -13
  18. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -0
  19. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -2
  20. package/dist/cjs/plugins/table/pm-plugins/table-resizing/reducer.js +2 -2
  21. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +2 -2
  22. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -2
  23. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +4 -2
  24. package/dist/cjs/plugins/table/pm-plugins/table-width.js +2 -2
  25. package/dist/cjs/plugins/table/reducer.js +28 -4
  26. package/dist/cjs/plugins/table/transforms/column-width.js +2 -2
  27. package/dist/cjs/plugins/table/transforms/delete-columns.js +2 -2
  28. package/dist/cjs/plugins/table/transforms/delete-rows.js +2 -2
  29. package/dist/cjs/plugins/table/transforms/fix-tables.js +2 -2
  30. package/dist/cjs/plugins/table/transforms/merge.js +2 -2
  31. package/dist/cjs/plugins/table/transforms/split.js +2 -2
  32. package/dist/cjs/plugins/table/types.js +3 -2
  33. package/dist/cjs/plugins/table/ui/ColumnResizeWidget/index.js +44 -0
  34. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +2 -2
  35. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +2 -2
  36. package/dist/cjs/plugins/table/ui/FloatingDeleteButton/index.js +2 -2
  37. package/dist/cjs/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +2 -2
  38. package/dist/cjs/plugins/table/ui/LayoutButton/index.js +2 -2
  39. package/dist/cjs/plugins/table/ui/messages.js +5 -0
  40. package/dist/cjs/plugins/table/utils/decoration.js +17 -4
  41. package/dist/cjs/plugins/table/utils/row-controls.js +2 -2
  42. package/dist/es2019/plugins/table/commands/misc.js +49 -5
  43. package/dist/es2019/plugins/table/event-handlers.js +3 -6
  44. package/dist/es2019/plugins/table/index.js +7 -2
  45. package/dist/es2019/plugins/table/nodeviews/TableResizer.js +14 -17
  46. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-resizing.js +12 -2
  47. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/index.js +1 -1
  48. package/dist/es2019/plugins/table/pm-plugins/main.js +6 -3
  49. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -0
  50. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +2 -0
  51. package/dist/es2019/plugins/table/reducer.js +29 -2
  52. package/dist/es2019/plugins/table/types.js +1 -0
  53. package/dist/es2019/plugins/table/ui/ColumnResizeWidget/index.js +35 -0
  54. package/dist/es2019/plugins/table/ui/messages.js +5 -0
  55. package/dist/es2019/plugins/table/utils/decoration.js +16 -5
  56. package/dist/esm/plugins/table/commands/misc.js +58 -7
  57. package/dist/esm/plugins/table/commands/toggle.js +2 -2
  58. package/dist/esm/plugins/table/commands-with-analytics.js +2 -2
  59. package/dist/esm/plugins/table/create-plugin-config.js +2 -2
  60. package/dist/esm/plugins/table/event-handlers.js +3 -6
  61. package/dist/esm/plugins/table/handlers.js +2 -2
  62. package/dist/esm/plugins/table/index.js +7 -2
  63. package/dist/esm/plugins/table/nodeviews/TableComponent.js +2 -2
  64. package/dist/esm/plugins/table/nodeviews/TableResizer.js +15 -21
  65. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-resizing.js +15 -3
  66. package/dist/esm/plugins/table/pm-plugins/decorations/utils/index.js +1 -1
  67. package/dist/esm/plugins/table/pm-plugins/main.js +10 -6
  68. package/dist/esm/plugins/table/pm-plugins/plugin-factory.js +2 -2
  69. package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin-state.js +2 -2
  70. package/dist/esm/plugins/table/pm-plugins/table-local-id.js +2 -2
  71. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +5 -0
  72. package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -2
  73. package/dist/esm/plugins/table/pm-plugins/table-resizing/reducer.js +2 -2
  74. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-logic.js +2 -2
  75. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -2
  76. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/scale-table.js +4 -2
  77. package/dist/esm/plugins/table/pm-plugins/table-width.js +2 -2
  78. package/dist/esm/plugins/table/reducer.js +28 -4
  79. package/dist/esm/plugins/table/transforms/column-width.js +2 -2
  80. package/dist/esm/plugins/table/transforms/delete-columns.js +2 -2
  81. package/dist/esm/plugins/table/transforms/delete-rows.js +2 -2
  82. package/dist/esm/plugins/table/transforms/fix-tables.js +2 -2
  83. package/dist/esm/plugins/table/transforms/merge.js +2 -2
  84. package/dist/esm/plugins/table/transforms/split.js +2 -2
  85. package/dist/esm/plugins/table/types.js +3 -2
  86. package/dist/esm/plugins/table/ui/ColumnResizeWidget/index.js +35 -0
  87. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +2 -2
  88. package/dist/esm/plugins/table/ui/FloatingDeleteButton/getPopUpOptions.js +2 -2
  89. package/dist/esm/plugins/table/ui/FloatingDeleteButton/index.js +2 -2
  90. package/dist/esm/plugins/table/ui/FloatingInsertButton/getPopupOptions.js +2 -2
  91. package/dist/esm/plugins/table/ui/LayoutButton/index.js +2 -2
  92. package/dist/esm/plugins/table/ui/messages.js +5 -0
  93. package/dist/esm/plugins/table/utils/decoration.js +17 -4
  94. package/dist/esm/plugins/table/utils/row-controls.js +2 -2
  95. package/dist/types/plugins/table/commands/misc.d.ts +8 -6
  96. package/dist/types/plugins/table/event-handlers.d.ts +3 -3
  97. package/dist/types/plugins/table/index.d.ts +4 -0
  98. package/dist/types/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -2
  99. package/dist/types/plugins/table/pm-plugins/decorations/utils/index.d.ts +1 -1
  100. package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
  101. package/dist/types/plugins/table/pm-plugins/table-resizing/plugin.d.ts +2 -2
  102. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
  103. package/dist/types/plugins/table/reducer.d.ts +1 -1
  104. package/dist/types/plugins/table/types.d.ts +18 -0
  105. package/dist/types/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
  106. package/dist/types/plugins/table/ui/messages.d.ts +5 -0
  107. package/dist/types/plugins/table/utils/decoration.d.ts +2 -1
  108. package/dist/types-ts4.5/plugins/table/commands/misc.d.ts +8 -6
  109. package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +3 -3
  110. package/dist/types-ts4.5/plugins/table/index.d.ts +4 -0
  111. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/column-resizing.d.ts +4 -2
  112. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/utils/index.d.ts +1 -1
  113. package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +2 -1
  114. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/plugin.d.ts +2 -2
  115. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/scale-table.d.ts +3 -3
  116. package/dist/types-ts4.5/plugins/table/reducer.d.ts +1 -1
  117. package/dist/types-ts4.5/plugins/table/types.d.ts +18 -0
  118. package/dist/types-ts4.5/plugins/table/ui/ColumnResizeWidget/index.d.ts +9 -0
  119. package/dist/types-ts4.5/plugins/table/ui/messages.d.ts +5 -0
  120. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +2 -1
  121. package/docs/0-intro.tsx +53 -0
  122. package/package.json +11 -11
  123. package/report.api.md +1 -1
  124. package/src/__tests__/unit/event-handlers.ts +1 -1
  125. package/src/__tests__/unit/nodeviews/TableContainer.tsx +17 -8
  126. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +2 -0
  127. package/src/plugins/table/commands/misc.ts +84 -7
  128. package/src/plugins/table/event-handlers.ts +11 -16
  129. package/src/plugins/table/index.tsx +6 -0
  130. package/src/plugins/table/nodeviews/TableResizer.tsx +12 -20
  131. package/src/plugins/table/pm-plugins/decorations/utils/column-resizing.ts +34 -7
  132. package/src/plugins/table/pm-plugins/decorations/utils/index.ts +4 -1
  133. package/src/plugins/table/pm-plugins/main.ts +7 -1
  134. package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +5 -0
  135. package/src/plugins/table/pm-plugins/table-resizing/plugin.ts +3 -5
  136. package/src/plugins/table/pm-plugins/table-resizing/utils/scale-table.ts +5 -3
  137. package/src/plugins/table/reducer.ts +51 -3
  138. package/src/plugins/table/types.ts +19 -0
  139. package/src/plugins/table/ui/ColumnResizeWidget/index.tsx +53 -0
  140. package/src/plugins/table/ui/messages.ts +5 -0
  141. package/src/plugins/table/utils/decoration.ts +27 -5
  142. package/tmp/api-report-tmp.d.ts +1 -1
  143. package/tsconfig.app.json +82 -0
  144. package/tsconfig.dev.json +112 -0
@@ -29,6 +29,10 @@ import FloatingInsertButton from './ui/FloatingInsertButton';
29
29
  import LayoutButton from './ui/LayoutButton';
30
30
  import { isLayoutSupported } from './utils';
31
31
  const defaultGetEditorFeatureFlags = () => ({});
32
+ /**
33
+ * Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
34
+ * from `@atlaskit/editor-core`.
35
+ */
32
36
  const tablesPlugin = ({
33
37
  config: options,
34
38
  api
@@ -87,7 +91,8 @@ const tablesPlugin = ({
87
91
  dispatchAnalyticsEvent,
88
92
  dispatch,
89
93
  portalProviderAPI,
90
- eventDispatcher
94
+ eventDispatcher,
95
+ getIntl
91
96
  }) => {
92
97
  const {
93
98
  fullWidthEnabled,
@@ -97,7 +102,7 @@ const tablesPlugin = ({
97
102
  tableOptions,
98
103
  getEditorFeatureFlags
99
104
  } = options || {};
100
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
105
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
101
106
  }
102
107
  }, {
103
108
  name: 'tablePMColResizing',
@@ -1,8 +1,8 @@
1
1
  import React, { useCallback, useMemo, useRef, useState } from 'react';
2
2
  import rafSchd from 'raf-schd';
3
+ import { defineMessages, useIntl } from 'react-intl-next';
3
4
  import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
4
5
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
5
- import { resizerHandleShadowClassName } from '@atlaskit/editor-common/styles';
6
6
  import { findTable } from '@atlaskit/editor-tables/utils';
7
7
  import { getPluginState } from '../pm-plugins/plugin-factory';
8
8
  import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
@@ -11,6 +11,13 @@ import { TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE, TABLE_SNAP_GAP } from '
11
11
  import { generateResizedPayload, generateResizeFrameRatePayloads, useMeasureFramerate } from '../utils/analytics';
12
12
  import { defaultGuidelines } from '../utils/guidelines';
13
13
  import { defaultSnappingWidths, findClosestSnap } from '../utils/snapping';
14
+ const messages = defineMessages({
15
+ resizeTable: {
16
+ id: 'fabric.editor.tables.resizeTable',
17
+ defaultMessage: 'Resize table',
18
+ description: 'Tooltip displayed on custom table width resize hande'
19
+ }
20
+ });
14
21
  const handles = {
15
22
  right: true
16
23
  };
@@ -73,6 +80,9 @@ export const TableResizer = ({
73
80
  var _findTable, _editorView$state;
74
81
  const currentGap = useRef(0);
75
82
  const [snappingEnabled, setSnappingEnabled] = useState(false);
83
+ const {
84
+ formatMessage
85
+ } = useIntl();
76
86
  const resizerMinWidth = getResizerMinWidth(node);
77
87
  const handleHeightSize = getResizerHandleHeight(tableRef);
78
88
  const {
@@ -177,20 +187,6 @@ export const TableResizer = ({
177
187
  scheduleResize.cancel();
178
188
  return newWidth;
179
189
  }, [updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure]);
180
- const handleComponent = useMemo(() => ({
181
- left: /*#__PURE__*/React.createElement("div", {
182
- className: resizerHandleShadowClassName,
183
- style: {
184
- height: 'calc(100% - 24px)'
185
- }
186
- }),
187
- right: /*#__PURE__*/React.createElement("div", {
188
- className: resizerHandleShadowClassName,
189
- style: {
190
- height: 'calc(100% - 24px)'
191
- }
192
- })
193
- }), []);
194
190
  return /*#__PURE__*/React.createElement(ResizerNext, {
195
191
  enable: handles,
196
192
  width: width,
@@ -208,7 +204,8 @@ export const TableResizer = ({
208
204
  handlePositioning: "adjacent",
209
205
  innerPadding: tableHandlePosition,
210
206
  isHandleVisible: ((_findTable = findTable((_editorView$state = editorView.state) === null || _editorView$state === void 0 ? void 0 : _editorView$state.selection)) === null || _findTable === void 0 ? void 0 : _findTable.pos) === getPos(),
211
- handleComponent: handleComponent,
212
- appearance: isInDanger ? 'danger' : undefined
207
+ appearance: isInDanger ? 'danger' : undefined,
208
+ handleHighlight: "shadow",
209
+ handleTooltipContent: formatMessage(messages.resizeTable)
213
210
  }, children);
214
211
  };
@@ -5,18 +5,28 @@ const emptyDecorations = [[], []];
5
5
  const updateColumnResizeHandle = columnResizesDecorations => ({
6
6
  decorationSet,
7
7
  tr
8
- }) => updateDecorations(tr.doc, decorationSet, columnResizesDecorations, TableDecorations.COLUMN_RESIZING_HANDLE);
8
+ }) => updateDecorations(tr.doc, decorationSet, columnResizesDecorations, TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET);
9
9
  const updateLastCellElement = lastCellElementsDecorations => ({
10
10
  decorationSet,
11
11
  tr
12
12
  }) => updateDecorations(tr.doc, decorationSet, lastCellElementsDecorations, TableDecorations.LAST_CELL_ELEMENT);
13
- export const buildColumnResizingDecorations = (rowEndIndex, columnEndIndex) => ({
13
+ export const buildColumnResizingDecorations = (rowEndIndex, columnEndIndex, includeTooltip, getIntl) => ({
14
14
  tr,
15
15
  decorationSet
16
16
  }) => {
17
17
  const [columnResizesDecorations, lastCellElementsDecorations] = columnEndIndex < 0 ? emptyDecorations : createResizeHandleDecoration(tr, rowEndIndex, {
18
18
  right: columnEndIndex
19
+ }, includeTooltip, getIntl);
20
+ return composeDecorations([updateColumnResizeHandle(columnResizesDecorations), updateLastCellElement(lastCellElementsDecorations)])({
21
+ decorationSet,
22
+ tr
19
23
  });
24
+ };
25
+ export const clearColumnResizingDecorations = () => ({
26
+ tr,
27
+ decorationSet
28
+ }) => {
29
+ const [columnResizesDecorations, lastCellElementsDecorations] = emptyDecorations;
20
30
  return composeDecorations([updateColumnResizeHandle(columnResizesDecorations), updateLastCellElement(lastCellElementsDecorations)])({
21
31
  decorationSet,
22
32
  tr
@@ -1,3 +1,3 @@
1
1
  export { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './column-controls';
2
- export { buildColumnResizingDecorations } from './column-resizing';
2
+ export { buildColumnResizingDecorations, clearColumnResizingDecorations } from './column-resizing';
3
3
  export { composeDecorations } from './compose-decorations';
@@ -7,7 +7,7 @@ import { findParentDomRefOfType, findParentNodeOfType } from '@atlaskit/editor-p
7
7
  import { findTable } from '@atlaskit/editor-tables/utils';
8
8
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
9
  import { addBoldInEmptyHeaderCells, clearHoverSelection, setTableRef } from '../commands';
10
- import { transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
10
+ import { removeResizeHandleDecorations, transformSliceRemoveCellBackgroundColor, transformSliceToAddTableHeaders, transformSliceToRemoveColumnsWidths } from '../commands/misc';
11
11
  import { handleBlur, handleClick, handleCut, handleFocus, handleMouseDown, handleMouseLeave, handleMouseMove, handleMouseOut, handleMouseOver, handleTripleClick, whenTableInFocus } from '../event-handlers';
12
12
  import { createTableView } from '../nodeviews/table';
13
13
  import TableCellNodeView from '../nodeviews/tableCell';
@@ -23,7 +23,7 @@ let isBreakoutEnabled;
23
23
  let isFullWidthModeEnabled;
24
24
  let wasFullWidthModeEnabled;
25
25
  let isTableResizingEnabled;
26
- export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) => {
26
+ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthModeEnabled, tableResizingEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) => {
27
27
  var _window;
28
28
  isBreakoutEnabled = breakoutEnabled;
29
29
  isFullWidthModeEnabled = fullWidthModeEnabled;
@@ -36,7 +36,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
36
36
  isFullWidthModeEnabled,
37
37
  isHeaderRowEnabled: !!pluginConfig.allowHeaderRow,
38
38
  isHeaderColumnEnabled: false,
39
- ...defaultTableSelection
39
+ ...defaultTableSelection,
40
+ getIntl
40
41
  });
41
42
  let elementContentRects = {};
42
43
  const observer = (_window = window) !== null && _window !== void 0 && _window.ResizeObserver ? new ResizeObserver(entries => {
@@ -136,6 +137,8 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
136
137
  addBoldInEmptyHeaderCells(tableCellHeader)(state, dispatch);
137
138
  }
138
139
  }
140
+ } else if (pluginState.isResizeHandleWidgetAdded) {
141
+ removeResizeHandleDecorations()(state, dispatch);
139
142
  }
140
143
  },
141
144
  destroy: () => {
@@ -5,6 +5,7 @@ import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
5
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
6
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
7
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
8
+ import { updateResizeHandleDecorations } from '../../commands/misc';
8
9
  import { updateColumnWidths } from '../../transforms';
9
10
  import { getSelectedColumnIndexes, updateResizeHandles } from '../../utils';
10
11
  import { evenColumns, setDragging, stopResizing } from './commands';
@@ -60,6 +61,10 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
60
61
  startX: event.clientX,
61
62
  startWidth: width
62
63
  })(state, dispatch);
64
+
65
+ // When we start resizing a column we need to ensure the underlying tooltip is removed from the decoration to avoid
66
+ // unnecessary tooltips being displayed during drag.
67
+ updateResizeHandleDecorations(undefined, undefined, false)(state, dispatch);
63
68
  function finish(event) {
64
69
  window.removeEventListener('mouseup', finish);
65
70
  window.removeEventListener('mousemove', move);
@@ -7,6 +7,7 @@ import { getLayoutSize } from '../utils/misc';
7
7
  import { reduceSpace } from '../utils/resize-logic';
8
8
  import { adjustColumnsWidths, getResizeState, getTotalWidth, updateColgroup } from '../utils/resize-state';
9
9
  import { hasTableBeenResized, insertColgroupFromNode } from './colgroup';
10
+ import { syncStickyRowToTable } from './dom';
10
11
  // Base function to trigger the actual scale on a table node.
11
12
  // Will only resize/scale if a table has been previously resized.
12
13
  export const scale = (tableRef, options, domAtPos) => {
@@ -117,6 +118,7 @@ export const previewScaleTable = (tableRef, options, domAtPos) => {
117
118
  tableRef.style.width = `${width}px`;
118
119
  }
119
120
  if (!hasTableBeenResized(node)) {
121
+ syncStickyRowToTable(tableRef);
120
122
  return;
121
123
  }
122
124
  const resizeState = parentWidth ? scaleWithParent(tableRef, parentWidth, node, start, domAtPos) : scale(tableRef, options, domAtPos);
@@ -76,12 +76,39 @@ export default ((pluginState, action) => {
76
76
  resizeHandleRowIndex: undefined
77
77
  };
78
78
  case 'ADD_RESIZE_HANDLE_DECORATIONS':
79
- if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex) {
79
+ if (action.data.resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex && action.data.resizeHandleRowIndex === pluginState.resizeHandleRowIndex && action.data.resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip) {
80
80
  return pluginState;
81
81
  }
82
82
  return {
83
83
  ...pluginState,
84
- ...action.data
84
+ ...action.data,
85
+ isResizeHandleWidgetAdded: true
86
+ };
87
+ case 'UPDATE_RESIZE_HANDLE_DECORATIONS':
88
+ const {
89
+ resizeHandleColumnIndex,
90
+ resizeHandleRowIndex,
91
+ resizeHandleIncludeTooltip
92
+ } = action.data;
93
+ if ((resizeHandleColumnIndex === pluginState.resizeHandleColumnIndex || !Number.isFinite(resizeHandleColumnIndex)) && (resizeHandleRowIndex === pluginState.resizeHandleRowIndex || !Number.isFinite(resizeHandleRowIndex)) && (resizeHandleIncludeTooltip === pluginState.resizeHandleIncludeTooltip || resizeHandleIncludeTooltip === undefined)) {
94
+ return pluginState;
95
+ }
96
+ return {
97
+ ...pluginState,
98
+ resizeHandleColumnIndex: resizeHandleColumnIndex !== null && resizeHandleColumnIndex !== void 0 ? resizeHandleColumnIndex : pluginState.resizeHandleColumnIndex,
99
+ resizeHandleRowIndex: resizeHandleRowIndex !== null && resizeHandleRowIndex !== void 0 ? resizeHandleRowIndex : pluginState.resizeHandleRowIndex,
100
+ resizeHandleIncludeTooltip: resizeHandleIncludeTooltip !== null && resizeHandleIncludeTooltip !== void 0 ? resizeHandleIncludeTooltip : pluginState.resizeHandleIncludeTooltip
101
+ };
102
+ case 'REMOVE_RESIZE_HANDLE_DECORATIONS':
103
+ if (!pluginState.isResizeHandleWidgetAdded) {
104
+ return pluginState;
105
+ }
106
+ return {
107
+ ...pluginState,
108
+ ...action.data,
109
+ resizeHandleColumnIndex: undefined,
110
+ resizeHandleRowIndex: undefined,
111
+ isResizeHandleWidgetAdded: false
85
112
  };
86
113
  case 'SET_TABLE_REF':
87
114
  case 'HOVER_ROWS':
@@ -36,6 +36,7 @@ export let TableDecorations = /*#__PURE__*/function (TableDecorations) {
36
36
  TableDecorations["COLUMN_CONTROLS_DECORATIONS"] = "COLUMN_CONTROLS_DECORATIONS";
37
37
  TableDecorations["COLUMN_SELECTED"] = "COLUMN_SELECTED";
38
38
  TableDecorations["COLUMN_RESIZING_HANDLE"] = "COLUMN_RESIZING_HANDLE";
39
+ TableDecorations["COLUMN_RESIZING_HANDLE_WIDGET"] = "COLUMN_RESIZING_HANDLE_WIDGET";
39
40
  TableDecorations["COLUMN_RESIZING_HANDLE_LINE"] = "COLUMN_RESIZING_HANDLE_LINE";
40
41
  TableDecorations["LAST_CELL_ELEMENT"] = "LAST_CELL_ELEMENT";
41
42
  return TableDecorations;
@@ -0,0 +1,35 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ /** @jsx jsx */
3
+ import React from 'react';
4
+ import { jsx } from '@emotion/react';
5
+ import { useIntl } from 'react-intl-next';
6
+ import Tooltip from '@atlaskit/tooltip';
7
+ import { TableCssClassName } from '../../types';
8
+ import messages from '../messages';
9
+ export const ColumnResizeWidget = ({
10
+ startIndex,
11
+ endIndex,
12
+ includeTooltip
13
+ }) => {
14
+ const {
15
+ formatMessage
16
+ } = useIntl();
17
+ if (!includeTooltip) {
18
+ return jsx("div", {
19
+ className: TableCssClassName.RESIZE_HANDLE_DECORATION,
20
+ "data-start-index": startIndex,
21
+ "data-end-index": endIndex
22
+ });
23
+ }
24
+ return jsx(Tooltip, {
25
+ content: formatMessage(messages.adjustColumns),
26
+ hideTooltipOnClick: true,
27
+ hideTooltipOnMouseDown: true,
28
+ position: "mouse",
29
+ mousePosition: "auto-start"
30
+ }, tooltipProps => jsx("div", _extends({
31
+ className: TableCssClassName.RESIZE_HANDLE_DECORATION,
32
+ "data-start-index": startIndex,
33
+ "data-end-index": endIndex
34
+ }, tooltipProps)));
35
+ };
@@ -54,5 +54,10 @@ export default defineMessages({
54
54
  id: 'fabric.editor.extension.sourceNoTitledName',
55
55
  defaultMessage: 'this element',
56
56
  description: 'The current element without preset name been selected'
57
+ },
58
+ adjustColumns: {
59
+ id: 'fabric.editor.tables.adjustColumn',
60
+ defaultMessage: 'Adjust column',
61
+ description: 'Tooltip displayed on table column resize handle'
57
62
  }
58
63
  });
@@ -1,3 +1,6 @@
1
+ import { createElement } from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import { RawIntlProvider } from 'react-intl-next';
1
4
  import { nonNullable } from '@atlaskit/editor-common/utils';
2
5
 
3
6
  // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
@@ -6,6 +9,7 @@ import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
9
  import { Rect, TableMap } from '@atlaskit/editor-tables/table-map';
7
10
  import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
8
11
  import { TableCssClassName as ClassName, TableDecorations } from '../types';
12
+ import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
9
13
  const filterDecorationByKey = (key, decorationSet) => decorationSet.find(undefined, undefined, spec => spec.key.indexOf(key) > -1);
10
14
  export const findColumnControlSelectedDecoration = decorationSet => filterDecorationByKey(TableDecorations.COLUMN_SELECTED, decorationSet);
11
15
  export const findControlsHoverDecoration = decorationSet => filterDecorationByKey(TableDecorations.ALL_CONTROLS_HOVER, decorationSet);
@@ -235,7 +239,7 @@ const makeArray = n => Array.from(Array(n).keys());
235
239
  * we will add a new class on the last item for each cell,
236
240
  * hence the second media will receive this class `ClassName.LAST_ITEM_IN_CELL`
237
241
  */
238
- export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexTarget) => {
242
+ export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexTarget, includeTooltip = false, getIntl) => {
239
243
  const emptyResult = [[], []];
240
244
  const table = findTable(tr.selection);
241
245
  if (!table || !table.node) {
@@ -249,12 +253,19 @@ export const createResizeHandleDecoration = (tr, rowIndexTarget, columnEndIndexT
249
253
  const position = cellPos + cellNode.nodeSize - 1;
250
254
  return Decoration.widget(position, () => {
251
255
  const element = document.createElement('div');
252
- element.classList.add(ClassName.RESIZE_HANDLE_DECORATION);
253
- element.dataset.startIndex = `${cellColumnPositioning.left}`;
254
- element.dataset.endIndex = `${cellColumnPositioning.right}`;
256
+ ReactDOM.render( /*#__PURE__*/createElement(RawIntlProvider, {
257
+ value: getIntl()
258
+ }, /*#__PURE__*/createElement(ColumnResizeWidget, {
259
+ startIndex: cellColumnPositioning.left,
260
+ endIndex: cellColumnPositioning.right,
261
+ includeTooltip
262
+ })), element);
255
263
  return element;
256
264
  }, {
257
- key: `${TableDecorations.COLUMN_RESIZING_HANDLE}_${rowIndex}_${columnIndex}`
265
+ key: `${TableDecorations.COLUMN_RESIZING_HANDLE_WIDGET}_${rowIndex}_${columnIndex}_${includeTooltip ? 'with' : 'no'}-tooltip`,
266
+ destroy: node => {
267
+ ReactDOM.unmountComponentAtNode(node);
268
+ }
258
269
  });
259
270
  };
260
271
  const createLastCellElementDecoration = (cellColumnPositioning, cellPos, cellNode) => {
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  // #region Imports
5
5
 
6
6
  import { closestElement, isParagraph, isTextSelection, mapSlice } from '@atlaskit/editor-common/utils';
@@ -9,7 +9,7 @@ import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
9
9
  import { TableMap } from '@atlaskit/editor-tables/table-map';
10
10
  import { findCellClosestToPos, findTable, getCellsInColumn, getCellsInRow, getSelectionRect, isSelectionType, isTableSelected, removeTable, selectColumn as selectColumnTransform, selectionCell, selectRow as selectRowTransform, setCellAttrs } from '@atlaskit/editor-tables/utils';
11
11
  import { getDecorations } from '../pm-plugins/decorations/plugin';
12
- import { buildColumnResizingDecorations } from '../pm-plugins/decorations/utils';
12
+ import { buildColumnResizingDecorations, clearColumnResizingDecorations } from '../pm-plugins/decorations/utils';
13
13
  import { createCommand, getPluginState } from '../pm-plugins/plugin-factory';
14
14
  import { fixAutoSizedTable } from '../transforms';
15
15
  import { TableCssClassName as ClassName, TableDecorations } from '../types';
@@ -335,23 +335,74 @@ export var hideInsertColumnOrRowButton = function hideInsertColumnOrRowButton()
335
335
  return tr.setMeta('addToHistory', false);
336
336
  });
337
337
  };
338
- export var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex) {
338
+ export var addResizeHandleDecorations = function addResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
339
339
  return createCommand(function (state) {
340
340
  var tableNode = findTable(state.selection);
341
341
  var _getPluginState = getPluginState(state),
342
- allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing;
342
+ allowColumnResizing = _getPluginState.pluginConfig.allowColumnResizing,
343
+ getIntl = _getPluginState.getIntl;
343
344
  if (!tableNode || !allowColumnResizing) {
344
345
  return false;
345
346
  }
346
347
  return {
347
348
  type: 'ADD_RESIZE_HANDLE_DECORATIONS',
348
349
  data: {
349
- decorationSet: buildColumnResizingDecorations(rowIndex, columnIndex)({
350
+ decorationSet: buildColumnResizingDecorations(rowIndex, columnIndex, includeTooltip, getIntl)({
350
351
  tr: state.tr,
351
352
  decorationSet: getDecorations(state)
352
353
  }),
353
354
  resizeHandleRowIndex: rowIndex,
354
- resizeHandleColumnIndex: columnIndex
355
+ resizeHandleColumnIndex: columnIndex,
356
+ resizeHandleIncludeTooltip: includeTooltip
357
+ }
358
+ };
359
+ }, function (tr) {
360
+ return tr.setMeta('addToHistory', false);
361
+ });
362
+ };
363
+ export var updateResizeHandleDecorations = function updateResizeHandleDecorations(rowIndex, columnIndex, includeTooltip) {
364
+ return createCommand(function (state) {
365
+ var tableNode = findTable(state.selection);
366
+ var _getPluginState2 = getPluginState(state),
367
+ resizeHandleRowIndex = _getPluginState2.resizeHandleRowIndex,
368
+ resizeHandleColumnIndex = _getPluginState2.resizeHandleColumnIndex,
369
+ resizeHandleIncludeTooltip = _getPluginState2.resizeHandleIncludeTooltip,
370
+ allowColumnResizing = _getPluginState2.pluginConfig.allowColumnResizing,
371
+ getIntl = _getPluginState2.getIntl;
372
+ if (!tableNode || !allowColumnResizing) {
373
+ return false;
374
+ }
375
+ var resolvedRowIndex = rowIndex !== null && rowIndex !== void 0 ? rowIndex : resizeHandleRowIndex;
376
+ var resolvedColumnIndex = columnIndex !== null && columnIndex !== void 0 ? columnIndex : resizeHandleColumnIndex;
377
+ var resolvedIncludeTooltip = includeTooltip !== null && includeTooltip !== void 0 ? includeTooltip : resizeHandleIncludeTooltip;
378
+ if (resolvedRowIndex === undefined || resolvedColumnIndex === undefined || resolvedIncludeTooltip === undefined) {
379
+ return false;
380
+ }
381
+ return {
382
+ type: 'UPDATE_RESIZE_HANDLE_DECORATIONS',
383
+ data: {
384
+ decorationSet: buildColumnResizingDecorations(resolvedRowIndex, resolvedColumnIndex, resolvedIncludeTooltip, getIntl)({
385
+ tr: state.tr,
386
+ decorationSet: getDecorations(state)
387
+ }),
388
+ resizeHandleRowIndex: rowIndex,
389
+ resizeHandleColumnIndex: columnIndex,
390
+ resizeHandleIncludeTooltip: includeTooltip
391
+ }
392
+ };
393
+ }, function (tr) {
394
+ return tr.setMeta('addToHistory', false);
395
+ });
396
+ };
397
+ export var removeResizeHandleDecorations = function removeResizeHandleDecorations() {
398
+ return createCommand(function (state) {
399
+ return {
400
+ type: 'REMOVE_RESIZE_HANDLE_DECORATIONS',
401
+ data: {
402
+ decorationSet: clearColumnResizingDecorations()({
403
+ tr: state.tr,
404
+ decorationSet: getDecorations(state)
405
+ })
355
406
  }
356
407
  };
357
408
  }, function (tr) {
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  //#region Imports
5
5
 
6
6
  import { findTable, toggleHeader } from '@atlaskit/editor-tables/utils';
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  import { tableBackgroundColorPalette } from '@atlaskit/adf-schema';
5
5
  import { ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION, TABLE_BREAKOUT } from '@atlaskit/editor-common/analytics';
6
6
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  export var pluginConfig = function pluginConfig() {
5
5
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6
6
  return config.advanced ? _objectSpread({
@@ -225,7 +225,7 @@ export var handleMouseMove = function handleMouseMove(view, event, elementConten
225
225
  target: element,
226
226
  columnEndIndexTarget: columnEndIndexTarget
227
227
  })) {
228
- return addResizeHandleDecorations(rowIndexTarget, columnEndIndexTarget)(_state4, _dispatch5);
228
+ return addResizeHandleDecorations(rowIndexTarget, columnEndIndexTarget, true)(_state4, _dispatch5);
229
229
  }
230
230
  }
231
231
  }
@@ -303,11 +303,8 @@ export var handleCut = function handleCut(oldTr, oldState, newState, editorAnaly
303
303
  };
304
304
  export var whenTableInFocus = function whenTableInFocus(eventHandler, elementContentRects) {
305
305
  return function (view, mouseEvent) {
306
- var tableResizePluginState = getResizePluginState(view.state);
307
- var tablePluginState = getPluginState(view.state);
308
- var isDragging = tableResizePluginState && !!tableResizePluginState.dragging;
309
- var hasTableNode = tablePluginState && tablePluginState.tableNode;
310
- if (!hasTableNode || isDragging) {
306
+ var _getPluginState7, _getResizePluginState;
307
+ if (!((_getPluginState7 = getPluginState(view.state)) !== null && _getPluginState7 !== void 0 && _getPluginState7.tableNode) || !!((_getResizePluginState = getResizePluginState(view.state)) !== null && _getResizePluginState !== void 0 && _getResizePluginState.dragging)) {
311
308
  return false;
312
309
  }
313
310
  return eventHandler(view, mouseEvent, elementContentRects);
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  // #region Imports
5
5
  import { TableSortStep } from '@atlaskit/adf-schema/steps';
6
6
  import { isTextInput } from '@atlaskit/editor-common/utils';
@@ -31,6 +31,10 @@ import { isLayoutSupported } from './utils';
31
31
  var defaultGetEditorFeatureFlags = function defaultGetEditorFeatureFlags() {
32
32
  return {};
33
33
  };
34
+ /**
35
+ * Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
36
+ * from `@atlaskit/editor-core`.
37
+ */
34
38
  var tablesPlugin = function tablesPlugin(_ref) {
35
39
  var _api$analytics;
36
40
  var options = _ref.config,
@@ -90,7 +94,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
90
94
  var dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
91
95
  dispatch = _ref2.dispatch,
92
96
  portalProviderAPI = _ref2.portalProviderAPI,
93
- eventDispatcher = _ref2.eventDispatcher;
97
+ eventDispatcher = _ref2.eventDispatcher,
98
+ getIntl = _ref2.getIntl;
94
99
  var _ref3 = options || {},
95
100
  fullWidthEnabled = _ref3.fullWidthEnabled,
96
101
  wasFullWidthEnabled = _ref3.wasFullWidthEnabled,
@@ -98,7 +103,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
98
103
  breakoutEnabled = _ref3.breakoutEnabled,
99
104
  tableOptions = _ref3.tableOptions,
100
105
  getEditorFeatureFlags = _ref3.getEditorFeatureFlags;
101
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
106
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, breakoutEnabled, fullWidthEnabled, tableResizingEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
102
107
  }
103
108
  }, {
104
109
  name: 'tablePMColResizing',
@@ -5,8 +5,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
12
12
  import React from 'react';