@atlaskit/editor-plugin-table 7.5.5 → 7.5.7

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 (100) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/commands/selection.js +23 -1
  3. package/dist/cjs/event-handlers.js +25 -9
  4. package/dist/cjs/nodeviews/OverflowShadowsObserver.js +24 -15
  5. package/dist/cjs/nodeviews/TableCell.js +5 -30
  6. package/dist/cjs/nodeviews/TableComponent.js +96 -41
  7. package/dist/cjs/nodeviews/TableContainer.js +19 -17
  8. package/dist/cjs/nodeviews/TableResizer.js +1 -1
  9. package/dist/cjs/plugin.js +2 -3
  10. package/dist/cjs/pm-plugins/main.js +3 -18
  11. package/dist/cjs/pm-plugins/sticky-headers/types.js +1 -5
  12. package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +3 -7
  13. package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +11 -1
  14. package/dist/cjs/pm-plugins/table-resizing/utils/resize-state.js +22 -23
  15. package/dist/cjs/pm-plugins/table-resizing/utils/scale-table.js +2 -2
  16. package/dist/cjs/pm-plugins/table-selection-keymap.js +3 -0
  17. package/dist/cjs/ui/TableFloatingColumnControls/index.js +8 -48
  18. package/dist/cjs/ui/TableFloatingControls/index.js +113 -223
  19. package/dist/cjs/utils/column-controls.js +5 -5
  20. package/dist/cjs/utils/dom.js +13 -15
  21. package/dist/es2019/commands/selection.js +22 -0
  22. package/dist/es2019/event-handlers.js +25 -9
  23. package/dist/es2019/nodeviews/OverflowShadowsObserver.js +24 -15
  24. package/dist/es2019/nodeviews/TableCell.js +1 -24
  25. package/dist/es2019/nodeviews/TableComponent.js +69 -31
  26. package/dist/es2019/nodeviews/TableContainer.js +16 -18
  27. package/dist/es2019/nodeviews/TableResizer.js +1 -1
  28. package/dist/es2019/plugin.js +2 -3
  29. package/dist/es2019/pm-plugins/main.js +3 -18
  30. package/dist/es2019/pm-plugins/sticky-headers/types.js +0 -1
  31. package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +3 -7
  32. package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +10 -0
  33. package/dist/es2019/pm-plugins/table-resizing/utils/resize-state.js +21 -22
  34. package/dist/es2019/pm-plugins/table-resizing/utils/scale-table.js +2 -2
  35. package/dist/es2019/pm-plugins/table-selection-keymap.js +5 -2
  36. package/dist/es2019/ui/TableFloatingColumnControls/index.js +5 -27
  37. package/dist/es2019/ui/TableFloatingControls/index.js +119 -193
  38. package/dist/es2019/utils/column-controls.js +6 -6
  39. package/dist/es2019/utils/dom.js +13 -15
  40. package/dist/esm/commands/selection.js +22 -0
  41. package/dist/esm/event-handlers.js +25 -9
  42. package/dist/esm/nodeviews/OverflowShadowsObserver.js +24 -15
  43. package/dist/esm/nodeviews/TableCell.js +5 -30
  44. package/dist/esm/nodeviews/TableComponent.js +96 -41
  45. package/dist/esm/nodeviews/TableContainer.js +20 -18
  46. package/dist/esm/nodeviews/TableResizer.js +1 -1
  47. package/dist/esm/plugin.js +2 -3
  48. package/dist/esm/pm-plugins/main.js +3 -18
  49. package/dist/esm/pm-plugins/sticky-headers/types.js +0 -1
  50. package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +3 -7
  51. package/dist/esm/pm-plugins/table-resizing/utils/misc.js +10 -0
  52. package/dist/esm/pm-plugins/table-resizing/utils/resize-state.js +23 -24
  53. package/dist/esm/pm-plugins/table-resizing/utils/scale-table.js +2 -2
  54. package/dist/esm/pm-plugins/table-selection-keymap.js +5 -2
  55. package/dist/esm/ui/TableFloatingColumnControls/index.js +8 -48
  56. package/dist/esm/ui/TableFloatingControls/index.js +113 -224
  57. package/dist/esm/utils/column-controls.js +6 -6
  58. package/dist/esm/utils/dom.js +13 -15
  59. package/dist/types/commands/selection.d.ts +1 -0
  60. package/dist/types/event-handlers.d.ts +3 -4
  61. package/dist/types/nodeviews/OverflowShadowsObserver.d.ts +3 -1
  62. package/dist/types/nodeviews/TableCell.d.ts +1 -5
  63. package/dist/types/nodeviews/TableComponent.d.ts +4 -0
  64. package/dist/types/nodeviews/TableContainer.d.ts +4 -2
  65. package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +1 -0
  66. package/dist/types/types.d.ts +0 -3
  67. package/dist/types/ui/TableFloatingColumnControls/index.d.ts +2 -1
  68. package/dist/types/ui/TableFloatingControls/index.d.ts +5 -22
  69. package/dist/types/utils/dom.d.ts +10 -2
  70. package/dist/types-ts4.5/commands/selection.d.ts +1 -0
  71. package/dist/types-ts4.5/event-handlers.d.ts +3 -4
  72. package/dist/types-ts4.5/nodeviews/OverflowShadowsObserver.d.ts +3 -1
  73. package/dist/types-ts4.5/nodeviews/TableCell.d.ts +1 -5
  74. package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +4 -0
  75. package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +4 -2
  76. package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +1 -0
  77. package/dist/types-ts4.5/types.d.ts +0 -3
  78. package/dist/types-ts4.5/ui/TableFloatingColumnControls/index.d.ts +2 -1
  79. package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +5 -22
  80. package/dist/types-ts4.5/utils/dom.d.ts +10 -2
  81. package/package.json +8 -6
  82. package/src/commands/selection.ts +33 -0
  83. package/src/event-handlers.ts +105 -103
  84. package/src/nodeviews/OverflowShadowsObserver.ts +32 -21
  85. package/src/nodeviews/TableCell.ts +0 -26
  86. package/src/nodeviews/TableComponent.tsx +81 -34
  87. package/src/nodeviews/TableContainer.tsx +19 -25
  88. package/src/nodeviews/TableResizer.tsx +1 -4
  89. package/src/plugin.tsx +5 -4
  90. package/src/pm-plugins/main.ts +3 -22
  91. package/src/pm-plugins/table-resizing/utils/colgroup.ts +3 -6
  92. package/src/pm-plugins/table-resizing/utils/misc.ts +13 -0
  93. package/src/pm-plugins/table-resizing/utils/resize-state.ts +22 -28
  94. package/src/pm-plugins/table-resizing/utils/scale-table.ts +3 -10
  95. package/src/pm-plugins/table-selection-keymap.ts +10 -0
  96. package/src/types.ts +0 -4
  97. package/src/ui/TableFloatingColumnControls/index.tsx +5 -29
  98. package/src/ui/TableFloatingControls/index.tsx +155 -241
  99. package/src/utils/column-controls.ts +5 -6
  100. package/src/utils/dom.ts +12 -19
