@atlaskit/editor-plugin-table 2.8.5 → 2.9.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 (85) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +2 -1
  3. package/dist/cjs/plugins/table/nodeviews/TableComponent.js +6 -6
  4. package/dist/cjs/plugins/table/nodeviews/TableContainer.js +1 -1
  5. package/dist/cjs/plugins/table/nodeviews/TableResizer.js +3 -1
  6. package/dist/cjs/plugins/table/pm-plugins/keymap.js +10 -13
  7. package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -1
  8. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +13 -2
  9. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -6
  10. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +21 -8
  11. package/dist/cjs/plugins/table/ui/FloatingInsertButton/InsertButton.js +3 -6
  12. package/dist/cjs/plugins/table/ui/common-styles.js +12 -4
  13. package/dist/cjs/plugins/table/ui/consts.js +3 -1
  14. package/dist/cjs/plugins/table/ui/ui-styles.js +16 -7
  15. package/dist/cjs/version.json +1 -1
  16. package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +2 -1
  17. package/dist/es2019/plugins/table/nodeviews/TableComponent.js +6 -6
  18. package/dist/es2019/plugins/table/nodeviews/TableContainer.js +1 -1
  19. package/dist/es2019/plugins/table/nodeviews/TableResizer.js +3 -1
  20. package/dist/es2019/plugins/table/pm-plugins/keymap.js +11 -11
  21. package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -1
  22. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +9 -1
  23. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -6
  24. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +18 -7
  25. package/dist/es2019/plugins/table/ui/FloatingInsertButton/InsertButton.js +3 -3
  26. package/dist/es2019/plugins/table/ui/common-styles.js +27 -9
  27. package/dist/es2019/plugins/table/ui/consts.js +1 -0
  28. package/dist/es2019/plugins/table/ui/ui-styles.js +51 -4
  29. package/dist/es2019/version.json +1 -1
  30. package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +2 -1
  31. package/dist/esm/plugins/table/nodeviews/TableComponent.js +6 -6
  32. package/dist/esm/plugins/table/nodeviews/TableContainer.js +1 -1
  33. package/dist/esm/plugins/table/nodeviews/TableResizer.js +3 -1
  34. package/dist/esm/plugins/table/pm-plugins/keymap.js +11 -11
  35. package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +4 -1
  36. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +11 -1
  37. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/misc.js +1 -6
  38. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +22 -9
  39. package/dist/esm/plugins/table/ui/FloatingInsertButton/InsertButton.js +3 -3
  40. package/dist/esm/plugins/table/ui/common-styles.js +12 -4
  41. package/dist/esm/plugins/table/ui/consts.js +1 -0
  42. package/dist/esm/plugins/table/ui/ui-styles.js +17 -8
  43. package/dist/esm/version.json +1 -1
  44. package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +5 -4
  45. package/dist/types/plugins/table/pm-plugins/keymap.d.ts +2 -2
  46. package/dist/types/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
  47. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +8 -1
  48. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +5 -5
  49. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +5 -5
  50. package/dist/types/plugins/table/types.d.ts +8 -8
  51. package/dist/types/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +3 -2
  52. package/dist/types/plugins/table/ui/consts.d.ts +1 -0
  53. package/dist/types/plugins/table/ui/ui-styles.d.ts +1 -1
  54. package/dist/types/plugins/table/utils/decoration.d.ts +6 -4
  55. package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +5 -4
  56. package/dist/types-ts4.5/plugins/table/pm-plugins/keymap.d.ts +2 -2
  57. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/event-handlers.d.ts +1 -1
  58. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/colgroup.d.ts +8 -1
  59. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/misc.d.ts +5 -5
  60. package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/resize-state.d.ts +5 -5
  61. package/dist/types-ts4.5/plugins/table/types.d.ts +8 -8
  62. package/dist/types-ts4.5/plugins/table/ui/FloatingInsertButton/InsertButton.d.ts +3 -2
  63. package/dist/types-ts4.5/plugins/table/ui/consts.d.ts +1 -0
  64. package/dist/types-ts4.5/plugins/table/ui/ui-styles.d.ts +1 -1
  65. package/dist/types-ts4.5/plugins/table/utils/decoration.d.ts +6 -4
  66. package/package.json +2 -2
  67. package/report.api.md +1 -1
  68. package/src/__tests__/unit/pm-plugins/table-resizing/colgroup.ts +157 -61
  69. package/src/plugins/table/nodeviews/OverflowShadowsObserver.ts +5 -1
  70. package/src/plugins/table/nodeviews/TableComponent.tsx +16 -15
  71. package/src/plugins/table/nodeviews/TableContainer.tsx +1 -1
  72. package/src/plugins/table/nodeviews/TableResizer.tsx +3 -2
  73. package/src/plugins/table/nodeviews/update-overflow-shadows.ts +0 -1
  74. package/src/plugins/table/pm-plugins/keymap.ts +36 -27
  75. package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +18 -9
  76. package/src/plugins/table/pm-plugins/table-resizing/utils/colgroup.ts +17 -8
  77. package/src/plugins/table/pm-plugins/table-resizing/utils/misc.ts +9 -13
  78. package/src/plugins/table/pm-plugins/table-resizing/utils/resize-state.ts +34 -17
  79. package/src/plugins/table/types.ts +8 -8
  80. package/src/plugins/table/ui/FloatingInsertButton/InsertButton.tsx +11 -5
  81. package/src/plugins/table/ui/common-styles.ts +28 -9
  82. package/src/plugins/table/ui/consts.ts +1 -0
  83. package/src/plugins/table/ui/ui-styles.ts +59 -4
  84. package/src/plugins/table/utils/decoration.ts +8 -11
  85. package/tmp/api-report-tmp.d.ts +1 -1
@@ -9,11 +9,12 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
9
9
  var _react = require("@emotion/react");
10
10
  var _styles = require("@atlaskit/editor-common/styles");
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _colors = require("@atlaskit/theme/colors");
13
14
  var _constants = require("@atlaskit/theme/constants");
14
15
  var _types = require("../types");
15
16
  var _consts = require("./consts");
