@atlaskit/editor-plugin-table 2.1.7 → 2.3.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 (147) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/cjs/plugins/table/handlers.js +1 -0
  3. package/dist/cjs/plugins/table/index.js +41 -35
  4. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +5 -4
  5. package/dist/cjs/plugins/table/nodeviews/TableContainer.js +50 -47
  6. package/dist/cjs/plugins/table/nodeviews/TableResizer.js +72 -28
  7. package/dist/cjs/plugins/table/nodeviews/table.js +12 -5
  8. package/dist/cjs/plugins/table/pm-plugins/decorations/plugin.js +14 -5
  9. package/dist/cjs/plugins/table/pm-plugins/decorations/utils/column-controls.js +2 -0
  10. package/dist/cjs/plugins/table/pm-plugins/main.js +2 -2
  11. package/dist/cjs/plugins/table/pm-plugins/table-resizing/plugin-factory.js +1 -1
  12. package/dist/cjs/plugins/table/pm-plugins/{table-add-width.js → table-width.js} +27 -4
  13. package/dist/cjs/plugins/table/toolbar.js +6 -1
  14. package/dist/cjs/plugins/table/ui/consts.js +6 -2
  15. package/dist/cjs/plugins/table/utils/collapse.js +2 -0
  16. package/dist/cjs/plugins/table/utils/decoration.js +2 -0
  17. package/dist/cjs/plugins/table/utils/guidelines.js +12 -0
  18. package/dist/cjs/plugins/table/utils/snapping.js +37 -0
  19. package/dist/cjs/version.json +1 -1
  20. package/dist/es2019/plugins/table/handlers.js +1 -0
  21. package/dist/es2019/plugins/table/index.js +19 -10
  22. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +5 -4
  23. package/dist/es2019/plugins/table/nodeviews/TableContainer.js +25 -23
  24. package/dist/es2019/plugins/table/nodeviews/TableResizer.js +71 -29
  25. package/dist/es2019/plugins/table/nodeviews/table.js +12 -5
  26. package/dist/es2019/plugins/table/pm-plugins/decorations/plugin.js +18 -6
  27. package/dist/es2019/plugins/table/pm-plugins/decorations/utils/column-controls.js +2 -0
  28. package/dist/es2019/plugins/table/pm-plugins/main.js +2 -2
  29. package/dist/es2019/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -0
  30. package/dist/es2019/plugins/table/pm-plugins/{table-add-width.js → table-width.js} +25 -3
  31. package/dist/es2019/plugins/table/toolbar.js +6 -1
  32. package/dist/es2019/plugins/table/ui/consts.js +3 -1
  33. package/dist/es2019/plugins/table/utils/collapse.js +2 -0
  34. package/dist/es2019/plugins/table/utils/decoration.js +2 -0
  35. package/dist/es2019/plugins/table/utils/guidelines.js +4 -0
  36. package/dist/es2019/plugins/table/utils/snapping.js +27 -0
  37. package/dist/es2019/version.json +1 -1
  38. package/dist/esm/plugins/table/handlers.js +1 -0
  39. package/dist/esm/plugins/table/index.js +41 -35
  40. package/dist/esm/plugins/table/nodeviews/TableComponent.js +5 -4
  41. package/dist/esm/plugins/table/nodeviews/TableContainer.js +50 -47
  42. package/dist/esm/plugins/table/nodeviews/TableResizer.js +69 -28
  43. package/dist/esm/plugins/table/nodeviews/table.js +12 -5
  44. package/dist/esm/plugins/table/pm-plugins/decorations/plugin.js +18 -6
  45. package/dist/esm/plugins/table/pm-plugins/decorations/utils/column-controls.js +2 -0
  46. package/dist/esm/plugins/table/pm-plugins/main.js +2 -2
  47. package/dist/esm/plugins/table/pm-plugins/table-resizing/plugin-factory.js +2 -0
  48. package/dist/esm/plugins/table/pm-plugins/{table-add-width.js → table-width.js} +25 -3
  49. package/dist/esm/plugins/table/toolbar.js +6 -1
  50. package/dist/esm/plugins/table/ui/consts.js +3 -1
  51. package/dist/esm/plugins/table/utils/collapse.js +2 -0
  52. package/dist/esm/plugins/table/utils/decoration.js +2 -0
  53. package/dist/esm/plugins/table/utils/guidelines.js +4 -0
  54. package/dist/esm/plugins/table/utils/snapping.js +30 -0
  55. package/dist/esm/version.json +1 -1
  56. package/dist/types/plugins/table/index.d.ts +3 -1
  57. package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +3 -2
  58. package/dist/types/plugins/table/nodeviews/TableContainer.d.ts +5 -2
  59. package/dist/types/plugins/table/nodeviews/TableResizer.d.ts +3 -1
  60. package/dist/types/plugins/table/nodeviews/table.d.ts +2 -1
  61. package/dist/types/plugins/table/nodeviews/types.d.ts +2 -0
  62. package/dist/types/plugins/table/pm-plugins/decorations/plugin.d.ts +1 -1
  63. package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
  64. package/dist/types/plugins/table/pm-plugins/table-width.d.ts +16 -0
  65. package/dist/types/plugins/table/types.d.ts +3 -0
  66. package/dist/types/plugins/table/ui/consts.d.ts +2 -0
  67. package/dist/types/plugins/table/utils/guidelines.d.ts +3 -0
  68. package/dist/types/plugins/table/utils/snapping.d.ts +8 -0
  69. package/dist/types-ts4.5/plugins/table/index.d.ts +3 -1
  70. package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +3 -2
  71. package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +5 -2
  72. package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +3 -1
  73. package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +2 -1
  74. package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +2 -0
  75. package/dist/types-ts4.5/plugins/table/pm-plugins/decorations/plugin.d.ts +1 -1
  76. package/dist/types-ts4.5/plugins/table/pm-plugins/main.d.ts +2 -1
  77. package/dist/types-ts4.5/plugins/table/pm-plugins/table-width.d.ts +16 -0
  78. package/dist/types-ts4.5/plugins/table/types.d.ts +3 -0
  79. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +2 -0
  80. package/dist/types-ts4.5/plugins/table/utils/guidelines.d.ts +3 -0
  81. package/dist/types-ts4.5/plugins/table/utils/snapping.d.ts +8 -0
  82. package/package.json +4 -3
  83. package/report.api.md +2 -0
  84. package/src/__tests__/unit/analytics.ts +2 -0
  85. package/src/__tests__/unit/collab.ts +2 -0
  86. package/src/__tests__/unit/commands/go-to-next-cell.ts +2 -0
  87. package/src/__tests__/unit/commands/insert.ts +2 -0
  88. package/src/__tests__/unit/commands/misc.ts +2 -0
  89. package/src/__tests__/unit/commands/sort.ts +4 -0
  90. package/src/__tests__/unit/commands.ts +2 -0
  91. package/src/__tests__/unit/copy-paste.ts +2 -0
  92. package/src/__tests__/unit/event-handlers/index.ts +3 -0
  93. package/src/__tests__/unit/event-handlers.ts +3 -0
  94. package/src/__tests__/unit/fix-tables.ts +2 -0
  95. package/src/__tests__/unit/get-toolbar-config.ts +2 -0
  96. package/src/__tests__/unit/handlers.ts +2 -0
  97. package/src/__tests__/unit/hover-selection.ts +2 -0
  98. package/src/__tests__/unit/index.ts +2 -0
  99. package/src/__tests__/unit/layout.ts +2 -0
  100. package/src/__tests__/unit/nodeviews/cell.ts +2 -0
  101. package/src/__tests__/unit/nodeviews/table.ts +2 -0
  102. package/src/__tests__/unit/pm-plugins/decorations/column-resizing.ts +2 -0
  103. package/src/__tests__/unit/pm-plugins/decorations/plugin.ts +68 -0
  104. package/src/__tests__/unit/pm-plugins/main.ts +2 -0
  105. package/src/__tests__/unit/pm-plugins/safari-delete-composition-text-issue-workaround.ts +2 -0
  106. package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +3 -0
  107. package/src/__tests__/unit/pm-plugins/table-resizing/event-handlers.ts +2 -0
  108. package/src/__tests__/unit/sort-column.ts +2 -0
  109. package/src/__tests__/unit/toolbar.ts +2 -0
  110. package/src/__tests__/unit/transforms/delete-columns.ts +2 -0
  111. package/src/__tests__/unit/transforms/delete-rows.ts +2 -0
  112. package/src/__tests__/unit/transforms/merging.ts +2 -0
  113. package/src/__tests__/unit/ui/ContextualMenu.tsx +2 -0
  114. package/src/__tests__/unit/ui/CornerControls.tsx +2 -0
  115. package/src/__tests__/unit/ui/FloatingContextualButton.tsx +2 -0
  116. package/src/__tests__/unit/ui/FloatingContextualMenu.tsx +2 -0
  117. package/src/__tests__/unit/ui/RowControls.tsx +2 -0
  118. package/src/__tests__/unit/ui/TableFloatingControls.tsx +2 -0
  119. package/src/__tests__/unit/undo-redo.ts +2 -0
  120. package/src/__tests__/unit/utils/collapse.ts +2 -0
  121. package/src/__tests__/unit/utils/nodes.ts +2 -0
  122. package/src/__tests__/unit/utils/row-controls.ts +2 -0
  123. package/src/__tests__/unit/utils.ts +2 -0
  124. package/src/plugins/table/handlers.ts +1 -0
  125. package/src/plugins/table/index.tsx +38 -23
  126. package/src/plugins/table/nodeviews/TableComponent.tsx +6 -5
  127. package/src/plugins/table/nodeviews/TableContainer.tsx +31 -22
  128. package/src/plugins/table/nodeviews/TableResizer.tsx +107 -34
  129. package/src/plugins/table/nodeviews/table.tsx +16 -2
  130. package/src/plugins/table/nodeviews/types.ts +2 -0
  131. package/src/plugins/table/pm-plugins/decorations/plugin.ts +27 -4
  132. package/src/plugins/table/pm-plugins/decorations/utils/column-controls.ts +1 -0
  133. package/src/plugins/table/pm-plugins/decorations/utils/types.ts +1 -0
  134. package/src/plugins/table/pm-plugins/main.ts +3 -0
  135. package/src/plugins/table/pm-plugins/table-resizing/plugin-factory.ts +1 -0
  136. package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +1 -0
  137. package/src/plugins/table/pm-plugins/{table-add-width.ts → table-width.ts} +33 -3
  138. package/src/plugins/table/toolbar.tsx +7 -1
  139. package/src/plugins/table/types.ts +4 -0
  140. package/src/plugins/table/ui/consts.ts +3 -0
  141. package/src/plugins/table/utils/collapse.ts +1 -0
  142. package/src/plugins/table/utils/decoration.ts +1 -0
  143. package/src/plugins/table/utils/guidelines.ts +17 -0
  144. package/src/plugins/table/utils/snapping.ts +38 -0
  145. package/tmp/api-report-tmp.d.ts +3 -1
  146. package/dist/types/plugins/table/pm-plugins/table-add-width.d.ts +0 -7
  147. package/dist/types-ts4.5/plugins/table/pm-plugins/table-add-width.d.ts +0 -7