@@ -6,6 +6,9 @@ import _inherits from "@babel/runtime/helpers/inherits";
6
6
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
7
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
10
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
12
  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; }
10
13
  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; }
11
14
  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); }; }
@@ -45,6 +48,12 @@ var isIE11 = browser.ie_version === 11;
45
48
  // componentDidUpdate is called multiple times. The isOverflowing value is correct only on the last update.
46
49
  // To make sure we capture the last update, we use setTimeout.
47
50
  var initialOverflowCaptureTimeroutDelay = 300;
51
+
52
+ // This is a hard switch for controlling whether the overflow analytics should be dispatched. There has been 6months of data
53
+ // already collected which we could use but have not. This has been disabled rather then removed entirely in the event that
54
+ // the current collected data becomes stale and we want to start collecting fresh data again in future.
55
+ // PLEASE NOTE: that the current way this alaytics has been configured WILL cause reflows to occur. This is why the has been disabled.
56
+ var isOverflowAnalyticsEnabled = false;
48
57
  var TableComponent = /*#__PURE__*/function (_React$Component) {
49
58
  _inherits(TableComponent, _React$Component);
50
59
  var _super = _createSuper(TableComponent);
@@ -56,7 +65,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
56
65
  _defineProperty(_assertThisInitialized(_this), "state", (_defineProperty2 = {
57
66
  scroll: 0,
58
67
  parentWidth: undefined
59
- }, _defineProperty(_defineProperty2, ShadowEvent.SHOW_BEFORE_SHADOW, false), _defineProperty(_defineProperty2, ShadowEvent.SHOW_AFTER_SHADOW, false), _defineProperty2));
68
+ }, _defineProperty(_defineProperty2, ShadowEvent.SHOW_BEFORE_SHADOW, false), _defineProperty(_defineProperty2, ShadowEvent.SHOW_AFTER_SHADOW, false), _defineProperty(_defineProperty2, "tableWrapperWidth", undefined), _defineProperty(_defineProperty2, "tableWrapperHeight", undefined), _defineProperty2));
60
69
  _defineProperty(_assertThisInitialized(_this), "updateShadowState", function (shadowKey, value) {
61
70
  if (_this.state[shadowKey] === value) {
62
71
  return;
@@ -288,6 +297,29 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
288
297
  _this.layoutSize = _this.tableNodeLayoutSize(_this.node, _containerWidth.width, {
289
298
  isFullWidthModeEnabled: isFullWidthModeEnabled
290
299
  });
300
+ _this.resizeObserver = new ResizeObserver(function (entries) {
301
+ var _iterator = _createForOfIteratorHelper(entries),
302
+ _step;
303
+ try {
304
+ var _loop = function _loop() {
305
+ var entry = _step.value;
306
+ _this.setState(function (prev) {
307
+ var _entry$contentRect, _entry$contentRect2;
308
+ return (prev === null || prev === void 0 ? void 0 : prev.tableWrapperWidth) === ((_entry$contentRect = entry.contentRect) === null || _entry$contentRect === void 0 ? void 0 : _entry$contentRect.width) && (prev === null || prev === void 0 ? void 0 : prev.tableWrapperHeight) === ((_entry$contentRect2 = entry.contentRect) === null || _entry$contentRect2 === void 0 ? void 0 : _entry$contentRect2.height) ? prev : _objectSpread(_objectSpread({}, prev), {}, {
309
+ tableWrapperWidth: entry.contentRect.width,
310
+ tableWrapperHeight: entry.contentRect.height
311
+ });
312
+ });
313
+ };
314
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
315
+ _loop();
316
+ }
317
+ } catch (err) {
318
+ _iterator.e(err);
319
+ } finally {
320
+ _iterator.f();
321
+ }
322
+ });
291
323
 
292
324
  // Disable inline table editing and resizing controls in Firefox
293
325
  // https://github.com/ProseMirror/prosemirror/issues/432
@@ -347,12 +379,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
347
379
  this.onStickyState(currentStickyState);
348
380
  }
349
381
  eventDispatcher.on(stickyHeadersPluginKey.key, this.onStickyState);
350
- var initialIsOveflowing = this.state[ShadowEvent.SHOW_BEFORE_SHADOW] || this.state[ShadowEvent.SHOW_AFTER_SHADOW];
351
- this.setTimerToSendInitialOverflowCaptured(initialIsOveflowing);
382
+ if (isOverflowAnalyticsEnabled) {
383
+ var initialIsOveflowing = this.state[ShadowEvent.SHOW_BEFORE_SHADOW] || this.state[ShadowEvent.SHOW_AFTER_SHADOW];
384
+ this.setTimerToSendInitialOverflowCaptured(initialIsOveflowing);
385
+ }
352
386
  }