16
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21;
17
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23;
17
18
  var InsertLine = function InsertLine(props, cssString) {
18
19
  return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n background: ", ";\n display: none;\n position: absolute;\n z-index: ", ";\n ", "\n }\n"])), _types.TableCssClassName.CONTROLS_INSERT_LINE, (0, _consts.tableBorderSelectedColor)(props), _editorSharedStyles.akEditorUnitZIndex, cssString);
19
20
  };
@@ -62,7 +63,7 @@ var DeleteButton = function DeleteButton(props) {
62
63
  };
63
64
  exports.DeleteButton = DeleteButton;
64
65
  var OverflowShadow = function OverflowShadow(props) {
65
- return (0, _react.css)(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n .", ", .", " {\n display: block;\n height: calc(100% - ", "px);\n position: absolute;\n pointer-events: none;\n top: ", "px;\n z-index: ", ";\n width: 8px;\n }\n .", " {\n background: linear-gradient(\n to left,\n transparent 0,\n ", " 100%\n ),\n linear-gradient(\n to right,\n ", " 0px,\n transparent 1px\n );\n left: 0px;\n }\n .", "[data-number-column='true'] > :not(.", ").", " {\n left: ", "px;\n }\n .", " {\n background: linear-gradient(\n to right,\n transparent 0,\n ", " 100%\n ),\n linear-gradient(\n to left,\n ", " 0px,\n transparent 1px\n );\n left: calc(100% + 2px);\n }\n\n .", " {\n .", ", .", " {\n height: calc(100% - ", "px);\n top: ", "px;\n }\n .", " {\n border-left: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.TABLE_LEFT_SHADOW, _styles.tableMarginTop, _styles.tableMarginTop, _editorSharedStyles.akEditorShadowZIndex, _types.TableCssClassName.TABLE_LEFT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(_colors.N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.TABLE_STICKY_SHADOW, _types.TableCssClassName.TABLE_LEFT_SHADOW, _editorSharedStyles.akEditorTableNumberColumnWidth - 1, _types.TableCssClassName.TABLE_RIGHT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(_colors.N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.TABLE_LEFT_SHADOW, _styles.tableMarginTopWithControl, _styles.tableMarginTopWithControl, _types.TableCssClassName.TABLE_LEFT_SHADOW, (0, _consts.tableBorderColor)(props));
66
+ return (0, _react.css)(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n .", ", .", " {\n display: block;\n height: calc(100% - ", "px);\n position: absolute;\n pointer-events: none;\n top: ", "px;\n z-index: ", ";\n width: ", "px;\n }\n .", " {\n background: linear-gradient(\n to left,\n transparent 0,\n ", " 100%\n ),\n linear-gradient(\n to right,\n ", " 0px,\n transparent 1px\n );\n left: 0px;\n }\n .", "[data-number-column='true'] > :not(.", ").", " {\n left: ", "px;\n }\n .", " {\n background: linear-gradient(\n to right,\n transparent 0,\n ", " 100%\n ),\n linear-gradient(\n to left,\n ", " 0px,\n transparent 1px\n );\n left: ", ";\n }\n .", " {\n .", ", .", " {\n height: calc(100% - ", "px);\n top: ", "px;\n }\n .", " {\n border-left: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.TABLE_LEFT_SHADOW, _styles.tableMarginTop, _styles.tableMarginTop, _editorSharedStyles.akEditorShadowZIndex, _consts.tableOverflowShadowWidth, _types.TableCssClassName.TABLE_LEFT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(_colors.N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.TABLE_STICKY_SHADOW, _types.TableCssClassName.TABLE_LEFT_SHADOW, _editorSharedStyles.akEditorTableNumberColumnWidth - 1, _types.TableCssClassName.TABLE_RIGHT_SHADOW, "var(--ds-shadow-overflow-spread, ".concat(_colors.N40A, ")"), "var(--ds-shadow-overflow-perimeter, transparent)", (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? "calc(100% - ".concat(_consts.tableOverflowShadowWidth, "px)") : 'calc(100% + 2px)', _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.TABLE_RIGHT_SHADOW, _types.TableCssClassName.TABLE_LEFT_SHADOW, _styles.tableMarginTopWithControl, _styles.tableMarginTopWithControl, _types.TableCssClassName.TABLE_LEFT_SHADOW, (0, _consts.tableBorderColor)(props));
66
67
  };
67
68
  exports.OverflowShadow = OverflowShadow;
68
69
  var columnHeaderButton = function columnHeaderButton(props, cssString) {
@@ -71,21 +72,29 @@ var columnHeaderButton = function columnHeaderButton(props, cssString) {
71
72
  var columnHeaderButtonSelected = function columnHeaderButtonSelected(props) {
72
73
  return (0, _react.css)(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n background-color: ", ";\n border-color: ", ";\n z-index: ", ";\n"])), "var(--ds-text-inverse, ".concat(_colors.N0, ")"), (0, _consts.tableToolbarSelectedColor)(props), (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsSelectedZIndex);
73
74
  };
75
+ var getFloatingDotOverrides = function getFloatingDotOverrides(props) {
76
+ return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n tr\n th:last-child\n .", "::before,\n tr\n td:last-child\n .", "::before {\n content: '';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: ", ";\n right: 0px;\n }\n "])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, "var(--ds-space-025, 2px)") : '';
77
+ };
74
78
  var columnControlsDecoration = function columnControlsDecoration(props) {
75
- return (0, _react.css)(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: calc(100% + ", "px);\n left: -1px;\n top: -", "px;\n height: ", "px;\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table\n tr:first-of-type\n td.", ",\n table\n tr:first-of-type\n th.", " {\n &.", ",\n &.", ",\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border: 1px solid ", ";\n border-bottom: none;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n"])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _styles.tableCellBorderWidth * 2, _consts.columnControlsDecorationHeight + _styles.tableCellBorderWidth, _consts.columnControlsDecorationHeight, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n border-bottom: none;\n height: ").concat(_consts.tableToolbarSize, "px;\n width: 100%;\n position: absolute;\n top: ").concat(_consts.columnControlsDecorationHeight - _consts.tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(_consts.columnControlsZIndex, ";\n ")), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.HOVERED_TABLE, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableToolbarDeleteColor)(props), (0, _consts.tableBorderDeleteColor)(props), _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
79
+ return (0, _react.css)(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n display: none;\n cursor: pointer;\n position: absolute;\n width: calc(100% + ", "px);\n left: -1px;\n top: -", "px;\n height: ", "px;\n // floating dot for adding column button\n &::before {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: 2px;\n right: -1px;\n }\n\n &::after {\n content: ' ';\n\n ", "\n }\n }\n\n // floating dot for adding column button - overriding style on last column to avoid scroll\n ", "\n\n div.", ">.", "::after {\n content: ' ';\n background-color: ", ";\n position: absolute;\n height: ", "px;\n width: ", "px;\n border-radius: 50%;\n pointer-events: none;\n top: -", "px;\n right: -1px;\n }\n\n .", " .", " {\n display: block;\n }\n\n table\n tr:first-of-type\n td.", ",\n table\n tr:first-of-type\n th.", " {\n &.", ",\n &.", ",\n &.", " {\n .", "::after {\n ", ";\n }\n\n &.", "\n .", "::after {\n background-color: ", ";\n border: 1px solid ", ";\n border-bottom: none;\n z-index: ", ";\n }\n }\n }\n\n .", "\n table\n tr:first-of-type\n td.", ",\n .", "\n table\n tr:first-of-type\n th.", " {\n .", "::after {\n ", ";\n }\n }\n"])), _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _styles.tableCellBorderWidth * 2, _consts.columnControlsDecorationHeight + _styles.tableCellBorderWidth, _consts.columnControlsDecorationHeight, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, columnHeaderButton(props, "\n border-right: ".concat(_styles.tableCellBorderWidth, "px solid ").concat((0, _consts.tableBorderColor)(props), ";\n border-bottom: none;\n height: ").concat(_consts.tableToolbarSize, "px;\n width: 100%;\n position: absolute;\n top: ").concat(_consts.columnControlsDecorationHeight - _consts.tableToolbarSize, "px;\n left: 0px;\n z-index: ").concat(_consts.columnControlsZIndex, ";\n ")), getFloatingDotOverrides(props), _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.ROW_CONTROLS_WRAPPER, (0, _consts.tableBorderColor)(props), _consts.lineMarkerSize, _consts.lineMarkerSize, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_CONTROLS, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_COLUMN, _types.TableCssClassName.HOVERED_TABLE, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props), _types.TableCssClassName.HOVERED_CELL_IN_DANGER, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, (0, _consts.tableToolbarDeleteColor)(props), (0, _consts.tableBorderDeleteColor)(props), _editorSharedStyles.akEditorUnitZIndex * 100, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_CELL, _types.TableCssClassName.TABLE_SELECTED, _types.TableCssClassName.TABLE_HEADER_CELL, _types.TableCssClassName.COLUMN_CONTROLS_DECORATIONS, columnHeaderButtonSelected(props));
76
80
  };
77
81
  exports.columnControlsDecoration = columnControlsDecoration;
78
82
  var hoveredDeleteButton = function hoveredDeleteButton(props) {
79
- return (0, _react.css)(_templateObject18 || (_templateObject18 = (0, _taggedTemplateLiteral2.default)(["\n .", ".", " {\n .", ",\n .", ",\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_CELL, (0, _consts.tableBorderDeleteColor)(props), _types.TableCssClassName.SELECTED_CELL, (0, _consts.tableCellDeleteColor)(props));
83
+ return (0, _react.css)(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2.default)(["\n .", ".", " {\n .", ",\n .", ",\n .", " {\n border: 1px solid ", ";\n }\n .", "::after {\n background: ", ";\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.SELECTED_CELL, _types.TableCssClassName.COLUMN_SELECTED, _types.TableCssClassName.HOVERED_CELL, (0, _consts.tableBorderDeleteColor)(props), _types.TableCssClassName.SELECTED_CELL, (0, _consts.tableCellDeleteColor)(props));
80
84
  };
81
85
  exports.hoveredDeleteButton = hoveredDeleteButton;
82
86
  var hoveredCell = function hoveredCell(props) {
83
- return (0, _react.css)(_templateObject19 || (_templateObject19 = (0, _taggedTemplateLiteral2.default)(["\n :not(.", ")\n .", ":not(.", ") {\n .", " {\n position: relative;\n border: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL, (0, _consts.tableBorderSelectedColor)(props));
87
+ return (0, _react.css)(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["\n :not(.", ")\n .", ":not(.", ") {\n .", " {\n position: relative;\n border: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL, (0, _consts.tableBorderSelectedColor)(props));
84
88
  };
85
89
  exports.hoveredCell = hoveredCell;
86
- var hoveredWarningCell = (0, _react.css)(_templateObject20 || (_templateObject20 = (0, _taggedTemplateLiteral2.default)(["\n :not(.", ")\n .", ":not(.", ") {\n td.", " {\n background-color: ", " !important; // We need to override the background-color added to the cell\n border: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL_WARNING, "var(--ds-background-warning, ".concat(_colors.Y50, ")"), "var(--ds-border-warning, ".concat(_colors.Y200, ")"));
90
+ var hoveredWarningCell = (0, _react.css)(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2.default)(["\n :not(.", ")\n .", ":not(.", ") {\n td.", " {\n background-color: ", " !important; // We need to override the background-color added to the cell\n border: 1px solid ", ";\n }\n }\n"])), _types.TableCssClassName.IS_RESIZING, _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.HOVERED_DELETE_BUTTON, _types.TableCssClassName.HOVERED_CELL_WARNING, "var(--ds-background-warning, ".concat(_colors.Y50, ")"), "var(--ds-border-warning, ".concat(_colors.Y200, ")"));
91
+
92
+ // move the resize handle zone completely inside the table cell to avoid overflow
87
93
  exports.hoveredWarningCell = hoveredWarningCell;
94
+ var getLastColumnResizerOverrides = function getLastColumnResizerOverrides() {
95
+ return (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? (0, _react.css)(_templateObject22 || (_templateObject22 = (0, _taggedTemplateLiteral2.default)(["\n tr\n th:last-child\n .", ",\n tr\n td:last-child\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: 0;\n cursor: col-resize;\n z-index: ", ";\n }\n "])), _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.resizeHandlerAreaWidth, _consts.resizeHandlerZIndex) : '';
96
+ };
88
97
  var resizeHandle = function resizeHandle(props) {
89
- return (0, _react.css)(_templateObject21 || (_templateObject21 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: -", "px;\n cursor: col-resize;\n z-index: ", ";\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: -2px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: -2px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n table\n tr:first-of-type\n th.", "\n .", "::after,\n table\n tr:first-of-type\n td.", "\n .", "::after {\n top: -", "px;\n height: calc(100% + ", "px);\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.resizeHandlerAreaWidth, _consts.resizeHandlerAreaWidth / 2, _consts.resizeHandlerZIndex, _types.TableCssClassName.WITH_RESIZE_LINE, _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_RESIZE_LINE, _consts.resizeLineWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _consts.resizeLineWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth);
98
+ return (0, _react.css)(_templateObject23 || (_templateObject23 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n .", " {\n background-color: transparent;\n position: absolute;\n width: ", "px;\n height: 100%;\n top: 0;\n right: -", "px;\n cursor: col-resize;\n z-index: ", ";\n }\n\n ", "\n\n td.", "::before {\n content: ' ';\n position: absolute;\n left: -2px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n left: -2px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n td.", "::before {\n content: ' ';\n position: absolute;\n right: -1px;\n top: -1px;\n width: ", "px;\n height: calc(100% + 2px);\n background-color: ", ";\n z-index: ", ";\n }\n\n th.", "::before {\n content: ' ';\n right: -1px;\n position: absolute;\n width: ", "px;\n height: calc(100% + ", "px);\n background-color: ", ";\n z-index: ", ";\n top: -", "px;\n }\n\n table\n tr:first-of-type\n th.", "\n .", "::after,\n table\n tr:first-of-type\n td.", "\n .", "::after {\n top: -", "px;\n height: calc(100% + ", "px);\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.resizeHandlerAreaWidth, _consts.resizeHandlerAreaWidth / 2, _consts.resizeHandlerZIndex, getLastColumnResizerOverrides(), _types.TableCssClassName.WITH_RESIZE_LINE, _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_RESIZE_LINE, _consts.resizeLineWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _consts.resizeLineWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _types.TableCssClassName.WITH_RESIZE_LINE_LAST_COLUMN, _consts.resizeLineWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth, (0, _consts.tableBorderSelectedColor)(props), _consts.columnControlsZIndex * 2, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _types.TableCssClassName.WITH_RESIZE_LINE, _types.TableCssClassName.RESIZE_HANDLE_DECORATION, _consts.tableToolbarSize + _styles.tableCellBorderWidth, _consts.tableToolbarSize + _styles.tableCellBorderWidth);
90
99
  };
91
100
  exports.resizeHandle = resizeHandle;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.8.5",
3
+ "version": "2.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,4 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
2
3
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
3
4
  import { tableInsertColumnButtonSize } from '../ui/consts';
4
5
  import { updateShadowListForStickyStyles } from './update-overflow-shadows';
@@ -28,7 +29,7 @@ export class OverflowShadowsObserver {
28
29
  }, {
29
30
  threshold: [0, 1],
30
31
  root: this.wrapper,
31
- rootMargin: `0px ${tableInsertColumnButtonSize / 2}px 0px 0px`
32
+ rootMargin: getBooleanFF('platform.editor.custom-table-width') ? '0px' : `0px ${tableInsertColumnButtonSize / 2}px 0px 0px`
32
33
  });
33
34
  return;
34
35
  }
@@ -8,6 +8,7 @@ import { tableMarginSides } from '@atlaskit/editor-common/styles';
8
8
  import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
9
9
  import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
10
10
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
11
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
12
  import { autoSizeTable, clearHoverSelection } from '../commands';
12
13
  import { getPluginState } from '../pm-plugins/plugin-factory';
13
14
  import { findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from '../pm-plugins/sticky-headers';
@@ -15,6 +16,7 @@ import { getLayoutSize, insertColgroupFromNode as recreateResizeColsByNode, scal
15
16
  import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup';
16
17
  import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
17
18
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
19
+ import { tableOverflowShadowWidth } from '../ui/consts';
18
20
  import TableFloatingControls from '../ui/TableFloatingControls';
19
21
  import { containsHeaderRow, isTableNested, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns } from '../utils';
20
22
  import { OverflowShadowsObserver } from './OverflowShadowsObserver';
@@ -126,8 +128,7 @@ class TableComponent extends React.Component {
126
128
  if (shouldScaleTable) {
127
129
  this.scaleTable({
128
130
  parentWidth,
129
- layoutChanged,
130
- isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled
131
+ layoutChanged
131
132
  });
132
133
  }
133
134
 
@@ -135,9 +136,8 @@ class TableComponent extends React.Component {
135
136
  if (options !== null && options !== void 0 && options.isTableResizingEnabled && hasNumberedColumnChanged) {
136
137
  if (!hasTableBeenResized(prevNode)) {
137
138
  this.scaleTable({
138
- parentWidth,
139
- layoutChanged,
140
- isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled
139
+ parentWidth: node.attrs.width,
140
+ layoutChanged
141
141
  });
142
142
  }
143
143
  }
@@ -501,7 +501,7 @@ class TableComponent extends React.Component {
501
501
  }), this.state.stickyHeader && /*#__PURE__*/React.createElement("div", {
502
502
  style: {
503
503
  position: 'absolute',
504
- right: '-2px'
504
+ right: getBooleanFF('platform.editor.custom-table-width') ? `${tableOverflowShadowWidth}px` : '-2px'
505
505
  }
506
506
  }, /*#__PURE__*/React.createElement("div", {
507
507
  className: `${ClassName.TABLE_RIGHT_SHADOW} ${ClassName.TABLE_STICKY_SHADOW}`,
@@ -126,7 +126,7 @@ export const TableContainer = ({
126
126
  return /*#__PURE__*/React.createElement(InnerContainer, {
127
127
  node: node,
128
128
  className: classNames(className, {
129
- 'less-padding': editorWidth < akEditorMobileBreakoutPoint
129
+ 'less-padding': editorWidth < akEditorMobileBreakoutPoint && !isNested
130
130
  }),
131
131
  style: {
132
132
  width: tableWidth,
@@ -36,7 +36,9 @@ const getResizerHandleHeight = tableRef => {
36
36
  const getResizerMinWidth = node => {
37
37
  const currentColumnCount = getColgroupChildrenLength(node);
38
38
  const minColumnWidth = currentColumnCount <= 3 ? currentColumnCount * COLUMN_MIN_WIDTH : 3 * COLUMN_MIN_WIDTH;
39
- return minColumnWidth;
39
+ // add an extra pixel as the scale table logic will scale columns to be tableContainerWidth - 1
40
+ // the table can't scale past its min-width, so instead restrict table container min width to avoid that situation
41
+ return minColumnWidth + 1;
40
42
  };
41
43
  export const TableResizer = ({
42
44
  children,
@@ -1,10 +1,10 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
- import * as keymaps from '@atlaskit/editor-common/keymaps';
2
+ import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, backspace, bindKeymapWithCommand, nextCell, previousCell, toggleTable } from '@atlaskit/editor-common/keymaps';
3
3
  import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
4
4
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
5
5
  import { createTable, goToNextCell, moveCursorBackward, triggerUnlessTableHeader } from '../commands';
6
6
  import { addRowAroundSelection, deleteTableIfSelectedWithAnalytics, emptyMultipleCellsWithAnalytics } from '../commands-with-analytics';
7
- import { addColumnAfter, addColumnBefore } from '../commands/insert';
7
+ import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand } from '../commands/insert';
8
8
  import { withEditorAnalyticsAPI } from '../utils/analytics';
9
9
  const createTableWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI({
10
10
  action: ACTION.INSERTED,
@@ -17,17 +17,17 @@ const createTableWithAnalytics = editorAnalyticsAPI => withEditorAnalyticsAPI({
17
17
  })(editorAnalyticsAPI)(createTable());
18
18
  export function keymapPlugin(getEditorContainerWidth, editorAnalyticsAPI) {
19
19
  const list = {};
20
- keymaps.bindKeymapWithCommand(keymaps.nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
21
- keymaps.bindKeymapWithCommand(keymaps.previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
22
- keymaps.bindKeymapWithCommand(keymaps.toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
23
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
24
- keymaps.bindKeymapWithCommand(keymaps.backspace.common, moveCursorBackward, list);
20
+ bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI)(1), list);
21
+ bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI)(-1), list);
22
+ bindKeymapWithCommand(toggleTable.common, createTableWithAnalytics(editorAnalyticsAPI), list);
23
+ bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
24
+ bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
25
25
 
26
26
  // Add row/column shortcuts
27
- keymaps.bindKeymapWithCommand(keymaps.addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
28
- keymaps.bindKeymapWithCommand(keymaps.addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
29
- keymaps.bindKeymapWithCommand(keymaps.addColumnBefore.common, triggerUnlessTableHeader(addColumnBefore(getEditorContainerWidth)), list);
30
- keymaps.bindKeymapWithCommand(keymaps.addColumnAfter.common, addColumnAfter(getEditorContainerWidth), list);
27
+ bindKeymapWithCommand(addRowBefore.common, addRowAroundSelection(editorAnalyticsAPI)('TOP'), list);
28
+ bindKeymapWithCommand(addRowAfter.common, addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'), list);
29
+ bindKeymapWithCommand(addColumnBefore.common, triggerUnlessTableHeader(addColumnBeforeCommand(getEditorContainerWidth)), list);
30
+ bindKeymapWithCommand(addColumnAfter.common, addColumnAfterCommand(getEditorContainerWidth), list);
31
31
  return keymap(list);
32
32
  }
33
33
  export default keymapPlugin;
@@ -4,6 +4,7 @@ import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
4
4
  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
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
7
8
  import { updateColumnWidths } from '../../transforms';
8
9
  import { getSelectedColumnIndexes, updateResizeHandles } from '../../utils';
9
10
  import { evenColumns, setDragging, stopResizing } from './commands';
@@ -31,7 +32,9 @@ export const handleMouseDown = (view, event, localResizeHandlePos, getEditorCont
31
32
  }
32
33
  const containerWidth = getEditorContainerWidth();
33
34
  const parentWidth = getParentNodeWidth(start, state, containerWidth);
34
- let maxSize = parentWidth || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {});
35
+ let maxSize = getBooleanFF('platform.editor.custom-table-width') ? parentWidth ||
36
+ // its safe to reference table width from node as this will not have changed
37
+ originalTable.attrs.width || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {}) : parentWidth || getLayoutSize(dom.getAttribute('data-layout'), containerWidth.width, {});
35
38
  if (originalTable.attrs.isNumberColumnEnabled) {
36
39
  maxSize -= akEditorTableNumberColumnWidth;
37
40
  }
@@ -3,9 +3,17 @@ import { getFragmentBackingArray } from '@atlaskit/editor-common/utils';
3
3
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
4
4
  import { TableMap } from '@atlaskit/editor-tables/table-map';
5
5
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
6
+ /**
7
+ * This ensures the combined width of the columns (and tbody) of table is always smaller or equal
8
+ * than the table and table wrapper elements. This is necessary as there is no longer
9
+ * padding on the .pm-table-wrapper, so all elements need to be the same width to avoid
10
+ * overflow.
11
+ */
12
+ export const getColWidthFix = (colwidth, tableColumnCount) => colwidth - 1 / tableColumnCount;
6
13
  export const generateColgroup = table => {
7
14
  const cols = [];
8
15
  if (getBooleanFF('platform.editor.custom-table-width')) {
16
+ const map = TableMap.get(table);
9
17
  table.content.firstChild.content.forEach(cell => {
10
18
  const colspan = cell.attrs.colspan || 1;
11
19
  if (Array.isArray(cell.attrs.colwidth)) {
@@ -13,7 +21,7 @@ export const generateColgroup = table => {
13
21
  // Than the we actually span. We'll patch the document at a later point.
14
22
  cell.attrs.colwidth.slice(0, colspan).forEach(width => {
15
23
  cols.push(['col', {
16
- style: `width: ${width ? Math.max(width, tableCellMinWidth) : tableCellMinWidth}px;`
24
+ style: `width: ${getColWidthFix(width ? Math.max(width, tableCellMinWidth) : tableCellMinWidth, map.width)}px;`
17
25
  }]);
18
26
  });
19
27
  } else {
@@ -66,12 +66,7 @@ export const getTableMaxWidth = ({
66
66
  }) => {
67
67
  const containerWidth = getEditorContainerWidth();
68
68
  const parentWidth = getParentNodeWidth(tableStart, state, containerWidth);
69
- let maxWidth;
70
- if (getBooleanFF('platform.editor.custom-table-width')) {
71
- maxWidth = parentWidth || table.attrs.width || getLayoutSize(layout, containerWidth.width, {});
72
- } else {
73
- maxWidth = parentWidth || getLayoutSize(layout, containerWidth.width, {});
74
- }
69
+ let maxWidth = getBooleanFF('platform.editor.custom-table-width') ? parentWidth || table.attrs.width || getLayoutSize(layout, containerWidth.width, {}) : parentWidth || getLayoutSize(layout, containerWidth.width, {});
75
70
  if (table.attrs.isNumberColumnEnabled) {
76
71
  maxWidth -= akEditorTableNumberColumnWidth;
77
72
  }
@@ -1,7 +1,8 @@
1
1
  import { tableCellMinWidth, tableNewColumnMinWidth } from '@atlaskit/editor-common/styles';
2
2
  import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
3
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
3
4
  import { getSelectedTableInfo } from '../../../utils';
4
- import { hasTableBeenResized, insertColgroupFromNode } from './colgroup';
5
+ import { getColWidthFix, hasTableBeenResized, insertColgroupFromNode } from './colgroup';
5
6
  import { getCellsRefsInColumn, getColumnStateFromDOM } from './column-state';
6
7
  import { syncStickyRowToTable } from './dom';
7
8
  import { getTableMaxWidth } from './misc';
@@ -52,12 +53,22 @@ export const getResizeState = ({
52
53
  // updates Colgroup DOM node with new widths
53
54
  export const updateColgroup = (state, tableRef) => {
54
55
  const cols = tableRef.querySelectorAll('col');
55
- state.cols.filter(column => column && !!column.width) // if width is 0, we dont want to apply that.
56
- .forEach((column, i) => {
57
- if (cols[i]) {
58
- cols[i].style.width = `${column.width}px`;
59
- }
60
- });
56
+ if (getBooleanFF('platform.editor.custom-table-width')) {
57
+ const columnsCount = cols.length;
58
+ state.cols.filter(column => column && !!column.width) // if width is 0, we dont want to apply that.
59
+ .forEach((column, i) => {
60
+ if (cols[i]) {
61
+ cols[i].style.width = `${getColWidthFix(column.width, columnsCount)}px`;
62
+ }
63
+ });
64
+ } else {
65
+ state.cols.filter(column => column && !!column.width) // if width is 0, we dont want to apply that.
66
+ .forEach((column, i) => {
67
+ if (cols[i]) {
68
+ cols[i].style.width = `${column.width}px`;
69
+ }
70
+ });
71
+ }
61
72
 
62
73
  // colgroup has updated, reflect new widths in sticky header
63
74
  syncStickyRowToTable(tableRef);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { injectIntl } from 'react-intl-next';
3
- import * as keymaps from '@atlaskit/editor-common/keymaps';
3
+ import { addColumnAfter, addRowAfter, ToolTipContent } from '@atlaskit/editor-common/keymaps';
4
4
  import { tableMarginTop } from '@atlaskit/editor-common/styles';
5
5
  import { closestElement } from '@atlaskit/editor-common/utils';
6
6
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
@@ -53,9 +53,9 @@ const InsertButton = ({
53
53
  hasStickyHeaders
54
54
  }) => {
55
55
  const content = /*#__PURE__*/React.createElement(Tooltip, {
56
- content: /*#__PURE__*/React.createElement(keymaps.ToolTipContent, {
56
+ content: /*#__PURE__*/React.createElement(ToolTipContent, {
57
57
  description: formatMessage(tooltipMessageByType(type)),
58
- keymap: type === 'row' ? keymaps.addRowAfter : keymaps.addColumnAfter
58
+ keymap: type === 'row' ? addRowAfter : addColumnAfter
59
59
  }),
60
60
  position: "top"
61
61
  }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
@@ -2,6 +2,7 @@ import { css } from '@emotion/react';
2
2
  import { tableMarginTop, tableSharedStyle } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorSelectedNodeClassName, akEditorSmallZIndex, akEditorStickyHeaderZIndex, akEditorTableCellOnStickyHeaderZIndex, akEditorTableNumberColumnWidth, akEditorTableToolbarSize, akEditorUnitZIndex, getSelectionStyles, relativeFontSizeToBase16, SelectionStyle } from '@atlaskit/editor-shared-styles';
4
4
  import { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
5
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
5
6
  import { B300, N0, N20A, N300, N40A, R500 } from '@atlaskit/theme/colors';
6
7
  import { fontSize } from '@atlaskit/theme/constants';
7
8
  import { TableCssClassName as ClassName } from '../types';
@@ -88,6 +89,31 @@ const breakoutWidthStyling = () => {
88
89
  }
89
90
  `;
90
91
  };
92
+ const tableWrapperStyles = () => {
93
+ if (getBooleanFF('platform.editor.custom-table-width')) {
94
+ return css`
95
+ .${ClassName.TABLE_NODE_WRAPPER} {
96
+ padding-bottom: 0px;
97
+ /* fixes gap cursor height */
98
+ overflow: auto;
99
+ overflow-y: hidden;
100
+ position: relative;
101
+ }
102
+ `;
103
+ } else {
104
+ return css`
105
+ .${ClassName.TABLE_NODE_WRAPPER} {
106
+ padding-right: ${insertColumnButtonOffset}px;
107
+ margin-right: -${insertColumnButtonOffset}px;
108
+ padding-bottom: 0px;
109
+ /* fixes gap cursor height */
110
+ overflow: auto;
111
+ overflow-y: hidden;
112
+ position: relative;
113
+ }
114
+ `;
115
+ }
116
+ };
91
117
 
92
118
  // TODO: https://product-fabric.atlassian.net/browse/DSP-4139
93
119
  export const tableStyles = props => {
@@ -658,15 +684,7 @@ export const tableStyles = props => {
658
684
  .${ClassName.ROW_CONTROLS_WRAPPER} {
659
685
  left: -${tableToolbarSize}px;
660
686
  }
661
- .${ClassName.TABLE_NODE_WRAPPER} {
662
- padding-right: ${insertColumnButtonOffset}px;
663
- margin-right: -${insertColumnButtonOffset}px;
664
- padding-bottom: 0px;
665
- /* fixes gap cursor height */
666
- overflow: auto;
667
- overflow-y: hidden;
668
- position: relative;
669
- }
687
+ ${tableWrapperStyles()}
670
688
  }
671
689
 
672
690
  .ProseMirror.${ClassName.IS_RESIZING} {
@@ -97,6 +97,7 @@ export const contextualMenuDropdownWidth = 180;
97
97
  export const stickyRowZIndex = resizeHandlerZIndex + 2;
98
98
  export const stickyRowOffsetTop = 8;
99
99
  export const stickyHeaderBorderBottomWidth = 1;
100
+ export const tableOverflowShadowWidth = 8;
100
101
  export const TABLE_SNAP_GAP = 9;
101
102
  export const TABLE_HIGHLIGHT_GAP = 10;
102
103
  export const TABLE_HIGHLIGHT_TOLERANCE = 2;
@@ -1,10 +1,11 @@
1
1
  import { css } from '@emotion/react';
2
2
  import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
3
3
  import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
5
  import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
5
6
  import { borderRadius } from '@atlaskit/theme/constants';
6
7
  import { TableCssClassName as ClassName } from '../types';
7
- import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
8
+ import { columnControlsDecorationHeight, columnControlsSelectedZIndex, columnControlsZIndex, lineMarkerSize, resizeHandlerAreaWidth, resizeHandlerZIndex, resizeLineWidth, tableBorderColor, tableBorderDeleteColor, tableBorderSelectedColor, tableCellDeleteColor, tableCellHoverDeleteIconBackground, tableCellHoverDeleteIconColor, tableCellSelectedDeleteIconBackground, tableCellSelectedDeleteIconColor, tableDeleteButtonSize, tableHeaderCellBackgroundColor, tableInsertColumnButtonSize, tableOverflowShadowWidth, tableToolbarDeleteColor, tableToolbarSelectedColor, tableToolbarSize } from './consts';
8
9
  const InsertLine = (props, cssString) => css`
9
10
  .${ClassName.CONTROLS_INSERT_LINE} {
10
11
  background: ${tableBorderSelectedColor(props)};
@@ -186,7 +187,7 @@ export const OverflowShadow = props => css`
186
187
  pointer-events: none;
187
188
  top: ${tableMarginTop}px;
188
189
  z-index: ${akEditorShadowZIndex};
189
- width: 8px;
190
+ width: ${tableOverflowShadowWidth}px;
190
191
  }
191
192
  .${ClassName.TABLE_LEFT_SHADOW} {
192
193
  background: linear-gradient(
@@ -215,9 +216,8 @@ export const OverflowShadow = props => css`
215
216
  ${"var(--ds-shadow-overflow-perimeter, transparent)"} 0px,
216
217
  transparent 1px
217
218
  );
218
- left: calc(100% + 2px);
219
+ left: ${getBooleanFF('platform.editor.custom-table-width') ? `calc(100% - ${tableOverflowShadowWidth}px)` : 'calc(100% + 2px)'};
219
220
  }
220
-
221
221
  .${ClassName.WITH_CONTROLS} {
222
222
  .${ClassName.TABLE_RIGHT_SHADOW}, .${ClassName.TABLE_LEFT_SHADOW} {
223
223
  height: calc(100% - ${tableMarginTopWithControl}px);
@@ -247,6 +247,26 @@ const columnHeaderButtonSelected = props => css`
247
247
  border-color: ${tableBorderSelectedColor(props)};
248
248
  z-index: ${columnControlsSelectedZIndex};
249
249
  `;
250
+ const getFloatingDotOverrides = props => {
251
+ return getBooleanFF('platform.editor.custom-table-width') ? css`
252
+ tr
253
+ th:last-child
254
+ .${ClassName.COLUMN_CONTROLS_DECORATIONS}::before,
255
+ tr
256
+ td:last-child
257
+ .${ClassName.COLUMN_CONTROLS_DECORATIONS}::before {
258
+ content: '';
259
+ background-color: ${tableBorderColor(props)};
260
+ position: absolute;
261
+ height: ${lineMarkerSize}px;
262
+ width: ${lineMarkerSize}px;
263
+ border-radius: 50%;
264
+ pointer-events: none;
265
+ top: ${"var(--ds-space-025, 2px)"};
266
+ right: 0px;
267
+ }
268
+ ` : '';
269
+ };
250
270
  export const columnControlsDecoration = props => css`
251
271
  .${ClassName.COLUMN_CONTROLS_DECORATIONS} {
252
272
  display: none;
@@ -256,6 +276,7 @@ export const columnControlsDecoration = props => css`
256
276
  left: -1px;
257
277
  top: -${columnControlsDecorationHeight + tableCellBorderWidth}px;
258
278
  height: ${columnControlsDecorationHeight}px;
279
+ // floating dot for adding column button
259
280
  &::before {
260
281
  content: ' ';
261
282
  background-color: ${tableBorderColor(props)};
@@ -284,6 +305,9 @@ export const columnControlsDecoration = props => css`
284
305
  }
285
306
  }
286
307
 
308
+ // floating dot for adding column button - overriding style on last column to avoid scroll
309
+ ${getFloatingDotOverrides(props)}
310
+
287
311
  div.${ClassName.WITH_CONTROLS}>.${ClassName.ROW_CONTROLS_WRAPPER}::after {
288
312
  content: ' ';
289
313
  background-color: ${tableBorderColor(props)};
@@ -366,6 +390,27 @@ export const hoveredWarningCell = css`
366
390
  }
367
391
  }
368
392
  `;
393
+
394
+ // move the resize handle zone completely inside the table cell to avoid overflow
395
+ const getLastColumnResizerOverrides = () => {
396
+ return getBooleanFF('platform.editor.custom-table-width') ? css`
397
+ tr
398
+ th:last-child
399
+ .${ClassName.RESIZE_HANDLE_DECORATION},
400
+ tr
401
+ td:last-child
402
+ .${ClassName.RESIZE_HANDLE_DECORATION} {
403
+ background-color: transparent;
404
+ position: absolute;
405
+ width: ${resizeHandlerAreaWidth}px;
406
+ height: 100%;
407
+ top: 0;
408
+ right: 0;
409
+ cursor: col-resize;
410
+ z-index: ${resizeHandlerZIndex};
411
+ }
412
+ ` : '';
413
+ };
369
414
  export const resizeHandle = props => css`
370
415
  .${ClassName.TABLE_CONTAINER} {
371
416
  .${ClassName.RESIZE_HANDLE_DECORATION} {
@@ -379,6 +424,8 @@ export const resizeHandle = props => css`
379
424
  z-index: ${resizeHandlerZIndex};
380
425
  }
381
426
 
427
+ ${getLastColumnResizerOverrides()}
428
+
382
429
  td.${ClassName.WITH_RESIZE_LINE}::before {
383
430
  content: ' ';
384
431
  position: absolute;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "2.8.5",
3
+ "version": "2.9.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,6 +1,7 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/createClass";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
4
5
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
5
6
  import { tableInsertColumnButtonSize } from '../ui/consts';
6
7
  import { updateShadowListForStickyStyles } from './update-overflow-shadows';
@@ -34,7 +35,7 @@ export var OverflowShadowsObserver = /*#__PURE__*/function () {
34
35
  }, {
35
36
  threshold: [0, 1],
36
37
  root: _this.wrapper,
37
- rootMargin: "0px ".concat(tableInsertColumnButtonSize / 2, "px 0px 0px")
38
+ rootMargin: getBooleanFF('platform.editor.custom-table-width') ? '0px' : "0px ".concat(tableInsertColumnButtonSize / 2, "px 0px 0px")
38
39
  });
39
40
  return;
40
41
  }
@@ -18,6 +18,7 @@ import { tableMarginSides } from '@atlaskit/editor-common/styles';
18
18
  import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
19
19
  import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
20
20
  import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
21
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
21
22
  import { autoSizeTable, clearHoverSelection } from '../commands';
22
23
  import { getPluginState } from '../pm-plugins/plugin-factory';
23
24
  import { findStickyHeaderForTable, pluginKey as stickyHeadersPluginKey } from '../pm-plugins/sticky-headers';
@@ -25,6 +26,7 @@ import { getLayoutSize, insertColgroupFromNode as recreateResizeColsByNode, scal
25
26
  import { hasTableBeenResized } from '../pm-plugins/table-resizing/utils/colgroup';
26
27
  import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
27
28
  import { TableCssClassName as ClassName, ShadowEvent } from '../types';
29
+ import { tableOverflowShadowWidth } from '../ui/consts';
28
30
  import TableFloatingControls from '../ui/TableFloatingControls';
29
31
  import { containsHeaderRow, isTableNested, tablesHaveDifferentColumnWidths, tablesHaveDifferentNoOfColumns } from '../utils';
30
32
  import { OverflowShadowsObserver } from './OverflowShadowsObserver';
@@ -134,8 +136,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
134
136
  if (shouldScaleTable) {
135
137
  _this.scaleTable({
136
138
  parentWidth: parentWidth,
137
- layoutChanged: layoutChanged,
138
- isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled
139
+ layoutChanged: layoutChanged
139
140
  });
140
141
  }
141
142
 
@@ -143,9 +144,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
143
144
  if (options !== null && options !== void 0 && options.isTableResizingEnabled && hasNumberedColumnChanged) {
144
145
  if (!hasTableBeenResized(prevNode)) {
145
146
  _this.scaleTable({
146
- parentWidth: parentWidth,
147
- layoutChanged: layoutChanged,
148
- isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.isTableResizingEnabled
147
+ parentWidth: node.attrs.width,
148
+ layoutChanged: layoutChanged
149
149
  });
150
150
  }
151
151
  }
@@ -496,7 +496,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
496
496
  }), this.state.stickyHeader && /*#__PURE__*/React.createElement("div", {
497
497
  style: {
498
498
  position: 'absolute',
499
- right: '-2px'
499
+ right: getBooleanFF('platform.editor.custom-table-width') ? "".concat(tableOverflowShadowWidth, "px") : '-2px'
500
500
  }
501
501
  }, /*#__PURE__*/React.createElement("div", {
502
502
  className: "".concat(ClassName.TABLE_RIGHT_SHADOW, " ").concat(ClassName.TABLE_STICKY_SHADOW),
@@ -122,7 +122,7 @@ export var TableContainer = function TableContainer(_ref3) {
122
122
  return /*#__PURE__*/React.createElement(InnerContainer, {
123
123
  node: node,
124
124
  className: classNames(className, {
125
- 'less-padding': editorWidth < akEditorMobileBreakoutPoint
125
+ 'less-padding': editorWidth < akEditorMobileBreakoutPoint && !isNested
126
126
  }),
127
127
  style: {
128
128
  width: tableWidth,