@@ -31,7 +31,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
31
31
  var isBreakoutEnabled;
32
32
  var isFullWidthModeEnabled;
33
33
  var wasFullWidthModeEnabled;
34
- var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, breakoutEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI) {
34
+ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, breakoutEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi) {
35
35
  var _window;
36
36
  isBreakoutEnabled = breakoutEnabled;
37
37
  isFullWidthModeEnabled = fullWidthModeEnabled;
@@ -236,7 +236,7 @@ var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, porta
236
236
  isBreakoutEnabled: isBreakoutEnabled,
237
237
  isFullWidthModeEnabled: isFullWidthModeEnabled,
238
238
  wasFullWidthModeEnabled: wasFullWidthModeEnabled
239
- }, getEditorContainerWidth, getEditorFeatureFlags);
239
+ }, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi);
240
240
  }
241
241
  }),
242
242
  handleDOMEvents: {
@@ -10,7 +10,7 @@ var _utils = require("@atlaskit/editor-common/utils");
10
10
  var _pluginKey = require("./plugin-key");
11
11
  var _reducer = _interopRequireDefault(require("./reducer"));
12
12
  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; }
13
- 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) { (0, _defineProperty2.default)(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; }
13
+ 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) { (0, _defineProperty2.default)(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; } // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
14
14
  function mapping(tr, pluginState) {
15
15
  if (pluginState && pluginState.resizeHandlePos !== null) {
16
16
  return _objectSpread(_objectSpread({}, pluginState), {}, {
@@ -4,22 +4,45 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.createPlugin = void 0;
7
+ exports.pluginKey = exports.createPlugin = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _steps = require("@atlaskit/adf-schema/steps");
13
13
  var _prosemirrorTransform = require("prosemirror-transform");
14
+ var _prosemirrorState = require("prosemirror-state");
14
15
  var _excluded = ["width"];
15
16
  /**
16
- * A plugin for scan the document, add width value to table's width attribute when necessary
17
- *
17
+ * A plugin for handle table custom widths
18
+ * Has login to scan the document, add width value to table's width attribute when necessary
19
+ * Also holds resizing state to hide / show table controls
18
20
  */
19
21
  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; }
20
22
  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) { (0, _defineProperty2.default)(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; }
21
- var createPlugin = function createPlugin(fullWidthEnabled) {
23
+ var pluginKey = new _prosemirrorState.PluginKey('tableWidthPlugin');
24
+ exports.pluginKey = pluginKey;
25
+ var createPlugin = function createPlugin(dispatch, fullWidthEnabled) {
22
26
  return new _safePlugin.SafePlugin({
27
+ key: pluginKey,
28
+ state: {
29
+ init: function init() {
30
+ return {
31
+ resizing: false
32
+ };
33
+ },
34
+ apply: function apply(tr, pluginState) {
35
+ var meta = tr.getMeta(pluginKey);
36
+ if (meta && meta.resizing !== pluginState.resizing) {
37
+ var newState = {
38
+ resizing: meta.resizing
39
+ };
40
+ dispatch(pluginKey, newState);
41
+ return newState;
42
+ }
43
+ return pluginState;
44
+ }
45
+ },
23
46
  appendTransaction: function appendTransaction(transactions, _oldState, newState) {
24
47
  // When document first load in Confluence, initially it is an empty document
25
48
  // and Collab service triggers a transaction to replace the empty document with the real document that should be rendered.
@@ -13,6 +13,7 @@ var _commands = require("./commands");
13
13
  var _commandsWithAnalytics = require("./commands-with-analytics");
14
14
  var _pluginFactory = require("./pm-plugins/plugin-factory");
15
15
  var _tableResizing = require("./pm-plugins/table-resizing");
16
+ var _tableWidth = require("./pm-plugins/table-width");
16
17
  var _types = require("./types");
17
18
  var _utils = require("./utils");
18
19
  var _utils2 = require("@atlaskit/editor-common/utils");
@@ -302,7 +303,11 @@ var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth, editor
302
303
  var tableObject = (0, _utils3.findTable)(state.selection);
303
304
  var pluginState = (0, _pluginFactory.getPluginState)(state);
304
305
  var resizeState = _tableResizing.pluginKey.getState(state);
305
- if (tableObject && pluginState.editorHasFocus) {
306
+ var tableWidthState = _tableWidth.pluginKey.getState(state);
307
+
308
+ // We don't want to show floating toolbar while resizing the table
309
+ var isWidthResizing = tableWidthState === null || tableWidthState === void 0 ? void 0 : tableWidthState.resizing;
310
+ if (tableObject && pluginState.editorHasFocus && !isWidthResizing) {
306
311
  var nodeType = state.schema.nodes.table;
307
312
  var menu = getToolbarMenuConfig(config, pluginState, intl, editorAnalyticsAPI);
308
313
  var _ref3 = getEditorFeatureFlags() || {},
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.tableToolbarSize = exports.tableToolbarSelectedColor = exports.tableToolbarDeleteColor = exports.tableToolbarColor = exports.tableTextColor = exports.tableScrollbarOffset = exports.tablePadding = exports.tableMarginFullWidthMode = exports.tableInsertColumnButtonSize = exports.tableInsertColumnButtonOffset = exports.tableHeaderCellBackgroundColor = exports.tableFloatingControlsColor = exports.tableDeleteButtonSize = exports.tableDeleteButtonOffset = exports.tableControlsSpacing = exports.tableCellSelectedColor = exports.tableCellDeleteColor = exports.tableCellBackgroundColor = exports.tableBorderSelectedColor = exports.tableBorderRadiusSize = exports.tableBorderDeleteColor = exports.tableBorderColor = exports.stickyRowZIndex = exports.stickyRowOffsetTop = exports.stickyHeaderBorderBottomWidth = exports.resizeLineWidth = exports.resizeHandlerZIndex = exports.resizeHandlerAreaWidth = exports.lineMarkerSize = exports.lineMarkerOffsetFromColumnControls = exports.layoutButtonSize = exports.contextualMenuTriggerSize = exports.contextualMenuDropdownWidth = exports.columnResizeHandleZIndex = exports.columnControlsZIndex = exports.columnControlsSelectedZIndex = exports.columnControlsDecorationHeight = void 0;
6
+ exports.tableToolbarSize = exports.tableToolbarSelectedColor = exports.tableToolbarDeleteColor = exports.tableToolbarColor = exports.tableTextColor = exports.tableScrollbarOffset = exports.tablePadding = exports.tableMarginFullWidthMode = exports.tableInsertColumnButtonSize = exports.tableInsertColumnButtonOffset = exports.tableHeaderCellBackgroundColor = exports.tableFloatingControlsColor = exports.tableDeleteButtonSize = exports.tableDeleteButtonOffset = exports.tableControlsSpacing = exports.tableCellSelectedColor = exports.tableCellDeleteColor = exports.tableCellBackgroundColor = exports.tableBorderSelectedColor = exports.tableBorderRadiusSize = exports.tableBorderDeleteColor = exports.tableBorderColor = exports.stickyRowZIndex = exports.stickyRowOffsetTop = exports.stickyHeaderBorderBottomWidth = exports.resizeLineWidth = exports.resizeHandlerZIndex = exports.resizeHandlerAreaWidth = exports.lineMarkerSize = exports.lineMarkerOffsetFromColumnControls = exports.layoutButtonSize = exports.contextualMenuTriggerSize = exports.contextualMenuDropdownWidth = exports.columnResizeHandleZIndex = exports.columnControlsZIndex = exports.columnControlsSelectedZIndex = exports.columnControlsDecorationHeight = exports.TABLE_SNAP_GAP = exports.TABLE_HIGHLIGHT_GAP = void 0;
7
7
  var _colors = require("@atlaskit/theme/colors");
8
8
  var _styles = require("@atlaskit/editor-common/styles");
9
9
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
@@ -104,4 +104,8 @@ exports.stickyRowZIndex = stickyRowZIndex;
104
104
  var stickyRowOffsetTop = 8;
105
105
  exports.stickyRowOffsetTop = stickyRowOffsetTop;
106
106
  var stickyHeaderBorderBottomWidth = 1;
107
- exports.stickyHeaderBorderBottomWidth = stickyHeaderBorderBottomWidth;
107
+ exports.stickyHeaderBorderBottomWidth = stickyHeaderBorderBottomWidth;
108
+ var TABLE_SNAP_GAP = 5;
109
+ exports.TABLE_SNAP_GAP = TABLE_SNAP_GAP;
110
+ var TABLE_HIGHLIGHT_GAP = 10;
111
+ exports.TABLE_HIGHLIGHT_GAP = TABLE_HIGHLIGHT_GAP;
@@ -7,6 +7,8 @@ exports.isTableCollapsible = exports.collapseSelectedTable = void 0;
7
7
  var _prosemirrorModel = require("prosemirror-model");
8
8
  var _prosemirrorTransform = require("prosemirror-transform");
9
9
  var _utils = require("@atlaskit/editor-tables/utils");
10
+ // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
11
+
10
12
  var bail = function bail() {
11
13
  return {
12
14
  tableIsCollapsible: false
@@ -11,6 +11,8 @@ var _utils = require("@atlaskit/editor-tables/utils");
11
11
  var _prosemirrorView = require("prosemirror-view");
12
12
  var _utils2 = require("@atlaskit/editor-common/utils");
13
13
  var _types = require("../types");
14
+ // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
15
+
14
16
  var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
15
17
  return decorationSet.find(undefined, undefined, function (spec) {
16
18
  return spec.key.indexOf(key) > -1;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.defaultGuidelines = exports.defaultGuidelineWidths = void 0;
7
+ var _guideline = require("@atlaskit/editor-common/guideline");
8
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
9
+ var defaultGuidelineWidths = [_editorSharedStyles.akEditorDefaultLayoutWidth, _editorSharedStyles.akEditorWideLayoutWidth, _editorSharedStyles.akEditorFullWidthLayoutWidth];
10
+ exports.defaultGuidelineWidths = defaultGuidelineWidths;
11
+ var defaultGuidelines = (0, _guideline.createFixedGuidelinesFromLengths)(defaultGuidelineWidths);
12
+ exports.defaultGuidelines = defaultGuidelines;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.findClosestSnap = void 0;
7
+ /**
8
+ * Returns keys of guidelines that are closest to the table and withthin the snapGap
9
+ */
10
+ var findClosestSnap = function findClosestSnap(currentWidth, snapWidths, guidelines) {
11
+ var snapGap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
12
+ var closestGapIndex = snapWidths.reduce(function (prev, curr, index) {
13
+ return Math.abs(curr - currentWidth) < Math.abs(snapWidths[prev] - currentWidth) ? index : prev;
14
+ }, 0);
15
+ var gap = Math.abs(snapWidths[closestGapIndex] - currentWidth);
16
+ if (gap < snapGap) {
17
+ var snappingWidth = Math.round(snapWidths[closestGapIndex]);
18
+ var guidelineKeys = guidelines.reduce(function (acc, guideline) {
19
+ // NOTE: The snap points are based on the guidelines, however their formatted as a length value whereas the guidelines
20
+ // are point based. The point base x coords are calculated by halving the lengths. This means we can convert the
21
+ // point base position to length by simply multiplying by 2.
22
+ if (Math.round(Math.abs(guideline.position.x) * 2) === snappingWidth) {
23
+ acc.push(guideline.key);
24
+ }
25
+ return acc;
26
+ }, []);
27
+ return {
28
+ gap: gap,
29
+ keys: guidelineKeys
30
+ };
31
+ }
32
+ return {
33
+ gap: gap,
34
+ keys: []
35
+ };
36
+ };
37
+ exports.findClosestSnap = findClosestSnap;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.1.7",
3
+ "version": "2.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,5 @@
1
1
  // #region Imports
2
+ // @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
2
3
 
3
4
  import { findParentNodeOfType } from 'prosemirror-utils';
4
5
  import { findTable } from '@atlaskit/editor-tables/utils';
@@ -11,7 +11,7 @@ import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/
11
11
  import { IconTable } from '@atlaskit/editor-common/icons';
12
12
  import { pluginConfig } from './create-plugin-config';
13
13
  import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
14
- import { createPlugin as createTableAddWidthPlugin } from './pm-plugins/table-add-width';
14
+ import { pluginKey as tableWidthPluginKey, createPlugin as createTableWidthPlugin } from './pm-plugins/table-width';
15
15
  import { createPlugin as createTableSafariDeleteCompositionTextIssueWorkaroundPlugin } from './pm-plugins/safari-delete-composition-text-issue-workaround';
16
16
  import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
17
17
  import { keymapPlugin } from './pm-plugins/keymap';
@@ -94,7 +94,7 @@ const tablesPlugin = (options, api) => {
94
94
  tableOptions,
95
95
  getEditorFeatureFlags
96
96
  } = options || {};
97
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI);
97
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, breakoutEnabled, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api);
98
98
  }
99
99
  }, {
100
100
  name: 'tablePMColResizing',
@@ -155,8 +155,13 @@ const tablesPlugin = (options, api) => {
155
155
  dispatch
156
156
  }) => createTableLocalIdPlugin(dispatch)
157
157
  }, {
158
- name: 'tableAddWidth',
159
- plugin: () => getBooleanFF('platform.editor.custom-table-width') && options ? createTableAddWidthPlugin(options.fullWidthEnabled || false) : undefined
158
+ name: 'tableWidth',
159
+ plugin: ({
160
+ dispatch
161
+ }) => {
162
+ var _options$fullWidthEna;
163
+ return getBooleanFF('platform.editor.custom-table-width') ? createTableWidthPlugin(dispatch, (_options$fullWidthEna = options === null || options === void 0 ? void 0 : options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false) : undefined;
164
+ }
160
165
  }, {
161
166
  name: 'tableGetEditorViewReferencePlugin',
162
167
  plugin: () => {
@@ -199,18 +204,22 @@ const tablesPlugin = (options, api) => {
199
204
  }, /*#__PURE__*/React.createElement(WithPluginState, {
200
205
  plugins: {
201
206
  tablePluginState: pluginKey,
207
+ tableWidthPluginState: tableWidthPluginKey,
202
208
  tableResizingPluginState: tableResizingPluginKey,
203
209
  stickyHeadersState: stickyHeadersPluginKey
204
210
  },
205
211
  render: ({
206
212
  tableResizingPluginState: resizingPluginState,
207
213
  stickyHeadersState,
208
- tablePluginState
214
+ tablePluginState,
215
+ tableWidthPluginState
209
216
  }) => {
210
217
  const {
211
218
  state
212
219
  } = editorView;
213
- const isDragging = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
220
+ const isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
221
+ const isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
222
+ const isResizing = isColumnResizing || isTableResizing;
214
223
  const {
215
224
  tableNode,
216
225
  tablePos,
@@ -240,7 +249,7 @@ const tablesPlugin = (options, api) => {
240
249
  stickyHeader: stickyHeader,
241
250
  editorAnalyticsAPI: editorAnalyticsAPI
242
251
  }) : null;
243
- return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isDragging && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
252
+ return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && tableRef && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
244
253
  isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
245
254
  editorView: editorView,
246
255
  tableNode: tableNode,
@@ -267,17 +276,17 @@ const tablesPlugin = (options, api) => {
267
276
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
268
277
  editorAnalyticsAPI: editorAnalyticsAPI,
269
278
  getEditorContainerWidth: defaultGetEditorContainerWidth
270
- }), /*#__PURE__*/React.createElement(FloatingContextualMenu, {
279
+ }), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/React.createElement(FloatingContextualMenu, {
271
280
  editorView: editorView,
272
281
  mountPoint: popupsMountPoint,
273
282
  boundariesElement: popupsBoundariesElement,
274
283
  targetCellPosition: targetCellPosition,
275
- isOpen: Boolean(isContextualMenuOpen),
284
+ isOpen: Boolean(isContextualMenuOpen) && !isResizing,
276
285
  pluginConfig: pluginConfig,
277
286
  editorAnalyticsAPI: editorAnalyticsAPI,
278
287
  getEditorContainerWidth: defaultGetEditorContainerWidth,
279
288
  getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags
280
- }), allowControls && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
289
+ }), allowControls && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
281
290
  editorView: editorView,
282
291
  selection: editorView.state.selection,
283
292
  tableRef: tableRef,
@@ -376,7 +376,7 @@ class TableComponent extends React.Component {
376
376
  const {
377
377
  view,
378
378
  getNode,
379
- tableResizingPluginState,
379
+ isResizing,
380
380
  allowControls = true,
381
381
  isHeaderRowEnabled,
382
382
  ordering,
@@ -384,7 +384,8 @@ class TableComponent extends React.Component {
384
384
  tableActive,
385
385
  containerWidth,
386
386
  options,
387
- getPos
387
+ getPos,
388
+ pluginInjectionApi
388
389
  } = this.props;
389
390
  const {
390
391
  isLoading,
@@ -404,7 +405,6 @@ class TableComponent extends React.Component {
404
405
  tableOverflowShadowsOptimization
405
406
  } = this.props.getEditorFeatureFlags();
406
407
  const tableRef = this.table || undefined;
407
- const isResizing = !!tableResizingPluginState && !!tableResizingPluginState.dragging;
408
408
  const headerRow = tableRef ? tableRef.querySelector('tr[data-header-row]') : undefined;
409
409
 
410
410
  //dont need to change tableHeight with tableRenderOptimization because it will be observed inside floating components
@@ -452,7 +452,8 @@ class TableComponent extends React.Component {
452
452
  containerWidth: containerWidth,
453
453
  isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.isFullWidthModeEnabled,
454
454
  isBreakoutEnabled: options === null || options === void 0 ? void 0 : options.isBreakoutEnabled,
455
- isNested: isNested
455
+ isNested: isNested,
456
+ pluginInjectionApi: pluginInjectionApi
456
457
  }, stickyHeadersOptimization && /*#__PURE__*/React.createElement("div", {
457
458
  className: ClassName.TABLE_STICKY_SENTINEL_TOP,
458
459
  "data-testid": "sticky-sentinel-top"
@@ -5,10 +5,7 @@ import { calcTableWidth } from '@atlaskit/editor-common/styles';
5
5
  import { TableCssClassName as ClassName } from '../types';
6
6
  import { TableResizer } from './TableResizer';
7
7
  import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
8
- const getMarginLeft = ({
9
- lineLength,
10
- tableWidth
11
- }) => {
8
+ const getMarginLeft = (lineLength, tableWidth) => {
12
9
  let marginLeft;
13
10
  if (tableWidth !== 'inherit' && lineLength) {
14
11
  const containerWidth = tableWidth;
@@ -41,35 +38,40 @@ export const ResizableTableContainer = ({
41
38
  containerWidth,
42
39
  editorView,
43
40
  getPos,
44
- tableRef
41
+ tableRef,
42
+ pluginInjectionApi
45
43
  }) => {
46
44
  const containerRef = useRef(null);
47
45
  const innerContainerRef = useRef(null);
46
+ const marginLeftRef = useRef(0);
48
47
  const updateWidth = useCallback(width => {
49
48
  if (!containerRef.current || !innerContainerRef.current) {
50
49
  return;
51
50
  }
52
- const marginLeft = getMarginLeft({
53
- lineLength,
54
- tableWidth: width
55
- });
56
- if (marginLeft) {
57
- containerRef.current.style.marginLeft = `${marginLeft}px`;
51
+ const marginLeft = getMarginLeft(lineLength, width);
52
+ if (marginLeftRef.current !== marginLeft) {
53
+ marginLeftRef.current = marginLeft;
54
+ if (Number.isFinite(marginLeft)) {
55
+ containerRef.current.style.marginLeft = `${marginLeft}px`;
56
+ }
58
57
  }
59
58
  }, [lineLength]);
59
+ const displayGuideline = useCallback(guidelines => {
60
+ var _pluginInjectionApi$d, _pluginInjectionApi$d2, _pluginInjectionApi$d3, _pluginInjectionApi$d4;
61
+ return (_pluginInjectionApi$d = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$d2 = pluginInjectionApi.dependencies) === null || _pluginInjectionApi$d2 === void 0 ? void 0 : (_pluginInjectionApi$d3 = _pluginInjectionApi$d2.guideline) === null || _pluginInjectionApi$d3 === void 0 ? void 0 : (_pluginInjectionApi$d4 = _pluginInjectionApi$d3.actions) === null || _pluginInjectionApi$d4 === void 0 ? void 0 : _pluginInjectionApi$d4.displayGuideline(editorView)({
62
+ guidelines
63
+ })) !== null && _pluginInjectionApi$d !== void 0 ? _pluginInjectionApi$d : false;
64
+ }, [pluginInjectionApi, editorView]);
60
65
  const tableWidth = getTableContainerWidth(node);
61
66
 
62
67
  // 76 is currently an accepted padding value considering the spacing for resizer handle
63
68
  const responsiveContainerWidth = containerWidth - 76;
64
69
  const width = Math.min(tableWidth, responsiveContainerWidth);
65
- const marginLeft = getMarginLeft({
66
- lineLength,
67
- tableWidth: width
68
- });
70
+ marginLeftRef.current = getMarginLeft(lineLength, width);
69
71
  const maxResizerWidth = Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
70
72
  return /*#__PURE__*/React.createElement("div", {
71
73
  style: {
72
- marginLeft,
74
+ marginLeft: marginLeftRef.current,
73
75
  width
74
76
  },
75
77
  className: ClassName.TABLE_RESIZER_CONTAINER,
@@ -81,7 +83,8 @@ export const ResizableTableContainer = ({
81
83
  editorView: editorView,
82
84
  getPos: getPos,
83
85
  node: node,
84
- tableRef: tableRef
86
+ tableRef: tableRef,
87
+ displayGuideline: displayGuideline
85
88
  }, /*#__PURE__*/React.createElement(InnerContainer, {
86
89
  ref: innerContainerRef,
87
90
  className: className,
@@ -101,7 +104,8 @@ export const TableContainer = ({
101
104
  editorView,
102
105
  getPos,
103
106
  tableRef,
104
- isNested
107
+ isNested,
108
+ pluginInjectionApi
105
109
  }) => {
106
110
  if ((isFullWidthModeEnabled || isBreakoutEnabled) && getBooleanFF('platform.editor.custom-table-width') && !isNested) {
107
111
  return /*#__PURE__*/React.createElement(ResizableTableContainer, {
@@ -111,7 +115,8 @@ export const TableContainer = ({
111
115
  containerWidth: editorWidth,
112
116
  editorView: editorView,
113
117
  getPos: getPos,
114
- tableRef: tableRef
118
+ tableRef: tableRef,
119
+ pluginInjectionApi: pluginInjectionApi
115
120
  }, children);
116
121
  }
117
122
  const tableWidth = isBreakoutEnabled ? calcTableWidth(node.attrs.layout, editorWidth) : 'inherit';
@@ -120,10 +125,7 @@ export const TableContainer = ({
120
125
  className: className,
121
126
  style: {
122
127
  width: tableWidth,
123
- marginLeft: getMarginLeft({
124
- lineLength: lineLength,
125
- tableWidth
126
- })
128
+ marginLeft: getMarginLeft(lineLength, tableWidth)
127
129
  }
128
130
  }, children);
129
131
  };
@@ -1,7 +1,12 @@
1
- import React from 'react';
1
+ import React, { useCallback, useRef, useMemo, useState } from 'react';
2
2
  import rafSchd from 'raf-schd';
3
3
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
4
+ import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
4
5
  import { scaleTable, previewScaleTable, getColgroupChildrenLength, COLUMN_MIN_WIDTH } from '../pm-plugins/table-resizing/utils';
6
+ import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
7
+ import { defaultGuidelines, defaultGuidelineWidths } from '../utils/guidelines';
8
+ import { findClosestSnap } from '../utils/snapping';
9
+ import { TABLE_SNAP_GAP, TABLE_HIGHLIGHT_GAP } from '../ui/consts';
5
10
  const handles = {
6
11
  right: true
7
12
  };
@@ -14,7 +19,8 @@ export const TableResizer = ({
14
19
  editorView,
15
20
  getPos,
16
21
  node,
17
- tableRef
22
+ tableRef,
23
+ displayGuideline
18
24
  }) => {
19
25
  const currentColumnCount = getColgroupChildrenLength(node);
20
26
  const minColumnWidth = currentColumnCount <= 3 ? currentColumnCount * COLUMN_MIN_WIDTH : 3 * COLUMN_MIN_WIDTH;
@@ -33,13 +39,70 @@ export const TableResizer = ({
33
39
  } else if (tableHeight && tableHeight >= 96) {
34
40
  handleHeightSize = 'large';
35
41
  }
42
+ const currentGap = useRef(0);
43
+ const [snappingEnabled, setSnappingEnabled] = useState(false);
44
+ const updateActiveGuidelines = useCallback(({
45
+ gap,
46
+ keys
47
+ }) => {
48
+ if (gap !== currentGap.current) {
49
+ currentGap.current = gap;
50
+ displayGuideline(getGuidelinesWithHighlights(gap, TABLE_SNAP_GAP, keys, defaultGuidelines));
51
+ }
52
+ }, [displayGuideline]);
53
+ const guidelineSnaps = useMemo(() => snappingEnabled ? {
54
+ x: defaultGuidelineWidths
55
+ } : undefined, [snappingEnabled]);
56
+ const handleResizeStart = useCallback(() => {
57
+ const {
58
+ dispatch,
59
+ state: {
60
+ tr
61
+ }
62
+ } = editorView;
63
+ dispatch(tr.setMeta(tableWidthPluginKey, {
64
+ resizing: true
65
+ }));
66
+ setSnappingEnabled(displayGuideline(defaultGuidelines));
67
+ return width;
68
+ }, [width, displayGuideline, editorView]);
69
+ const handleResizeStop = useCallback((originalState, delta) => {
70
+ const newWidth = originalState.width + delta.width;
71
+ const {
72
+ state,
73
+ dispatch
74
+ } = editorView;
75
+ const pos = getPos();
76
+ let tr = state.tr.setMeta(tableWidthPluginKey, {
77
+ resizing: false
78
+ });
79
+ if (typeof pos === 'number') {
80
+ tr = tr.setNodeMarkup(pos, undefined, {
81
+ ...node.attrs,
82
+ width: newWidth
83
+ });
84
+ const newNode = tr.doc.nodeAt(pos);
85
+ tr = scaleTable(tableRef, {
86
+ node: newNode,
87
+ prevNode: node,
88
+ start: pos + 1,
89
+ parentWidth: newWidth
90
+ }, editorView.domAtPos.bind(editorView))(tr);
91
+ }
92
+ dispatch(tr);
93
+
94
+ // Hide guidelines when resizing stops
95
+ displayGuideline([]);
96
+ updateWidth(newWidth);
97
+ return newWidth;
98
+ }, [updateWidth, editorView, getPos, node, tableRef, displayGuideline]);
36
99
  return /*#__PURE__*/React.createElement(ResizerNext, {
37
100
  enable: handles,
38
101
  width: width,
39
102
  handleAlignmentMethod: "sticky",
40
103
  handleHeightSize: handleHeightSize,
41
104
  handleMarginTop: tableHandleMarginTop,
42
- handleResizeStart: () => width,
105
+ handleResizeStart: handleResizeStart,
43
106
  handleResize: rafSchd((originalState, delta) => {
44
107
  const newWidth = originalState.width + delta.width;
45
108
  const pos = getPos();
@@ -52,36 +115,15 @@ export const TableResizer = ({
52
115
  start: pos + 1,
53
116
  parentWidth: newWidth
54
117
  }, editorView.domAtPos.bind(editorView));
118
+ updateActiveGuidelines(findClosestSnap(newWidth, defaultGuidelineWidths, defaultGuidelines, TABLE_HIGHLIGHT_GAP));
55
119
  updateWidth(newWidth);
56
120
  return newWidth;
57
121
  }),
58
- handleResizeStop: (originalState, delta) => {
59
- const newWidth = originalState.width + delta.width;
60
- const {
61
- state,
62
- dispatch
63
- } = editorView;
64
- const pos = getPos();
65
- if (typeof pos !== 'number') {
66
- return;
67
- }
68
- let tr = state.tr.setNodeMarkup(pos, undefined, {
69
- ...node.attrs,
70
- width: newWidth
71
- });
72
- const newNode = tr.doc.nodeAt(pos);
73
- tr = scaleTable(tableRef, {
74
- node: newNode,
75
- prevNode: node,
76
- start: pos + 1,
77
- parentWidth: newWidth
78
- }, editorView.domAtPos.bind(editorView))(tr);
79
- dispatch(tr);
80
- updateWidth(newWidth);
81
- return newWidth;
82
- },
122
+ handleResizeStop: handleResizeStop,
83
123
  resizeRatio: 2,
84
124
  minWidth: minColumnWidth,
85
- maxWidth: maxWidth
125
+ maxWidth: maxWidth,
126
+ snapGap: TABLE_SNAP_GAP,
127
+ snap: guidelineSnaps
86
128
  }, children);
87
129
  };
@@ -7,6 +7,7 @@ import { pluginConfig as getPluginConfig } from '../create-plugin-config';
7
7
  import { getPluginState } from '../pm-plugins/plugin-factory';
8
8
  import { pluginKey } from '../pm-plugins/plugin-key';
9
9
  import { pluginKey as tableResizingPluginKey } from '../pm-plugins/table-resizing';
10
+ import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
10
11
  import { generateColgroup } from '../pm-plugins/table-resizing/utils';
11
12
  import { TableMap } from '@atlaskit/editor-tables/table-map';
12
13
  import TableComponent from './TableComponent';
@@ -83,6 +84,7 @@ export default class TableView extends ReactNodeView {
83
84
  plugins: {
84
85
  pluginState: pluginKey,
85
86
  tableResizingPluginState: tableResizingPluginKey,
87
+ tableWidthPluginState: tableWidthPluginKey,
86
88
  widthPlugin: fakePluginKey,
87
89
  mediaState: fakeMediaPluginKey
88
90
  },
@@ -90,12 +92,15 @@ export default class TableView extends ReactNodeView {
90
92
  render: pluginStates => {
91
93
  const {
92
94
  tableResizingPluginState,
95
+ tableWidthPluginState,
93
96
  pluginState,
94
97
  // containerWidth,
95
98
  mediaState
96
99
  } = pluginStates;
97
- const tableActive = props.getPos() === pluginState.tablePos;
98
100
  const containerWidth = props.getEditorContainerWidth();
101
+ const isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
102
+ const isResizing = Boolean((tableResizingPluginState === null || tableResizingPluginState === void 0 ? void 0 : tableResizingPluginState.dragging) || isTableResizing);
103
+ const tableActive = props.getPos() === pluginState.tablePos && !isTableResizing;
99
104
  return /*#__PURE__*/React.createElement(TableComponent, {
100
105
  view: props.view,
101
106
  allowColumnResizing: props.allowColumnResizing,
@@ -108,11 +113,12 @@ export default class TableView extends ReactNodeView {
108
113
  isHeaderColumnEnabled: pluginState.isHeaderColumnEnabled,
109
114
  tableActive: tableActive,
110
115
  ordering: pluginState.ordering,
111
- tableResizingPluginState: tableResizingPluginState,
116
+ isResizing: isResizing,
112
117
  getNode: this.getNode,
113
118
  containerWidth: containerWidth,
114
119
  contentDOM: forwardRef,
115
- getEditorFeatureFlags: props.getEditorFeatureFlags
120
+ getEditorFeatureFlags: props.getEditorFeatureFlags,
121
+ pluginInjectionApi: props.pluginInjectionApi
116
122
  });
117
123
  }
118
124
  });
@@ -176,7 +182,7 @@ export default class TableView extends ReactNodeView {
176
182
  super.destroy();
177
183
  }
178
184
  }
179
- export const createTableView = (node, view, getPos, portalProviderAPI, eventDispatcher, options, getEditorContainerWidth, getEditorFeatureFlags) => {
185
+ export const createTableView = (node, view, getPos, portalProviderAPI, eventDispatcher, options, getEditorContainerWidth, getEditorFeatureFlags, pluginInjectionApi) => {
180
186
  const {
181
187
  pluginConfig
182
188
  } = getPluginState(view.state);
@@ -198,6 +204,7 @@ export const createTableView = (node, view, getPos, portalProviderAPI, eventDisp
198
204
  tableRenderOptimization,
199
205
  getEditorContainerWidth,
200
206
  getEditorFeatureFlags,
201
- hasIntlContext
207
+ hasIntlContext,
208
+ pluginInjectionApi
202
209
  }).init();
203
210
  };