353
387
  }, {
354
388
  key: "componentWillUnmount",
355
389
  value: function componentWillUnmount() {
390
+ var _this$resizeObserver;
356
391
  var _this$props8 = this.props,
357
392
  allowColumnResizing = _this$props8.allowColumnResizing,
358
393
  eventDispatcher = _this$props8.eventDispatcher,
@@ -365,6 +400,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
365
400
  if (isDragAndDropEnabled && this.dragAndDropCleanupFn) {
366
401
  this.dragAndDropCleanupFn();
367
402
  }
403
+ (_this$resizeObserver = this.resizeObserver) === null || _this$resizeObserver === void 0 || _this$resizeObserver.disconnect();
368
404
  var _getEditorFeatureFlag2 = getEditorFeatureFlags(),
369
405
  stickyScrollbar = _getEditorFeatureFlag2.stickyScrollbar;
370
406
  if (stickyScrollbar) {
@@ -393,7 +429,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
393
429
  }, {
394
430
  key: "handleColgroupUpdates",
395
431
  value: function handleColgroupUpdates() {
396
- var _this$containerWidth;
432
+ var _this$containerWidth,
433
+ _this2 = this;
397
434
  var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
398
435
  var _this$props9 = this.props,
399
436
  getNode = _this$props9.getNode,
@@ -416,7 +453,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
416
453
  if (depth !== 0) {
417
454
  return;
418
455
  }
419
- var tableNodeWidth = tableNode.attrs.width;
456
+ var tableNodeWidth = getTableContainerWidth(tableNode);
420
457
  var shouldTableScale = tableRenderWidth < tableNodeWidth;
421
458
  var containerWidthValue = containerWidth.width;
422
459
  var isWidthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.width) !== containerWidthValue;
@@ -430,7 +467,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
430
467
  domAtPos: view.domAtPos,
431
468
  isTableScalingEnabled: true
432
469
  });
433
- updateColgroup(resizeState, this.table, tableNode, true);
470
+
471
+ // Request animation frame required for Firefox
472
+ requestAnimationFrame(function () {
473
+ updateColgroup(resizeState, _this2.table, tableNode, true);
474
+ });
434
475
  }
435
476
  this.containerWidth = containerWidth;
436
477
  }
@@ -438,7 +479,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
438
479
  key: "componentDidUpdate",
439
480
  value: function componentDidUpdate(_, prevState) {
440
481
  var _this$wrapper,
441
- _this2 = this;
482
+ _this3 = this;
442
483
  var _this$props10 = this.props,
443
484
  view = _this$props10.view,
444
485
  getNode = _this$props10.getNode,
@@ -462,7 +503,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
462
503
  // that happens when a table is nested in expand and expand's width is
463
504
  // changed via breakout button
464
505
  window.requestAnimationFrame(function () {
465
- _this2.overflowShadowsObserver = new OverflowShadowsObserver(_this2.updateShadowState, _this2.table, _this2.wrapper);
506
+ _this3.overflowShadowsObserver = new OverflowShadowsObserver(_this3.updateShadowState, _this3.table, _this3.wrapper);
466
507
  });
467
508
  } else {
468
509
  this.overflowShadowsObserver = new OverflowShadowsObserver(this.updateShadowState, this.table, this.wrapper);
@@ -493,32 +534,42 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
493
534
  }
494
535
  this.handleTableResizingDebounced();
495
536
  }
