@atlaskit/editor-plugin-table 7.25.5 → 7.25.6

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.25.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#130414](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130414)
8
+ [`eceafead51291`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eceafead51291) -
9
+ ED-24568 Adjusted table lazy loading DOM to match node view
10
+ - [#130331](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/130331)
11
+ [`8408c22cc75ef`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8408c22cc75ef) -
12
+ clean up live view sort table ff
13
+ - Updated dependencies
14
+
3
15
  ## 7.25.5
4
16
 
5
17
  ### Patch Changes
@@ -360,7 +360,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
360
360
  (0, _createClass2.default)(TableComponent, [{
361
361
  key: "componentDidMount",
362
362
  value: function componentDidMount() {
363
- var _this$table2;
363
+ var _this$props$pluginInj, _this$table2;
364
364
  var _this$props7 = this.props,
365
365
  allowColumnResizing = _this$props7.allowColumnResizing,
366
366
  eventDispatcher = _this$props7.eventDispatcher,
@@ -369,14 +369,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
369
369
  getNode = _this$props7.getNode,
370
370
  getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
371
371
  isTableScalingEnabled = _this$props7.isTableScalingEnabled;
372
- if ((0, _platformFeatureFlags.fg)('platform.editor.table.live-pages-sorting_4malx')) {
373
- var _this$props$pluginInj;
374
- var _ref = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || (_this$props$pluginInj = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.sharedState.currentState()) || {},
375
- mode = _ref.mode;
376
- if (mode === 'view') {
377
- var _this$table;
378
- this === null || this === void 0 || (_this$table = this.table) === null || _this$table === void 0 || _this$table.addEventListener('mouseenter', this.handleMouseEnter);
379
- }
372
+ var _ref = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || (_this$props$pluginInj = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.sharedState.currentState()) || {},
373
+ mode = _ref.mode;
374
+ if (mode === 'view') {
375
+ var _this$table;
376
+ this === null || this === void 0 || (_this$table = this.table) === null || _this$table === void 0 || _this$table.addEventListener('mouseenter', this.handleMouseEnter);
380
377
  }
381
378
  this === null || this === void 0 || (_this$table2 = this.table) === null || _this$table2 === void 0 || _this$table2.addEventListener('mouseout', this.handleMouseOut);
382
379
  if ((0, _platformFeatureFlags.fg)('platform_editor_react_18_table_column_resize_hover')) {
@@ -432,7 +429,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
432
429
  }, {
433
430
  key: "componentWillUnmount",
434
431
  value: function componentWillUnmount() {
435
- var _this$resizeObserver, _this$table5;
432
+ var _this$resizeObserver, _this$table4, _this$table5;
436
433
  var _this$props8 = this.props,
437
434
  allowColumnResizing = _this$props8.allowColumnResizing,
438
435
  eventDispatcher = _this$props8.eventDispatcher,
@@ -463,10 +460,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
463
460
  if (!(options !== null && options !== void 0 && options.isTableResizingEnabled) && allowColumnResizing) {
464
461
  window.removeEventListener('resize', this.handleWindowResizeDebounced);
465
462
  }
466
- if ((0, _platformFeatureFlags.fg)('platform.editor.table.live-pages-sorting_4malx')) {
467
- var _this$table4;
468
- this === null || this === void 0 || (_this$table4 = this.table) === null || _this$table4 === void 0 || _this$table4.removeEventListener('mouseenter', this.handleMouseEnter);
469
- }
463
+ this === null || this === void 0 || (_this$table4 = this.table) === null || _this$table4 === void 0 || _this$table4.removeEventListener('mouseenter', this.handleMouseEnter);
470
464
  this === null || this === void 0 || (_this$table5 = this.table) === null || _this$table5 === void 0 || _this$table5.removeEventListener('mouseout', this.handleMouseOut);
471
465
  if ((0, _platformFeatureFlags.fg)('platform_editor_react_18_table_column_resize_hover')) {
472
466
  var _this$table6;
@@ -145,7 +145,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
145
145
  name: 'table',
146
146
  node: (0, _toDOM.tableNodeSpecWithFixedToDOM)({
147
147
  allowColumnResizing: Boolean(allowColumnResizing),
148
- tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableResizingEnabled)
148
+ tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableResizingEnabled),
149
+ getEditorContainerWidth: defaultGetEditorContainerWidth
149
150
  })
150
151
  }, {
151
152
  name: 'tableHeader',
@@ -269,7 +270,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
269
270
  }, {
270
271
  name: 'tableViewModeSort',
271
272
  plugin: function plugin() {
272
- return api !== null && api !== void 0 && api.editorViewMode && (0, _platformFeatureFlags.fg)('platform.editor.table.live-pages-sorting_4malx') ? (0, _viewModeSort.createPlugin)(api.editorViewMode) : undefined;
273
+ return api !== null && api !== void 0 && api.editorViewMode ? (0, _viewModeSort.createPlugin)(api.editorViewMode) : undefined;
273
274
  }
274
275
  }, {
275
276
  name: 'tableLocalId',
package/dist/cjs/toDOM.js CHANGED
@@ -8,6 +8,7 @@ exports.tableNodeSpecWithFixedToDOM = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _adfSchema = require("@atlaskit/adf-schema");
11
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
11
12
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
13
  var _colgroup = require("./pm-plugins/table-resizing/utils/colgroup");
13
14
  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; }
@@ -18,12 +19,14 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
18
19
  }
19
20
  return _objectSpread(_objectSpread({}, _adfSchema.table), {}, {
20
21
  toDOM: function toDOM(node) {
22
+ var editorWidthFromGetter = Math.min(config.getEditorContainerWidth().width - (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2, node.attrs.width);
21
23
  var attrs = {
22
24
  'data-number-column': node.attrs.isNumberColumnEnabled,
23
25
  'data-layout': node.attrs.layout,
24
26
  'data-autosize': node.attrs.__autoSize,
25
27
  'data-table-local-id': node.attrs.localId,
26
- 'data-table-width': node.attrs.width
28
+ 'data-table-width': node.attrs.width,
29
+ style: "width: ".concat(node.attrs.width, "px;")
27
30
  };
28
31
  var colgroup = '';
29
32
  if (config.allowColumnResizing) {
@@ -40,7 +43,8 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
40
43
  }], ['div', {
41
44
  class: 'pm-table-row-controls-wrapper'
42
45
  }, ['div']], ['div', {
43
- class: 'pm-table-with-left-shadow'
46
+ class: 'pm-table-with-left-shadow',
47
+ style: 'visibility: hidden'
44
48
  }], ['div', {
45
49
  class: 'pm-table-wrapper'
46
50
  }, ['table', attrs, ['span', {
@@ -48,7 +52,8 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
48
52
  }], ['span', {
49
53
  class: 'pm-table-shadow-sentinel-left'
50
54
  }], colgroup, ['tbody', 0]]], ['div', {
51
- class: 'pm-table-with-right-shadow'
55
+ class: 'pm-table-with-right-shadow',
56
+ style: 'visibility: hidden'
52
57
  }], ['div', {
53
58
  class: 'pm-table-sticky-sentinel-bottom',
54
59
  'data-testid': 'sticky-sentinel-bottom'
@@ -59,11 +64,14 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
59
64
  }, tableContainerDiv];
60
65
  }
61
66
  var tableResizingDiv = ['div', {
62
- 'data-testid': 'table-alignment-container'
67
+ 'data-testid': 'table-alignment-container',
68
+ style: 'display: flex; justify-content: center;'
63
69
  }, ['div', {
64
- class: 'pm-table-resizer-container'
70
+ class: 'pm-table-resizer-container',
71
+ style: "width: ".concat(node.attrs.width, "px")
65
72
  }, ['div', {
66
- class: 'resizer-item display-handle'
73
+ class: 'resizer-item display-handle',
74
+ style: "position: relative; user-select: auto; height: auto; min-width: 145px; box-sizing: border-box; max-width: ".concat(editorWidthFromGetter, "px; width: ").concat(editorWidthFromGetter, "px;")
67
75
  }, ['span', {
68
76
  class: 'resizer-hover-zone'
69
77
  }, tableContainerDiv]]]];
@@ -52,9 +52,7 @@ var stickyHeaderMarginTop = function stickyHeaderMarginTop() {
52
52
  return (0, _react.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)([""])));
53
53
  };
54
54
  var viewModeSortStyles = function viewModeSortStyles() {
55
- if ((0, _platformFeatureFlags.fg)('platform.editor.table.live-pages-sorting_4malx')) {
56
- return (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\t\t\tth {\n\t\t\t\t.", " {\n\t\t\t\t\t+ p {\n\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t.", " {\n\t\t\t\t\topacity: 0;\n\t\t\t\t\t&:focus {\n\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t&:hover {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t"])), _consts.SORTING_ICON_CLASS_NAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME);
57
- }
55
+ return (0, _react.css)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\t\tth {\n\t\t\t.", " {\n\t\t\t\t+ p {\n\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&:has(.is-active) {\n\t\t\t\t.", " {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\topacity: 0;\n\t\t\t\t&:focus {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\t.", " {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t"])), _consts.SORTING_ICON_CLASS_NAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME, _table.SORTABLE_COLUMN_ICON_CLASSNAME);
58
56
  };
59
57
  var tableBorderStyles = function tableBorderStyles() {
60
58
  return "border-color: ".concat(_consts2.tableBorderDeleteColor);
@@ -342,7 +342,7 @@ class TableComponent extends React.Component {
342
342
  }
343
343
  }
344
344
  componentDidMount() {
345
- var _this$table2;
345
+ var _this$props$pluginInj, _this$props$pluginInj2, _this$table2;
346
346
  const {
347
347
  allowColumnResizing,
348
348
  eventDispatcher,
@@ -352,15 +352,12 @@ class TableComponent extends React.Component {
352
352
  getEditorFeatureFlags,
353
353
  isTableScalingEnabled
354
354
  } = this.props;
355
- if (fg('platform.editor.table.live-pages-sorting_4malx')) {
356
- var _this$props$pluginInj, _this$props$pluginInj2;
357
- const {
358
- mode
359
- } = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj2 === void 0 ? void 0 : _this$props$pluginInj2.sharedState.currentState()) || {};
360
- if (mode === 'view') {
361
- var _this$table;
362
- this === null || this === void 0 ? void 0 : (_this$table = this.table) === null || _this$table === void 0 ? void 0 : _this$table.addEventListener('mouseenter', this.handleMouseEnter);
363
- }
355
+ const {
356
+ mode
357
+ } = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 ? void 0 : (_this$props$pluginInj2 = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj2 === void 0 ? void 0 : _this$props$pluginInj2.sharedState.currentState()) || {};
358
+ if (mode === 'view') {
359
+ var _this$table;
360
+ this === null || this === void 0 ? void 0 : (_this$table = this.table) === null || _this$table === void 0 ? void 0 : _this$table.addEventListener('mouseenter', this.handleMouseEnter);
364
361
  }
365
362
  this === null || this === void 0 ? void 0 : (_this$table2 = this.table) === null || _this$table2 === void 0 ? void 0 : _this$table2.addEventListener('mouseout', this.handleMouseOut);
366
363
  if (fg('platform_editor_react_18_table_column_resize_hover')) {
@@ -414,7 +411,7 @@ class TableComponent extends React.Component {
414
411
  }
415
412
  }
416
413
  componentWillUnmount() {
417
- var _this$resizeObserver, _this$table5;
414
+ var _this$resizeObserver, _this$table4, _this$table5;
418
415
  const {
419
416
  allowColumnResizing,
420
417
  eventDispatcher,
@@ -447,10 +444,7 @@ class TableComponent extends React.Component {
447
444
  if (!(options !== null && options !== void 0 && options.isTableResizingEnabled) && allowColumnResizing) {
448
445
  window.removeEventListener('resize', this.handleWindowResizeDebounced);
449
446
  }
450
- if (fg('platform.editor.table.live-pages-sorting_4malx')) {
451
- var _this$table4;
452
- this === null || this === void 0 ? void 0 : (_this$table4 = this.table) === null || _this$table4 === void 0 ? void 0 : _this$table4.removeEventListener('mouseenter', this.handleMouseEnter);
453
- }
447
+ this === null || this === void 0 ? void 0 : (_this$table4 = this.table) === null || _this$table4 === void 0 ? void 0 : _this$table4.removeEventListener('mouseenter', this.handleMouseEnter);
454
448
  this === null || this === void 0 ? void 0 : (_this$table5 = this.table) === null || _this$table5 === void 0 ? void 0 : _this$table5.removeEventListener('mouseout', this.handleMouseOut);
455
449
  if (fg('platform_editor_react_18_table_column_resize_hover')) {
456
450
  var _this$table6;
@@ -135,7 +135,8 @@ const tablesPlugin = ({
135
135
  name: 'table',
136
136
  node: tableNodeSpecWithFixedToDOM({
137
137
  allowColumnResizing: Boolean(allowColumnResizing),
138
- tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableResizingEnabled)
138
+ tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableResizingEnabled),
139
+ getEditorContainerWidth: defaultGetEditorContainerWidth
139
140
  })
140
141
  }, {
141
142
  name: 'tableHeader',
@@ -258,7 +259,7 @@ const tablesPlugin = ({
258
259
  }, {
259
260
  name: 'tableViewModeSort',
260
261
  plugin: () => {
261
- return api !== null && api !== void 0 && api.editorViewMode && fg('platform.editor.table.live-pages-sorting_4malx') ? createViewModeSortPlugin(api.editorViewMode) : undefined;
262
+ return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api.editorViewMode) : undefined;
262
263
  }
263
264
  }, {
264
265
  name: 'tableLocalId',
@@ -1,4 +1,5 @@
1
1
  import { table } from '@atlaskit/adf-schema';
2
+ import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
2
3
  import { fg } from '@atlaskit/platform-feature-flags';
3
4
  import { generateColgroup } from './pm-plugins/table-resizing/utils/colgroup';
4
5
  export const tableNodeSpecWithFixedToDOM = config => {
@@ -8,12 +9,14 @@ export const tableNodeSpecWithFixedToDOM = config => {
8
9
  return {
9
10
  ...table,
10
11
  toDOM: node => {
12
+ const editorWidthFromGetter = Math.min(config.getEditorContainerWidth().width - akEditorGutterPaddingDynamic() * 2, node.attrs.width);
11
13
  const attrs = {
12
14
  'data-number-column': node.attrs.isNumberColumnEnabled,
13
15
  'data-layout': node.attrs.layout,
14
16
  'data-autosize': node.attrs.__autoSize,
15
17
  'data-table-local-id': node.attrs.localId,
16
- 'data-table-width': node.attrs.width
18
+ 'data-table-width': node.attrs.width,
19
+ style: `width: ${node.attrs.width}px;`
17
20
  };
18
21
  let colgroup = '';
19
22
  if (config.allowColumnResizing) {
@@ -30,7 +33,8 @@ export const tableNodeSpecWithFixedToDOM = config => {
30
33
  }], ['div', {
31
34
  class: 'pm-table-row-controls-wrapper'
32
35
  }, ['div']], ['div', {
33
- class: 'pm-table-with-left-shadow'
36
+ class: 'pm-table-with-left-shadow',
37
+ style: 'visibility: hidden'
34
38
  }], ['div', {
35
39
  class: 'pm-table-wrapper'
36
40
  }, ['table', attrs, ['span', {
@@ -38,7 +42,8 @@ export const tableNodeSpecWithFixedToDOM = config => {
38
42
  }], ['span', {
39
43
  class: 'pm-table-shadow-sentinel-left'
40
44
  }], colgroup, ['tbody', 0]]], ['div', {
41
- class: 'pm-table-with-right-shadow'
45
+ class: 'pm-table-with-right-shadow',
46
+ style: 'visibility: hidden'
42
47
  }], ['div', {
43
48
  class: 'pm-table-sticky-sentinel-bottom',
44
49
  'data-testid': 'sticky-sentinel-bottom'
@@ -49,11 +54,14 @@ export const tableNodeSpecWithFixedToDOM = config => {
49
54
  }, tableContainerDiv];
50
55
  }
51
56
  const tableResizingDiv = ['div', {
52
- 'data-testid': 'table-alignment-container'
57
+ 'data-testid': 'table-alignment-container',
58
+ style: 'display: flex; justify-content: center;'
53
59
  }, ['div', {
54
- class: 'pm-table-resizer-container'
60
+ class: 'pm-table-resizer-container',
61
+ style: `width: ${node.attrs.width}px`
55
62
  }, ['div', {
56
- class: 'resizer-item display-handle'
63
+ class: 'resizer-item display-handle',
64
+ style: `position: relative; user-select: auto; height: auto; min-width: 145px; box-sizing: border-box; max-width: ${editorWidthFromGetter}px; width: ${editorWidthFromGetter}px;`
57
65
  }, ['span', {
58
66
  class: 'resizer-hover-zone'
59
67
  }, tableContainerDiv]]]];
@@ -135,36 +135,34 @@ const stickyHeaderMarginTop = () => {
135
135
  return css``;
136
136
  };
137
137
  const viewModeSortStyles = () => {
138
- if (fg('platform.editor.table.live-pages-sorting_4malx')) {
139
- return css`
140
- th {
141
- .${SORTING_ICON_CLASS_NAME} {
142
- + p {
143
- margin-top: 0 !important;
144
- }
138
+ return css`
139
+ th {
140
+ .${SORTING_ICON_CLASS_NAME} {
141
+ + p {
142
+ margin-top: 0 !important;
145
143
  }
144
+ }
146
145
 
147
- &:has(.is-active) {
148
- .${SORTABLE_COLUMN_ICON_CLASSNAME} {
149
- opacity: 1;
150
- }
146
+ &:has(.is-active) {
147
+ .${SORTABLE_COLUMN_ICON_CLASSNAME} {
148
+ opacity: 1;
151
149
  }
150
+ }
152
151
 
153
- .${SORTABLE_COLUMN_ICON_CLASSNAME} {
154
- opacity: 0;
155
- &:focus {
156
- opacity: 1;
157
- }
152
+ .${SORTABLE_COLUMN_ICON_CLASSNAME} {
153
+ opacity: 0;
154
+ &:focus {
155
+ opacity: 1;
158
156
  }
157
+ }
159
158
 
160
- &:hover {
161
- .${SORTABLE_COLUMN_ICON_CLASSNAME} {
162
- opacity: 1;
163
- }
159
+ &:hover {
160
+ .${SORTABLE_COLUMN_ICON_CLASSNAME} {
161
+ opacity: 1;
164
162
  }
165
163
  }
166
- `;
167
- }
164
+ }
165
+ `;
168
166
  };
169
167
  const tableBorderStyles = () => {
170
168
  return `border-color: ${tableBorderDeleteColor}`;
@@ -353,7 +353,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
353
353
  _createClass(TableComponent, [{
354
354
  key: "componentDidMount",
355
355
  value: function componentDidMount() {
356
- var _this$table2;
356
+ var _this$props$pluginInj, _this$table2;
357
357
  var _this$props7 = this.props,
358
358
  allowColumnResizing = _this$props7.allowColumnResizing,
359
359
  eventDispatcher = _this$props7.eventDispatcher,
@@ -362,14 +362,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
362
362
  getNode = _this$props7.getNode,
363
363
  getEditorFeatureFlags = _this$props7.getEditorFeatureFlags,
364
364
  isTableScalingEnabled = _this$props7.isTableScalingEnabled;
365
- if (fg('platform.editor.table.live-pages-sorting_4malx')) {
366
- var _this$props$pluginInj;
367
- var _ref = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || (_this$props$pluginInj = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.sharedState.currentState()) || {},
368
- mode = _ref.mode;
369
- if (mode === 'view') {
370
- var _this$table;
371
- this === null || this === void 0 || (_this$table = this.table) === null || _this$table === void 0 || _this$table.addEventListener('mouseenter', this.handleMouseEnter);
372
- }
365
+ var _ref = ((_this$props$pluginInj = this.props.pluginInjectionApi) === null || _this$props$pluginInj === void 0 || (_this$props$pluginInj = _this$props$pluginInj.editorViewMode) === null || _this$props$pluginInj === void 0 ? void 0 : _this$props$pluginInj.sharedState.currentState()) || {},
366
+ mode = _ref.mode;
367
+ if (mode === 'view') {
368
+ var _this$table;
369
+ this === null || this === void 0 || (_this$table = this.table) === null || _this$table === void 0 || _this$table.addEventListener('mouseenter', this.handleMouseEnter);
373
370
  }
374
371
  this === null || this === void 0 || (_this$table2 = this.table) === null || _this$table2 === void 0 || _this$table2.addEventListener('mouseout', this.handleMouseOut);
375
372
  if (fg('platform_editor_react_18_table_column_resize_hover')) {
@@ -425,7 +422,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
425
422
  }, {
426
423
  key: "componentWillUnmount",
427
424
  value: function componentWillUnmount() {
428
- var _this$resizeObserver, _this$table5;
425
+ var _this$resizeObserver, _this$table4, _this$table5;
429
426
  var _this$props8 = this.props,
430
427
  allowColumnResizing = _this$props8.allowColumnResizing,
431
428
  eventDispatcher = _this$props8.eventDispatcher,
@@ -456,10 +453,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
456
453
  if (!(options !== null && options !== void 0 && options.isTableResizingEnabled) && allowColumnResizing) {
457
454
  window.removeEventListener('resize', this.handleWindowResizeDebounced);
458
455
  }
459
- if (fg('platform.editor.table.live-pages-sorting_4malx')) {
460
- var _this$table4;
461
- this === null || this === void 0 || (_this$table4 = this.table) === null || _this$table4 === void 0 || _this$table4.removeEventListener('mouseenter', this.handleMouseEnter);
462
- }
456
+ this === null || this === void 0 || (_this$table4 = this.table) === null || _this$table4 === void 0 || _this$table4.removeEventListener('mouseenter', this.handleMouseEnter);
463
457
  this === null || this === void 0 || (_this$table5 = this.table) === null || _this$table5 === void 0 || _this$table5.removeEventListener('mouseout', this.handleMouseOut);
464
458
  if (fg('platform_editor_react_18_table_column_resize_hover')) {
465
459
  var _this$table6;
@@ -138,7 +138,8 @@ var tablesPlugin = function tablesPlugin(_ref) {
138
138
  name: 'table',
139
139
  node: tableNodeSpecWithFixedToDOM({
140
140
  allowColumnResizing: Boolean(allowColumnResizing),
141
- tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableResizingEnabled)
141
+ tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableResizingEnabled),
142
+ getEditorContainerWidth: defaultGetEditorContainerWidth
142
143
  })
143
144
  }, {
144
145
  name: 'tableHeader',
@@ -262,7 +263,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
262
263
  }, {
263
264
  name: 'tableViewModeSort',
264
265
  plugin: function plugin() {
265
- return api !== null && api !== void 0 && api.editorViewMode && fg('platform.editor.table.live-pages-sorting_4malx') ? createViewModeSortPlugin(api.editorViewMode) : undefined;
266
+ return api !== null && api !== void 0 && api.editorViewMode ? createViewModeSortPlugin(api.editorViewMode) : undefined;
266
267
  }
267
268
  }, {
268
269
  name: 'tableLocalId',
package/dist/esm/toDOM.js CHANGED
@@ -3,6 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
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; }
4
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; }
5
5
  import { table } from '@atlaskit/adf-schema';
6
+ import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
6
7
  import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { generateColgroup } from './pm-plugins/table-resizing/utils/colgroup';
8
9
  export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
@@ -11,12 +12,14 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
11
12
  }
12
13
  return _objectSpread(_objectSpread({}, table), {}, {
13
14
  toDOM: function toDOM(node) {
15
+ var editorWidthFromGetter = Math.min(config.getEditorContainerWidth().width - akEditorGutterPaddingDynamic() * 2, node.attrs.width);
14
16
  var attrs = {
15
17
  'data-number-column': node.attrs.isNumberColumnEnabled,
16
18
  'data-layout': node.attrs.layout,
17
19
  'data-autosize': node.attrs.__autoSize,
18
20
  'data-table-local-id': node.attrs.localId,
19
- 'data-table-width': node.attrs.width
21
+ 'data-table-width': node.attrs.width,
22
+ style: "width: ".concat(node.attrs.width, "px;")
20
23
  };
21
24
  var colgroup = '';
22
25
  if (config.allowColumnResizing) {
@@ -33,7 +36,8 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
33
36
  }], ['div', {
34
37
  class: 'pm-table-row-controls-wrapper'
35
38
  }, ['div']], ['div', {
36
- class: 'pm-table-with-left-shadow'
39
+ class: 'pm-table-with-left-shadow',
40
+ style: 'visibility: hidden'
37
41
  }], ['div', {
38
42
  class: 'pm-table-wrapper'
39
43
  }, ['table', attrs, ['span', {
@@ -41,7 +45,8 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
41
45
  }], ['span', {
42
46
  class: 'pm-table-shadow-sentinel-left'
43
47
  }], colgroup, ['tbody', 0]]], ['div', {
44
- class: 'pm-table-with-right-shadow'
48
+ class: 'pm-table-with-right-shadow',
49
+ style: 'visibility: hidden'
45
50
  }], ['div', {
46
51
  class: 'pm-table-sticky-sentinel-bottom',
47
52
  'data-testid': 'sticky-sentinel-bottom'
@@ -52,11 +57,14 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
52
57
  }, tableContainerDiv];
53
58
  }
54
59
  var tableResizingDiv = ['div', {
55
- 'data-testid': 'table-alignment-container'
60
+ 'data-testid': 'table-alignment-container',
61
+ style: 'display: flex; justify-content: center;'
56
62
  }, ['div', {
57
- class: 'pm-table-resizer-container'
63
+ class: 'pm-table-resizer-container',
64
+ style: "width: ".concat(node.attrs.width, "px")
58
65
  }, ['div', {
59
- class: 'resizer-item display-handle'
66
+ class: 'resizer-item display-handle',
67
+ style: "position: relative; user-select: auto; height: auto; min-width: 145px; box-sizing: border-box; max-width: ".concat(editorWidthFromGetter, "px; width: ").concat(editorWidthFromGetter, "px;")
60
68
  }, ['span', {
61
69
  class: 'resizer-hover-zone'
62
70
  }, tableContainerDiv]]]];
@@ -46,9 +46,7 @@ var stickyHeaderMarginTop = function stickyHeaderMarginTop() {
46
46
  return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
47
47
  };
48
48
  var viewModeSortStyles = function viewModeSortStyles() {
49
- if (fg('platform.editor.table.live-pages-sorting_4malx')) {
50
- return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n\t\t\tth {\n\t\t\t\t.", " {\n\t\t\t\t\t+ p {\n\t\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t&:has(.is-active) {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t.", " {\n\t\t\t\t\topacity: 0;\n\t\t\t\t\t&:focus {\n\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t&:hover {\n\t\t\t\t\t.", " {\n\t\t\t\t\t\topacity: 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t"])), SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME);
51
- }
49
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n\t\tth {\n\t\t\t.", " {\n\t\t\t\t+ p {\n\t\t\t\t\tmargin-top: 0 !important;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&:has(.is-active) {\n\t\t\t\t.", " {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t.", " {\n\t\t\t\topacity: 0;\n\t\t\t\t&:focus {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\t.", " {\n\t\t\t\t\topacity: 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t"])), SORTING_ICON_CLASS_NAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME, SORTABLE_COLUMN_ICON_CLASSNAME);
52
50
  };
53
51
  var tableBorderStyles = function tableBorderStyles() {
54
52
  return "border-color: ".concat(tableBorderDeleteColor);
@@ -1,7 +1,9 @@
1
1
  import { table } from '@atlaskit/adf-schema';
2
+ import type { GetEditorContainerWidth } from '@atlaskit/editor-common/src/types';
2
3
  type Config = {
3
4
  allowColumnResizing: boolean;
4
5
  tableResizingEnabled: boolean;
6
+ getEditorContainerWidth: GetEditorContainerWidth;
5
7
  };
6
8
  export declare const tableNodeSpecWithFixedToDOM: (config: Config) => typeof table;
7
9
  export {};
@@ -1,7 +1,9 @@
1
1
  import { table } from '@atlaskit/adf-schema';
2
+ import type { GetEditorContainerWidth } from '@atlaskit/editor-common/src/types';
2
3
  type Config = {
3
4
  allowColumnResizing: boolean;
4
5
  tableResizingEnabled: boolean;
6
+ getEditorContainerWidth: GetEditorContainerWidth;
5
7
  };
6
8
  export declare const tableNodeSpecWithFixedToDOM: (config: Config) => typeof table;
7
9
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.25.5",
3
+ "version": "7.25.6",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,7 +31,7 @@
31
31
  "@atlaskit/adf-schema": "^40.8.1",
32
32
  "@atlaskit/button": "^20.0.0",
33
33
  "@atlaskit/custom-steps": "^0.7.0",
34
- "@atlaskit/editor-common": "^87.10.0",
34
+ "@atlaskit/editor-common": "^87.11.0",
35
35
  "@atlaskit/editor-palette": "1.6.0",
36
36
  "@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.7.0",
@@ -114,9 +114,6 @@
114
114
  "platform_editor_dark_mode_cell_header_color_fix": {
115
115
  "type": "boolean"
116
116
  },
117
- "platform.editor.table.live-pages-sorting_4malx": {
118
- "type": "boolean"
119
- },
120
117
  "platform_editor_a11y_table_context_menu": {
121
118
  "type": "boolean"
122
119
  },
@@ -217,12 +217,10 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
217
217
  isTableScalingEnabled,
218
218
  } = this.props;
219
219
 
220
- if (fg('platform.editor.table.live-pages-sorting_4malx')) {
221
- const { mode } =
222
- this.props.pluginInjectionApi?.editorViewMode?.sharedState.currentState() || {};
223
- if (mode === 'view') {
224
- this?.table?.addEventListener('mouseenter', this.handleMouseEnter);
225
- }
220
+ const { mode } =
221
+ this.props.pluginInjectionApi?.editorViewMode?.sharedState.currentState() || {};
222
+ if (mode === 'view') {
223
+ this?.table?.addEventListener('mouseenter', this.handleMouseEnter);
226
224
  }
227
225
 
228
226
  this?.table?.addEventListener('mouseout', this.handleMouseOut);
@@ -331,9 +329,7 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
331
329
  window.removeEventListener('resize', this.handleWindowResizeDebounced);
332
330
  }
333
331
 
334
- if (fg('platform.editor.table.live-pages-sorting_4malx')) {
335
- this?.table?.removeEventListener('mouseenter', this.handleMouseEnter);
336
- }
332
+ this?.table?.removeEventListener('mouseenter', this.handleMouseEnter);
337
333
 
338
334
  this?.table?.removeEventListener('mouseout', this.handleMouseOut);
339
335
 
package/src/plugin.tsx CHANGED
@@ -261,6 +261,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
261
261
  node: tableNodeSpecWithFixedToDOM({
262
262
  allowColumnResizing: Boolean(allowColumnResizing),
263
263
  tableResizingEnabled: Boolean(options?.tableResizingEnabled),
264
+ getEditorContainerWidth: defaultGetEditorContainerWidth,
264
265
  }),
265
266
  },
266
267
  { name: 'tableHeader', node: tableHeader },
@@ -427,9 +428,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
427
428
  {
428
429
  name: 'tableViewModeSort',
429
430
  plugin: () => {
430
- return api?.editorViewMode && fg('platform.editor.table.live-pages-sorting_4malx')
431
- ? createViewModeSortPlugin(api.editorViewMode)
432
- : undefined;
431
+ return api?.editorViewMode ? createViewModeSortPlugin(api.editorViewMode) : undefined;
433
432
  },
434
433
  },
435
434
  {
package/src/toDOM.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { table } from '@atlaskit/adf-schema';
2
+ import type { GetEditorContainerWidth } from '@atlaskit/editor-common/src/types';
2
3
  import type { DOMOutputSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
4
+ import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
3
5
  import { fg } from '@atlaskit/platform-feature-flags';
4
6
 
5
7
  import { generateColgroup } from './pm-plugins/table-resizing/utils/colgroup';
@@ -7,6 +9,7 @@ import { generateColgroup } from './pm-plugins/table-resizing/utils/colgroup';
7
9
  type Config = {
8
10
  allowColumnResizing: boolean;
9
11
  tableResizingEnabled: boolean;
12
+ getEditorContainerWidth: GetEditorContainerWidth;
10
13
  };
11
14
  export const tableNodeSpecWithFixedToDOM = (config: Config): typeof table => {
12
15
  if (!fg('platform_editor_lazy-node-views')) {
@@ -16,12 +19,17 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): typeof table => {
16
19
  return {
17
20
  ...table,
18
21
  toDOM: (node: PMNode): DOMOutputSpec => {
22
+ const editorWidthFromGetter = Math.min(
23
+ config.getEditorContainerWidth().width - akEditorGutterPaddingDynamic() * 2,
24
+ node.attrs.width,
25
+ );
19
26
  const attrs = {
20
27
  'data-number-column': node.attrs.isNumberColumnEnabled,
21
28
  'data-layout': node.attrs.layout,
22
29
  'data-autosize': node.attrs.__autoSize,
23
30
  'data-table-local-id': node.attrs.localId,
24
31
  'data-table-width': node.attrs.width,
32
+ style: `width: ${node.attrs.width}px;`,
25
33
  };
26
34
 
27
35
  let colgroup: DOMOutputSpec = '';
@@ -56,6 +64,7 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): typeof table => {
56
64
  'div',
57
65
  {
58
66
  class: 'pm-table-with-left-shadow',
67
+ style: 'visibility: hidden',
59
68
  },
60
69
  ],
61
70
  [
@@ -76,6 +85,7 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): typeof table => {
76
85
  'div',
77
86
  {
78
87
  class: 'pm-table-with-right-shadow',
88
+ style: 'visibility: hidden',
79
89
  },
80
90
  ],
81
91
  [
@@ -101,16 +111,19 @@ export const tableNodeSpecWithFixedToDOM = (config: Config): typeof table => {
101
111
  'div',
102
112
  {
103
113
  'data-testid': 'table-alignment-container',
114
+ style: 'display: flex; justify-content: center;',
104
115
  },
105
116
  [
106
117
  'div',
107
118
  {
108
119
  class: 'pm-table-resizer-container',
120
+ style: `width: ${node.attrs.width}px`,
109
121
  },
110
122
  [
111
123
  'div',
112
124
  {
113
125
  class: 'resizer-item display-handle',
126
+ style: `position: relative; user-select: auto; height: auto; min-width: 145px; box-sizing: border-box; max-width: ${editorWidthFromGetter}px; width: ${editorWidthFromGetter}px;`,
114
127
  },
115
128
  [
116
129
  'span',
@@ -210,36 +210,34 @@ const stickyHeaderMarginTop = () => {
210
210
  };
211
211
 
212
212
  const viewModeSortStyles = () => {
213
- if (fg('platform.editor.table.live-pages-sorting_4malx')) {
214
- return css`
215
- th {
216
- .${SORTING_ICON_CLASS_NAME} {
217
- + p {
218
- margin-top: 0 !important;
219
- }
213
+ return css`
214
+ th {
215
+ .${SORTING_ICON_CLASS_NAME} {
216
+ + p {
217
+ margin-top: 0 !important;
220
218
  }
219
+ }
221
220
 
222
- &:has(.is-active) {
223
- .${SORTABLE_COLUMN_ICON_CLASSNAME} {
224
- opacity: 1;
225
- }
221
+ &:has(.is-active) {
222
+ .${SORTABLE_COLUMN_ICON_CLASSNAME} {
223
+ opacity: 1;
226
224
  }
225
+ }
227
226
 
228
- .${SORTABLE_COLUMN_ICON_CLASSNAME} {
229
- opacity: 0;
230
- &:focus {
231
- opacity: 1;
232
- }
227
+ .${SORTABLE_COLUMN_ICON_CLASSNAME} {
228
+ opacity: 0;
229
+ &:focus {
230
+ opacity: 1;
233
231
  }
232
+ }
234
233
 
235
- &:hover {
236
- .${SORTABLE_COLUMN_ICON_CLASSNAME} {
237
- opacity: 1;
238
- }
234
+ &:hover {
235
+ .${SORTABLE_COLUMN_ICON_CLASSNAME} {
236
+ opacity: 1;
239
237
  }
240
238
  }
241
- `;
242
- }
239
+ }
240
+ `;
243
241
  };
244
242
 
245
243
  const tableBorderStyles = () => {