496
- var newIsOverflowing = this.state[ShadowEvent.SHOW_BEFORE_SHADOW] || this.state[ShadowEvent.SHOW_AFTER_SHADOW];
497
- var prevIsOverflowing = prevState[ShadowEvent.SHOW_BEFORE_SHADOW] || prevState[ShadowEvent.SHOW_AFTER_SHADOW];
498
- if (this.initialOverflowCaptureTimerId) {
499
- clearTimeout(this.initialOverflowCaptureTimerId);
537
+ if (isOverflowAnalyticsEnabled) {
538
+ var newIsOverflowing = this.state[ShadowEvent.SHOW_BEFORE_SHADOW] || this.state[ShadowEvent.SHOW_AFTER_SHADOW];
539
+ var prevIsOverflowing = prevState[ShadowEvent.SHOW_BEFORE_SHADOW] || prevState[ShadowEvent.SHOW_AFTER_SHADOW];
540
+ if (this.initialOverflowCaptureTimerId) {
541
+ clearTimeout(this.initialOverflowCaptureTimerId);
542
+ }
543
+ if (!this.isInitialOverflowSent) {
544
+ this.setTimerToSendInitialOverflowCaptured(newIsOverflowing);
545
+ }
546
+ if (this.isInitialOverflowSent && prevIsOverflowing !== newIsOverflowing) {
547
+ var _this$state2;
548
+ var _this$props$view = this.props.view,
549
+ dispatch = _this$props$view.dispatch,
550
+ tr = _this$props$view.state.tr;
551
+ dispatch(tr.setMeta(META_KEYS.OVERFLOW_STATE_CHANGED, {
552
+ isOverflowing: newIsOverflowing,
553
+ wasOverflowing: prevIsOverflowing,
554
+ editorWidth: this.props.containerWidth.width || 0,
555
+ width: this.node.attrs.width || 0,
556
+ parentWidth: ((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.parentWidth) || 0
557
+ }));
558
+ }
500
559
  }
501
- if (!this.isInitialOverflowSent) {
502
- this.setTimerToSendInitialOverflowCaptured(newIsOverflowing);
503
- }
504
- if (this.isInitialOverflowSent && prevIsOverflowing !== newIsOverflowing) {
505
- var _this$state2;
506
- var _this$props$view = this.props.view,
507
- dispatch = _this$props$view.dispatch,
508
- tr = _this$props$view.state.tr;
509
- dispatch(tr.setMeta(META_KEYS.OVERFLOW_STATE_CHANGED, {
510
- isOverflowing: newIsOverflowing,
511
- wasOverflowing: prevIsOverflowing,
512
- editorWidth: this.props.containerWidth.width || 0,
513
- width: this.node.attrs.width || 0,
514
- parentWidth: ((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.parentWidth) || 0
515
- }));
560
+ }
561
+ }, {
562
+ key: "observeTable",
563
+ value: function observeTable(table) {
564
+ if (table) {
565
+ var _this$resizeObserver2;
566
+ (_this$resizeObserver2 = this.resizeObserver) === null || _this$resizeObserver2 === void 0 || _this$resizeObserver2.observe(table);
516
567
  }
517
568
  }
518
569
  }, {
519
570
  key: "render",
520
571
  value: function render() {
521
- var _this3 = this,
572
+ var _this4 = this,
522
573
  _classnames;
523
574
  var _this$props11 = this.props,
524
575
  view = _this$props11.view,
@@ -570,7 +621,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
570
621
  ,
571
622
  selection: view.state.selection,
572
623
  headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
573
- stickyHeader: this.state.stickyHeader
624
+ stickyHeader: this.state.stickyHeader,
625
+ tableWrapperWidth: this.state.tableWrapperWidth
574
626
  });
575
627
  var tableContainerWidth = getTableContainerWidth(node);
576
628
  var colControls = isDragAndDropEnabled ? /*#__PURE__*/React.createElement(TableFloatingColumnControls, {
@@ -594,9 +646,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
594
646
  tableContainerWidth: tableContainerWidth,
595
647
  isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
596
648
  getScrollOffset: function getScrollOffset() {
597
- var _this3$wrapper;
598
- return ((_this3$wrapper = _this3.wrapper) === null || _this3$wrapper === void 0 ? void 0 : _this3$wrapper.scrollLeft) || 0;
599
- }
649
+ var _this4$wrapper;
650
+ return ((_this4$wrapper = _this4.wrapper) === null || _this4$wrapper === void 0 ? void 0 : _this4$wrapper.scrollLeft) || 0;
651
+ },
652
+ tableWrapperHeight: this.state.tableWrapperHeight
600
653
  }) : null;
601
654
  var shadowPadding = allowControls && tableActive ? -tableToolbarSize : tableMarginSides;
602
655
  var shadowStyle = memoizeOne(function (visible) {
@@ -630,6 +683,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
630
683
  isBreakoutEnabled: options === null || options === void 0 ? void 0 : options.isBreakoutEnabled,
631
684
  isNested: isNested,
632
685
  pluginInjectionApi: pluginInjectionApi,
686
+ tableWrapperHeight: this.state.tableWrapperHeight,
633
687
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled,
634
688
  isResizing: isResizing,
635
689
  isTableScalingEnabled: isTableScalingEnabled
@@ -643,12 +697,12 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
643
697
  editorView: view,
644
698
  node: node,
645
699
  getScrollOffset: function getScrollOffset() {
646
- var _this3$wrapper2;
647
- return ((_this3$wrapper2 = _this3.wrapper) === null || _this3$wrapper2 === void 0 ? void 0 : _this3$wrapper2.scrollLeft) || 0;
700
+ var _this4$wrapper2;
701
+ return ((_this4$wrapper2 = _this4.wrapper) === null || _this4$wrapper2 === void 0 ? void 0 : _this4$wrapper2.scrollLeft) || 0;
648
702
  },
649
703
  getTableWrapperWidth: function getTableWrapperWidth() {
650
- var _this3$wrapper3;
651
- return ((_this3$wrapper3 = _this3.wrapper) === null || _this3$wrapper3 === void 0 ? void 0 : _this3$wrapper3.clientWidth) || 760;
704
+ var _this4$wrapper3;
705
+ return ((_this4$wrapper3 = _this4.wrapper) === null || _this4$wrapper3 === void 0 ? void 0 : _this4$wrapper3.clientWidth) || 760;
652
706
  }
653
707
  }), /*#__PURE__*/React.createElement("div", {
654
708
  style: shadowStyle(showBeforeShadow),
@@ -663,13 +717,14 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
663
717
  }), /*#__PURE__*/React.createElement("div", {
664
718
  className: classnames(ClassName.TABLE_NODE_WRAPPER),
665
719
  ref: function ref(elem) {
666
- _this3.wrapper = elem;
720
+ _this4.wrapper = elem;
667
721
  if (elem) {
668
- _this3.props.contentDOM(elem);
722
+ _this4.props.contentDOM(elem);
669
723
  var tableElement = elem.querySelector('table');
670
- if (tableElement !== _this3.table) {
671
- _this3.table = tableElement;
672
- _this3.createShadowSentinels(_this3.table);
724
+ if (tableElement !== _this4.table) {
725
+ _this4.table = tableElement;
726
+ _this4.createShadowSentinels(_this4.table);
727
+ _this4.observeTable(_this4.table);
673
728
  }
674
729
  }
675
730
  }
@@ -1,7 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  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
4
  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
- import React, { forwardRef, useCallback, useRef } from 'react';
5
+ import React, { forwardRef, useCallback, useRef, useState } from 'react';
5
6
  import classNames from 'classnames';
6
7
  import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
7
8
  import { calcTableWidth } from '@atlaskit/editor-common/styles';
@@ -44,9 +45,14 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
44
45
  tableRef = _ref2.tableRef,
45
46
  isResizing = _ref2.isResizing,
46
47
  pluginInjectionApi = _ref2.pluginInjectionApi,
47
- isTableScalingEnabled = _ref2.isTableScalingEnabled;
48
+ isTableScalingEnabled = _ref2.isTableScalingEnabled,
49
+ tableWrapperHeight = _ref2.tableWrapperHeight;
48
50
  var containerRef = useRef(null);
49
51
  var tableWidthRef = useRef(akEditorDefaultLayoutWidth);
52
+ var _useState = useState(false),
53
+ _useState2 = _slicedToArray(_useState, 2),
54
+ resizing = _useState2[0],
55
+ setIsResizing = _useState2[1];
50
56
  var updateContainerHeight = useCallback(function (height) {
51
57
  var _containerRef$current;
52
58
  // current StickyHeader State is not stable to be fetch.
@@ -54,31 +60,24 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
54
60
  // consistently fetch and refactor below
55
61
  var stickyHeaders = (_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.getElementsByClassName('pm-table-sticky');
56
62
  if (!stickyHeaders || stickyHeaders.length < 1) {
57
- var _containerRef$current2;
58
63
  // when starting to drag, we need to keep the original space,
59
64
  // -- When sticky header not appear, margin top(24px) and margin bottom(16px), should be 40px,
60
65
  // 1px is border width but collapse make it 0.5.
61
66
  // -- When sticky header appear, we should add first row height but reduce
62
67
  // collapsed border
63
- (_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 || _containerRef$current2.style.setProperty('height', typeof height === 'number' ? "".concat(height + 40.5, "px") : 'auto');
68
+ return typeof height === 'number' ? "".concat(height + 40.5, "px") : 'auto';
64
69
  } else {
65
- var _containerRef$current3, _containerRef$current4;
66
- var stickyHeaderHeight = ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.getElementsByTagName('th')[0].getBoundingClientRect().height) || 0;
67
- (_containerRef$current4 = containerRef.current) === null || _containerRef$current4 === void 0 || _containerRef$current4.style.setProperty('height', typeof height === 'number' ? "".concat(height + stickyHeaderHeight + 39.5, "px") : 'auto');
70
+ var _containerRef$current2;
71
+ var stickyHeaderHeight = ((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.getElementsByTagName('th')[0].getBoundingClientRect().height) || 0;
72
+ return typeof height === 'number' ? "".concat(height + stickyHeaderHeight + 39.5, "px") : 'auto';
68
73
  }
69
74
  }, []);
70
- var resizeObserverRef = useRef(new ResizeObserver(function (entries) {
71
- updateContainerHeight(entries[entries.length - 1].contentRect.height);
72
- }));
73
75
  var onResizeStart = useCallback(function () {
74
- if (tableRef) {
75
- resizeObserverRef.current.observe(tableRef);
76
- }
77
- }, [tableRef]);
76
+ setIsResizing(true);
77
+ }, []);
78
78
  var onResizeStop = useCallback(function () {
79
- updateContainerHeight('auto');
80
- resizeObserverRef.current.disconnect();
81
- }, [updateContainerHeight]);
79
+ setIsResizing(false);
80
+ }, []);
82
81
  var updateWidth = useCallback(function (width) {
83
82
  if (!containerRef.current) {
84
83
  return;
@@ -141,7 +140,8 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref2) {
141
140
  }
142
141
  }, /*#__PURE__*/React.createElement("div", {
143
142
  style: {
144
- width: tableWidthRef.current
143
+ width: tableWidthRef.current,
144
+ height: resizing ? updateContainerHeight(tableWrapperHeight !== null && tableWrapperHeight !== void 0 ? tableWrapperHeight : 'auto') : 'auto'
145
145
  },
146
146
  className: ClassName.TABLE_RESIZER_CONTAINER,
147
147
  ref: containerRef
@@ -163,6 +163,7 @@ export var TableContainer = function TableContainer(_ref3) {
163
163
  getPos = _ref3.getPos,
164
164
  tableRef = _ref3.tableRef,
165
165
  isNested = _ref3.isNested,
166
+ tableWrapperHeight = _ref3.tableWrapperHeight,
166
167
  isResizing = _ref3.isResizing,
167
168
  pluginInjectionApi = _ref3.pluginInjectionApi,
168
169
  isTableScalingEnabled = _ref3.isTableScalingEnabled;
@@ -174,6 +175,7 @@ export var TableContainer = function TableContainer(_ref3) {
174
175
  editorView: editorView,
175
176
  getPos: getPos,
176
177
  tableRef: tableRef,
178
+ tableWrapperHeight: tableWrapperHeight,
177
179
  isResizing: isResizing,
178
180
  pluginInjectionApi: pluginInjectionApi,
179
181
  isTableScalingEnabled: isTableScalingEnabled
@@ -55,7 +55,7 @@ var getResizerHandleHeight = function getResizerHandleHeight(tableRef) {
55
55
  };
56
56
  var getResizerMinWidth = function getResizerMinWidth(node) {
57
57
  var currentColumnCount = getColgroupChildrenLength(node);
58
- var minColumnWidth = currentColumnCount <= 3 ? currentColumnCount * COLUMN_MIN_WIDTH : 3 * COLUMN_MIN_WIDTH;
58
+ var minColumnWidth = Math.min(3, currentColumnCount) * COLUMN_MIN_WIDTH;
59
59
  // add an extra pixel as the scale table logic will scale columns to be tableContainerWidth - 1
60
60
  // the table can't scale past its min-width, so instead restrict table container min width to avoid that situation
61
61
  return minColumnWidth + 1;
@@ -50,11 +50,10 @@ var tablesPlugin = function tablesPlugin(_ref) {
50
50
  current: null
51
51
  };
52
52
  var defaultGetEditorContainerWidth = function defaultGetEditorContainerWidth() {
53
- var _document$body$offset, _document, _api$width$sharedStat, _api$width;
54
- var defaultState = {
53
+ var _api$width$sharedStat, _api$width, _document$body$offset, _document;
54
+ return (_api$width$sharedStat = api === null || api === void 0 || (_api$width = api.width) === null || _api$width === void 0 ? void 0 : _api$width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : {
55
55
  width: (_document$body$offset = (_document = document) === null || _document === void 0 || (_document = _document.body) === null || _document === void 0 ? void 0 : _document.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 500
56
56
  };
57
- return (_api$width$sharedStat = api === null || api === void 0 || (_api$width = api.width) === null || _api$width === void 0 ? void 0 : _api$width.sharedState.currentState()) !== null && _api$width$sharedStat !== void 0 ? _api$width$sharedStat : defaultState;
58
57
  };
59
58
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
60
59
  return {
@@ -26,7 +26,6 @@ import { defaultHoveredCell, defaultTableSelection } from './default-table-selec
26
26
  import { createPluginState, getPluginState } from './plugin-factory';
27
27
  import { pluginKey } from './plugin-key';
28
28
  export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, breakoutEnabled, tableResizingEnabled, fullWidthModeEnabled, previousFullWidthModeEnabled, dragAndDropEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled) {
29
- var _window;
30
29
  var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
31
30
  pluginConfig: pluginConfig,
32
31
  isTableHovered: false,
@@ -43,15 +42,6 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
43
42
  }, defaultHoveredCell), defaultTableSelection), {}, {
44
43
  getIntl: getIntl
45
44
  }));
46
- var elementContentRects = {};
47
- var observer = (_window = window) !== null && _window !== void 0 && _window.ResizeObserver ? new ResizeObserver(function (entries) {
48
- entries.forEach(function (entry) {
49
- if (!entry.target.id) {
50
- return;
51
- }
52
- elementContentRects[entry.target.id] = entry.contentRect;
53
- });
54
- }) : undefined;
55
45
 
56
46
  // Used to prevent invalid table cell spans being reported more than once per editor/document
57
47
  var invalidTableIds = [];
@@ -154,11 +144,6 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
154
144
  } else if (pluginState.isResizeHandleWidgetAdded) {
155
145
  removeResizeHandleDecorations()(state, dispatch);
156
146
  }
157
- },
158
- destroy: function destroy() {
159
- if (observer) {
160
- observer.disconnect();
161
- }
162
147
  }
163
148
  };
164
149
  },
@@ -264,10 +249,10 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
264
249
  return new TableRow(node, view, getPos, eventDispatcher);
265
250
  },
266
251
  tableCell: function tableCell(node, view, getPos) {
267
- return new TableCell(node, view, getPos, eventDispatcher, observer);
252
+ return new TableCell(node, view, getPos, eventDispatcher);
268
253
  },
269
254
  tableHeader: function tableHeader(node, view, getPos) {
270
- return new TableCell(node, view, getPos, eventDispatcher, observer);
255
+ return new TableCell(node, view, getPos, eventDispatcher);
271
256
  }
272
257
  },
273
258
  handleDOMEvents: {
@@ -277,7 +262,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
277
262
  mouseover: withCellTracking(whenTableInFocus(handleMouseOver)),
278
263
  mouseleave: handleMouseLeave,
279
264
  mouseout: whenTableInFocus(handleMouseOut),
280
- mousemove: whenTableInFocus(handleMouseMove, elementContentRects),
265
+ mousemove: whenTableInFocus(handleMouseMove),
281
266
  mouseenter: handleMouseEnter,
282
267
  mouseup: whenTableInFocus(handleMouseUp),
283
268
  click: withCellTracking(whenTableInFocus(handleClick))
@@ -1 +0,0 @@
1
- export {};
@@ -4,7 +4,7 @@ import { getFragmentBackingArray } from '@atlaskit/editor-common/utils';
4
4
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
5
5
  import { TableMap } from '@atlaskit/editor-tables/table-map';
6
6
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
- import { MAX_SCALING_PERCENT } from './consts';
7
+ import { getTableScalingPercent } from './misc';
8
8
  /**
9
9
  * This ensures the combined width of the columns (and tbody) of table is always smaller or equal
10
10
  * than the table and table wrapper elements. This is necessary as there is no longer
@@ -24,14 +24,10 @@ export var generateColgroup = function generateColgroup(table, tableRef) {
24
24
  // We slice here to guard against our colwidth array having more entries
25
25
  // Than the we actually span. We'll patch the document at a later point.
26
26
  if (tableRef) {
27
- var _tableRef$parentEleme;
28
- var tableWidth = table.attrs && table.attrs.width;
29
- var renderWidth = ((_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || 760;
30
- var scalePercent = renderWidth / tableWidth;
31
- scalePercent = Math.max(scalePercent, 1 - MAX_SCALING_PERCENT);
27
+ var scalePercent = getTableScalingPercent(table, tableRef);
32
28
  cell.attrs.colwidth.slice(0, colspan).forEach(function (width) {
33
29
  var fixedColWidth = getColWidthFix(width, map.width);
34
- var scaledWidth = fixedColWidth * Math.min(scalePercent, 1);
30
+ var scaledWidth = fixedColWidth * scalePercent;
35
31
  var finalWidth = Math.max(scaledWidth, tableCellMinWidth);
36
32
  cols.push(['col', {
37
33
  style: "width: ".concat(finalWidth, "px;")
@@ -5,6 +5,7 @@ import { calcTableColumnWidths, containsClassName } from '@atlaskit/editor-commo
5
5
  import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
6
6
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
7
  import { hasTableBeenResized } from './colgroup';
8
+ import { MAX_SCALING_PERCENT } from './consts';
8
9
 
9
10
  // Translates named layouts in number values.
10
11
  export function getLayoutSize(tableLayout) {
@@ -89,4 +90,13 @@ export var getTableElementWidth = function getTableElementWidth(table) {
89
90
  };
90
91
  export var getTableContainerElementWidth = function getTableContainerElementWidth(table) {
91
92
  return getTableContainerWidth(table);
93
+ };
94
+ export var getTableScalingPercent = function getTableScalingPercent(table, tableRef) {
95
+ var _tableRef$parentEleme;
96
+ var tableWidth = getTableContainerElementWidth(table);
97
+ var renderWidth = ((_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || tableWidth;
98
+ // minus 1 here to avoid any 1px scroll in Firefox
99
+ var scalePercent = (renderWidth - 1) / tableWidth;
100
+ scalePercent = Math.max(scalePercent, 1 - MAX_SCALING_PERCENT);
101
+ return Math.min(scalePercent, 1);
92
102
  };
@@ -1,6 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
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
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
+ import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
4
5
  import { tableCellMinWidth, tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
5
6
  import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
6
7
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
@@ -8,8 +9,7 @@ import { getSelectedTableInfo } from '../../../utils';
8
9
  import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
9
10
  import { getCellsRefsInColumn, getColumnStateFromDOM } from './column-state';
10
11
  import { syncStickyRowToTable } from './dom';
11
- import { getTableContainerElementWidth, getTableMaxWidth } from './misc';
12
- import { COLUMN_MIN_WIDTH, MAX_SCALING_PERCENT, TABLE_DEFAULT_WIDTH } from './index';
12
+ import { getTableMaxWidth, getTableScalingPercent } from './misc';
13
13
  export var getResizeState = function getResizeState(_ref) {
14
14
  var minWidth = _ref.minWidth,
15
15
  maxSize = _ref.maxSize,
@@ -19,6 +19,10 @@ export var getResizeState = function getResizeState(_ref) {
19
19
  domAtPos = _ref.domAtPos,
20
20
  _ref$isTableScalingEn = _ref.isTableScalingEnabled,
21
21
  isTableScalingEnabled = _ref$isTableScalingEn === void 0 ? false : _ref$isTableScalingEn;
22
+ if (isTableScalingEnabled) {
23
+ var scalePercent = getTableScalingPercent(table, tableRef);
24
+ minWidth = Math.ceil(minWidth / scalePercent);
25
+ }
22
26
  // If the table has been resized, we can use the column widths from the table node
23
27
  if (hasTableBeenResized(table)) {
24
28
  var _cols = calcTableColumnWidths(table).map(function (width, index) {
@@ -51,11 +55,12 @@ export var getResizeState = function getResizeState(_ref) {
51
55
  var cols = Array.from(colgroupChildren).map(function (_, index) {
52
56
  // If the table hasn't been resized and we have a table width attribute, we can use it
53
57
  // to calculate the widths of the columns
54
- if (isTableScalingEnabled && table.attrs.width) {
58
+ if (isTableScalingEnabled) {
59
+ var tableNodeWidth = getTableContainerWidth(table);
55
60
  return {
56
61
  index: index,
57
- width: table.attrs.width / colgroupChildren.length,
58
- minWidth: COLUMN_MIN_WIDTH
62
+ width: tableNodeWidth / colgroupChildren.length,
63
+ minWidth: minWidth
59
64
  };
60
65
  }
61
66
  var cellsRefs = getCellsRefsInColumn(index, table, start, domAtPos);
@@ -83,25 +88,19 @@ export var updateColgroup = function updateColgroup(state, tableRef, tableNode,
83
88
  if (getBooleanFF('platform.editor.custom-table-width')) {
84
89
  var columnsCount = cols.length;
85
90
  if (isTableScalingEnabled && tableNode) {
86
- var tableWidth = getTableContainerElementWidth(tableNode);
87
- if (tableWidth) {
88
- var _tableRef$parentEleme;
89
- var renderWidth = ((_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || TABLE_DEFAULT_WIDTH;
90
- var scalePercent = renderWidth / tableWidth;
91
- scalePercent = Math.max(scalePercent, 1 - MAX_SCALING_PERCENT);
92
- state.cols.filter(function (column) {
93
- return column && !!column.width;
94
- }) // if width is 0, we dont want to apply that.
95
- .forEach(function (column, i) {
96
- var fixedColWidth = getColWidthFix(column.width, columnsCount);
97
- var scaledWidth = fixedColWidth * Math.min(scalePercent, 1);
98
- var finalWidth = Math.max(scaledWidth, tableCellMinWidth);
99
- // we aren't handling the remaining pixels here when the 48px min width is reached
100
- if (cols[i]) {
101
- cols[i].style.width = "".concat(finalWidth, "px");
102
- }
103
- });
104
- }
91
+ var scalePercent = getTableScalingPercent(tableNode, tableRef);
92
+ state.cols.filter(function (column) {
93
+ return column && !!column.width;
94
+ }) // if width is 0, we dont want to apply that.
95
+ .forEach(function (column, i) {
96
+ var fixedColWidth = getColWidthFix(column.width, columnsCount);
97
+ var scaledWidth = fixedColWidth * scalePercent;
98
+ var finalWidth = Math.max(scaledWidth, tableCellMinWidth);
99
+ // we aren't handling the remaining pixels here when the 48px min width is reached
100
+ if (cols[i]) {
101
+ cols[i].style.width = "".concat(finalWidth, "px");
102
+ }
103
+ });
105
104
  } else {
106
105
  state.cols.filter(function (column) {
107
106
  return column && !!column.width;
@@ -124,9 +124,9 @@ export var previewScaleTable = function previewScaleTable(tableRef, options, dom
124
124
  syncStickyRowToTable(tableRef);
125
125
  return;
126
126
  }
127
- var resizeState = parentWidth ? scaleWithParent(tableRef, parentWidth, node, start, domAtPos, isTableScalingEnabled) : scale(tableRef, options, domAtPos, isTableScalingEnabled);
127
+ var resizeState = parentWidth ? scaleWithParent(tableRef, parentWidth, node, start, domAtPos, false) : scale(tableRef, options, domAtPos, false);
128
128
  if (resizeState) {
129
- updateColgroup(resizeState, tableRef, node, isTableScalingEnabled);
129
+ updateColgroup(resizeState, tableRef, node, false);
130
130
  }
131
131
  };
132
132
 
@@ -1,7 +1,7 @@
1
- import { bindKeymapArrayWithCommand, bindKeymapWithCommand, moveLeft, moveRight, selectColumn, selectRow, shiftArrowUp } from '@atlaskit/editor-common/keymaps';
1
+ import { bindKeymapArrayWithCommand, bindKeymapWithCommand, moveLeft, moveRight, selectColumn, selectRow, selectTable, shiftArrowUp } from '@atlaskit/editor-common/keymaps';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
3
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
- import { arrowLeftFromTable, arrowRightFromTable, selectColumns, selectRows, shiftArrowUpFromTable } from '../commands/selection';
4
+ import { arrowLeftFromTable, arrowRightFromTable, modASelectTable, selectColumns, selectRows, shiftArrowUpFromTable } from '../commands/selection';
5
5
  export function tableSelectionKeymapPlugin(editorSelectionAPI) {
6
6
  var list = {};
7
7
  bindKeymapWithCommand(moveRight.common, arrowRightFromTable(editorSelectionAPI)(), list);
@@ -13,6 +13,9 @@ export function tableSelectionKeymapPlugin(editorSelectionAPI) {
13
13
  if (getBooleanFF('platform.editor.table.shift-arrowup-fix')) {
14
14
  bindKeymapWithCommand(shiftArrowUp.common, shiftArrowUpFromTable(editorSelectionAPI)(), list);
15
15
  }
16
+ if (getBooleanFF('platform.editor.table.cmd-a-select-table')) {
17
+ bindKeymapWithCommand(selectTable.common, modASelectTable(editorSelectionAPI)(), list);
18
+ }
16
19
  return keymap(list);
17
20
  }
18
21
  export default tableSelectionKeymapPlugin;