@atlaskit/editor-plugin-table 7.25.13 → 7.25.15

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,21 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 7.25.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`be687d5675114`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/be687d5675114) -
8
+ [ux] Fixes a bug where scaled table viewed on a narrow screen loses scaling.
9
+ - Updated dependencies
10
+
11
+ ## 7.25.14
12
+
13
+ ### Patch Changes
14
+
15
+ - [#134066](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/134066)
16
+ [`43a1d7aed352b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/43a1d7aed352b) -
17
+ ED-24576: UNSTABLE_allowTableResizing in renderer added
18
+
3
19
  ## 7.25.13
4
20
 
5
21
  ### Patch Changes
@@ -153,13 +153,14 @@ var insertRow = exports.insertRow = function insertRow(row, moveCursorToTheNewRo
153
153
  return true;
154
154
  };
155
155
  };
156
- var createTable = exports.createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled) {
156
+ var createTable = exports.createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
157
157
  return function (state, dispatch) {
158
158
  var table = (0, _utils3.createTableWithWidth)({
159
159
  isTableScalingEnabled: isTableScalingEnabled,
160
160
  isTableAlignmentEnabled: isTableAlignmentEnabled,
161
161
  isFullWidthModeEnabled: isFullWidthModeEnabled,
162
162
  isCommentEditor: isCommentEditor,
163
+ isChromelessEditor: isChromelessEditor,
163
164
  isTableResizingEnabled: isTableResizingEnabled
164
165
  })(state.schema);
165
166
  if (dispatch) {
@@ -180,7 +181,7 @@ var createTable = exports.createTable = function createTable(isTableScalingEnabl
180
181
  return true;
181
182
  };
182
183
  };
183
- var insertTableWithSize = exports.insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor) {
184
+ var insertTableWithSize = exports.insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor) {
184
185
  return function (rowsCount, colsCount, inputMethod) {
185
186
  return function (_ref) {
186
187
  var tr = _ref.tr;
@@ -189,6 +190,7 @@ var insertTableWithSize = exports.insertTableWithSize = function insertTableWith
189
190
  isFullWidthModeEnabled: isFullWidthModeEnabled,
190
191
  isTableAlignmentEnabled: isTableAlignmentEnabled,
191
192
  isCommentEditor: isCommentEditor,
193
+ isChromelessEditor: isChromelessEditor,
192
194
  createTableProps: {
193
195
  rowsCount: rowsCount,
194
196
  colsCount: colsCount
@@ -548,7 +548,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
548
548
  // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
549
549
  !!((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isTableScalingEnabled) && !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isCommentEditor);
550
550
  if (force || !isResizing && shouldUpdateColgroup) {
551
- var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7, _this$props$options8, _this$props$options9;
551
+ var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7;
552
552
  var resizeState = (0, _utils4.getResizeState)({
553
553
  minWidth: _utils4.COLUMN_MIN_WIDTH,
554
554
  maxSize: tableRenderWidth,
@@ -571,14 +571,18 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
571
571
  shouldScaleOnColgroupUpdate = true;
572
572
  }
573
573
  var scalePercent = 1;
574
- if (!((_this$props$options8 = this.props.options) !== null && _this$props$options8 !== void 0 && _this$props$options8.isCommentEditor) || (_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && tableNode.attrs.width) {
575
- scalePercent = (0, _misc.getTableScalingPercent)(tableNode, this.table, shouldUseIncreasedScalingPercent);
576
- } else {
577
- scalePercent = (0, _misc.getScalingPercentForTableWithoutWidth)(tableNode, this.table);
578
- }
579
-
580
- // Request animation frame required for Firefox
581
574
  requestAnimationFrame(function () {
575
+ var _this2$props$options, _this2$props$options2;
576
+ // Scaling percent has to be calculated inside requestAnimationFrame, otherwise
577
+ // renderWidth calculated as `tableRef?.parentElement?.clientWidth`
578
+ // inside of getTableScalingPercent returns 0.
579
+ if (!((_this2$props$options = _this2.props.options) !== null && _this2$props$options !== void 0 && _this2$props$options.isCommentEditor) || (_this2$props$options2 = _this2.props.options) !== null && _this2$props$options2 !== void 0 && _this2$props$options2.isCommentEditor && tableNode.attrs.width) {
580
+ scalePercent = (0, _misc.getTableScalingPercent)(tableNode, _this2.table, shouldUseIncreasedScalingPercent);
581
+ } else {
582
+ scalePercent = (0, _misc.getScalingPercentForTableWithoutWidth)(tableNode, _this2.table);
583
+ }
584
+
585
+ // Request animation frame required for Firefox
582
586
  (0, _utils4.updateColgroup)(resizeState, _this2.table, tableNode, shouldScaleOnColgroupUpdate, scalePercent);
583
587
  });
584
588
  }
@@ -590,8 +594,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
590
594
  }, {
591
595
  key: "componentDidUpdate",
592
596
  value: function componentDidUpdate(_, prevState) {
593
- var _this$props$options10,
594
- _this$props$options11,
597
+ var _this$props$options8,
598
+ _this$props$options9,
595
599
  _this$wrapper,
596
600
  _this3 = this;
597
601
  var _this$props11 = this.props,
@@ -620,7 +624,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
620
624
  shouldHandleColgroupUpdates = true;
621
625
  }
622
626
  var isTableScalingWithFixedColumnWidthsOptionEnabled = !!isTableScalingEnabled && tableWithFixedColumnWidthsOption;
623
- var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent') || !!isTableScalingEnabled && !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor);
627
+ var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent') || !!isTableScalingEnabled && !!((_this$props$options8 = this.props.options) !== null && _this$props$options8 !== void 0 && _this$props$options8.isCommentEditor);
624
628
  if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
625
629
  shouldScale = true;
626
630
  shouldHandleColgroupUpdates = true;
@@ -631,7 +635,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
631
635
  if (isInDanger && !table) {
632
636
  (0, _commands.clearHoverSelection)()(view.state, view.dispatch);
633
637
  }
634
- if ((_this$props$options11 = this.props.options) !== null && _this$props$options11 !== void 0 && _this$props$options11.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
638
+ if ((_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
635
639
  this.removeInlineTableWidth();
636
640
  }
637
641
  if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
@@ -718,7 +722,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
718
722
  key: "render",
719
723
  value: function render() {
720
724
  var _this4 = this,
721
- _this$props$options12,
725
+ _this$props$options10,
722
726
  _classnames;
723
727
  var _this$props12 = this.props,
724
728
  view = _this$props12.view,
@@ -837,7 +841,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
837
841
  stickyScrollbar = _getEditorFeatureFlag8.stickyScrollbar,
838
842
  _getEditorFeatureFlag9 = _getEditorFeatureFlag8.tableWithFixedColumnWidthsOption,
839
843
  tableWithFixedColumnWidthsOption = _getEditorFeatureFlag9 === void 0 ? false : _getEditorFeatureFlag9;
840
- var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent') || !!((_this$props$options12 = this.props.options) !== null && _this$props$options12 !== void 0 && _this$props$options12.isCommentEditor));
844
+ var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption && (0, _platformFeatureFlags.fg)('platform.editor.table.use-increased-scaling-percent') || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
841
845
  return /*#__PURE__*/_react.default.createElement(_TableContainer.TableContainer
842
846
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
843
847
  , {
@@ -117,6 +117,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
117
117
  isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
118
118
  isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
119
119
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
120
+ isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
120
121
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
121
122
  })(state.schema);
122
123
  return (_api$contentInsertion = api === null || api === void 0 || (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 || (_api$contentInsertion2 = _api$contentInsertion2.actions) === null || _api$contentInsertion2 === void 0 ? void 0 : _api$contentInsertion2.insert({
@@ -220,9 +221,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
220
221
  fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable,
221
222
  _ref7$isCommentEditor = _ref7.isCommentEditor,
222
223
  isCommentEditor = _ref7$isCommentEditor === void 0 ? false : _ref7$isCommentEditor,
224
+ _ref7$isChromelessEdi = _ref7.isChromelessEditor,
225
+ isChromelessEditor = _ref7$isChromelessEdi === void 0 ? false : _ref7$isChromelessEdi,
223
226
  _ref7$tableResizingEn = _ref7.tableResizingEnabled,
224
227
  tableResizingEnabled = _ref7$tableResizingEn === void 0 ? false : _ref7$tableResizingEn;
225
- return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, tableResizingEnabled);
228
+ return (0, _keymap.keymapPlugin)(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
226
229
  }
227
230
  }, {
228
231
  name: 'tableSelectionKeymap',
@@ -489,6 +492,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
489
492
  isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
490
493
  isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
491
494
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
495
+ isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
492
496
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
493
497
  })(state.schema);
494
498
  var tr = insert(tableNode);
@@ -26,12 +26,13 @@ function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, dragAndD
26
26
  var isTableFixedColumnWidthsOptionEnabled = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
27
27
  var shouldUseIncreasedScalingPercent = arguments.length > 11 ? arguments[11] : undefined;
28
28
  var isCommentEditor = arguments.length > 12 ? arguments[12] : undefined;
29
- var isTableResizingEnabled = arguments.length > 13 ? arguments[13] : undefined;
29
+ var isChromelessEditor = arguments.length > 13 ? arguments[13] : undefined;
30
+ var isTableResizingEnabled = arguments.length > 14 ? arguments[14] : undefined;
30
31
  var list = {};
31
32
  var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
32
33
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.nextCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
33
34
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.previousCell.common, (0, _commands2.goToNextCell)(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
34
- (0, _keymaps.bindKeymapWithCommand)(_keymaps.toggleTable.common, (0, _insert.createTable)(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled), list);
35
+ (0, _keymaps.bindKeymapWithCommand)(_keymaps.toggleTable.common, (0, _insert.createTable)(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled), list);
35
36
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, (0, _commands.chainCommands)((0, _commandsWithAnalytics.deleteTableIfSelectedWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD), (0, _commandsWithAnalytics.emptyMultipleCellsWithAnalytics)(editorAnalyticsAPI)(_analytics.INPUT_METHOD.KEYBOARD)), list);
36
37
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.backspace.common, _commands2.moveCursorBackward, list);
37
38
 
@@ -15,6 +15,7 @@ var createTableWithWidth = exports.createTableWithWidth = function createTableWi
15
15
  isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
16
16
  isFullWidthModeEnabled = _ref.isFullWidthModeEnabled,
17
17
  isCommentEditor = _ref.isCommentEditor,
18
+ isChromelessEditor = _ref.isChromelessEditor,
18
19
  isTableResizingEnabled = _ref.isTableResizingEnabled,
19
20
  createTableProps = _ref.createTableProps;
20
21
  return function (schema) {
@@ -25,7 +26,7 @@ var createTableWithWidth = exports.createTableWithWidth = function createTableWi
25
26
  if (isTableAlignmentEnabled && (isFullWidthModeEnabled || isCommentEditor)) {
26
27
  attrsOverrides.layout = 'align-start';
27
28
  }
28
- if (isCommentEditor && isTableResizingEnabled) {
29
+ if (isCommentEditor && isTableResizingEnabled || isChromelessEditor) {
29
30
  attrsOverrides.tableWidth = 'inherit';
30
31
  }
31
32
  return (0, _utils.createTable)(_objectSpread(_objectSpread({
@@ -119,12 +119,13 @@ export const insertRow = (row, moveCursorToTheNewRow, isCellBackgroundDuplicated
119
119
  }
120
120
  return true;
121
121
  };
122
- export const createTable = (isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled) => (state, dispatch) => {
122
+ export const createTable = (isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled) => (state, dispatch) => {
123
123
  const table = createTableWithWidth({
124
124
  isTableScalingEnabled,
125
125
  isTableAlignmentEnabled,
126
126
  isFullWidthModeEnabled,
127
127
  isCommentEditor,
128
+ isChromelessEditor,
128
129
  isTableResizingEnabled
129
130
  })(state.schema);
130
131
  if (dispatch) {
@@ -144,7 +145,7 @@ export const createTable = (isTableScalingEnabled, isTableAlignmentEnabled, isFu
144
145
  }
145
146
  return true;
146
147
  };
147
- export const insertTableWithSize = (isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor) => (rowsCount, colsCount, inputMethod) => {
148
+ export const insertTableWithSize = (isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor) => (rowsCount, colsCount, inputMethod) => {
148
149
  return ({
149
150
  tr
150
151
  }) => {
@@ -153,6 +154,7 @@ export const insertTableWithSize = (isFullWidthModeEnabled, isTableScalingEnable
153
154
  isFullWidthModeEnabled,
154
155
  isTableAlignmentEnabled,
155
156
  isCommentEditor,
157
+ isChromelessEditor,
156
158
  createTableProps: {
157
159
  rowsCount: rowsCount,
158
160
  colsCount: colsCount
@@ -529,7 +529,7 @@ class TableComponent extends React.Component {
529
529
  // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
530
530
  !!((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isTableScalingEnabled) && !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isCommentEditor);
531
531
  if (force || !isResizing && shouldUpdateColgroup) {
532
- var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7, _this$props$options8, _this$props$options9;
532
+ var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7;
533
533
  const resizeState = getResizeState({
534
534
  minWidth: COLUMN_MIN_WIDTH,
535
535
  maxSize: tableRenderWidth,
@@ -552,14 +552,18 @@ class TableComponent extends React.Component {
552
552
  shouldScaleOnColgroupUpdate = true;
553
553
  }
554
554
  let scalePercent = 1;
555
- if (!((_this$props$options8 = this.props.options) !== null && _this$props$options8 !== void 0 && _this$props$options8.isCommentEditor) || (_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && tableNode.attrs.width) {
556
- scalePercent = getTableScalingPercent(tableNode, this.table, shouldUseIncreasedScalingPercent);
557
- } else {
558
- scalePercent = getScalingPercentForTableWithoutWidth(tableNode, this.table);
559
- }
560
-
561
- // Request animation frame required for Firefox
562
555
  requestAnimationFrame(() => {
556
+ var _this$props$options8, _this$props$options9;
557
+ // Scaling percent has to be calculated inside requestAnimationFrame, otherwise
558
+ // renderWidth calculated as `tableRef?.parentElement?.clientWidth`
559
+ // inside of getTableScalingPercent returns 0.
560
+ if (!((_this$props$options8 = this.props.options) !== null && _this$props$options8 !== void 0 && _this$props$options8.isCommentEditor) || (_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && tableNode.attrs.width) {
561
+ scalePercent = getTableScalingPercent(tableNode, this.table, shouldUseIncreasedScalingPercent);
562
+ } else {
563
+ scalePercent = getScalingPercentForTableWithoutWidth(tableNode, this.table);
564
+ }
565
+
566
+ // Request animation frame required for Firefox
563
567
  updateColgroup(resizeState, this.table, tableNode, shouldScaleOnColgroupUpdate, scalePercent);
564
568
  });
565
569
  }
@@ -105,6 +105,7 @@ const tablesPlugin = ({
105
105
  isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
106
106
  isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
107
107
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
108
+ isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
108
109
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
109
110
  })(state.schema);
110
111
  return (_api$contentInsertion = api === null || api === void 0 ? void 0 : (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 ? void 0 : (_api$contentInsertion3 = _api$contentInsertion2.actions) === null || _api$contentInsertion3 === void 0 ? void 0 : _api$contentInsertion3.insert({
@@ -210,9 +211,10 @@ const tablesPlugin = ({
210
211
  isTableAlignmentEnabled = false,
211
212
  fullWidthEnabled = false,
212
213
  isCommentEditor = false,
214
+ isChromelessEditor = false,
213
215
  tableResizingEnabled = false
214
216
  } = options || {};
215
- return keymapPlugin(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, tableResizingEnabled);
217
+ return keymapPlugin(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
216
218
  }
217
219
  }, {
218
220
  name: 'tableSelectionKeymap',
@@ -481,6 +483,7 @@ const tablesPlugin = ({
481
483
  isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
482
484
  isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
483
485
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
486
+ isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
484
487
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
485
488
  })(state.schema);
486
489
  const tr = insert(tableNode);
@@ -8,13 +8,13 @@ import { addRowAroundSelection, changeColumnWidthByStepWithAnalytics, deleteSele
8
8
  import { activateNextResizeArea, initiateKeyboardColumnResizing, stopKeyboardColumnResizing } from '../commands/column-resize';
9
9
  import { addColumnAfter as addColumnAfterCommand, addColumnBefore as addColumnBeforeCommand, createTable } from '../commands/insert';
10
10
  import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
11
- export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isCellBackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isTableResizingEnabled) {
11
+ export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled = false, isTableAlignmentEnabled = false, isFullWidthEnabled, pluginInjectionApi, getIntl, isCellBackgroundDuplicated = false, isTableFixedColumnWidthsOptionEnabled = false, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
12
12
  var _pluginInjectionApi$a;
13
13
  const list = {};
14
14
  const ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
15
15
  bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
16
16
  bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
17
- bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled), list);
17
+ bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled), list);
18
18
  bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
19
19
  bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
20
20
 
@@ -82,7 +82,7 @@ export const getTableScalingPercent = (table, tableRef, shouldUseIncreasedScalin
82
82
  var _tableRef$parentEleme;
83
83
  const maxScalingPercent = shouldUseIncreasedScalingPercent ? MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION : MAX_SCALING_PERCENT;
84
84
  const tableWidth = getTableContainerElementWidth(table);
85
- let renderWidth = (tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || tableWidth;
85
+ const renderWidth = (tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$parentEleme = tableRef.parentElement) === null || _tableRef$parentEleme === void 0 ? void 0 : _tableRef$parentEleme.clientWidth) || tableWidth;
86
86
  // minus 1 here to avoid any 1px scroll in Firefox
87
87
  let scalePercent = (renderWidth - 1) / tableWidth;
88
88
  scalePercent = Math.max(scalePercent, 1 - maxScalingPercent);
@@ -5,6 +5,7 @@ export const createTableWithWidth = ({
5
5
  isTableAlignmentEnabled,
6
6
  isFullWidthModeEnabled,
7
7
  isCommentEditor,
8
+ isChromelessEditor,
8
9
  isTableResizingEnabled,
9
10
  createTableProps
10
11
  }) => schema => {
@@ -15,7 +16,7 @@ export const createTableWithWidth = ({
15
16
  if (isTableAlignmentEnabled && (isFullWidthModeEnabled || isCommentEditor)) {
16
17
  attrsOverrides.layout = 'align-start';
17
18
  }
18
- if (isCommentEditor && isTableResizingEnabled) {
19
+ if (isCommentEditor && isTableResizingEnabled || isChromelessEditor) {
19
20
  attrsOverrides.tableWidth = 'inherit';
20
21
  }
21
22
  return createTable({
@@ -144,13 +144,14 @@ export var insertRow = function insertRow(row, moveCursorToTheNewRow, isCellBack
144
144
  return true;
145
145
  };
146
146
  };
147
- export var createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled) {
147
+ export var createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
148
148
  return function (state, dispatch) {
149
149
  var table = createTableWithWidth({
150
150
  isTableScalingEnabled: isTableScalingEnabled,
151
151
  isTableAlignmentEnabled: isTableAlignmentEnabled,
152
152
  isFullWidthModeEnabled: isFullWidthModeEnabled,
153
153
  isCommentEditor: isCommentEditor,
154
+ isChromelessEditor: isChromelessEditor,
154
155
  isTableResizingEnabled: isTableResizingEnabled
155
156
  })(state.schema);
156
157
  if (dispatch) {
@@ -171,7 +172,7 @@ export var createTable = function createTable(isTableScalingEnabled, isTableAlig
171
172
  return true;
172
173
  };
173
174
  };
174
- export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor) {
175
+ export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor) {
175
176
  return function (rowsCount, colsCount, inputMethod) {
176
177
  return function (_ref) {
177
178
  var tr = _ref.tr;
@@ -180,6 +181,7 @@ export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEna
180
181
  isFullWidthModeEnabled: isFullWidthModeEnabled,
181
182
  isTableAlignmentEnabled: isTableAlignmentEnabled,
182
183
  isCommentEditor: isCommentEditor,
184
+ isChromelessEditor: isChromelessEditor,
183
185
  createTableProps: {
184
186
  rowsCount: rowsCount,
185
187
  colsCount: colsCount
@@ -541,7 +541,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
541
541
  // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
542
542
  !!((_this$props$options2 = this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isTableScalingEnabled) && !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isCommentEditor);
543
543
  if (force || !isResizing && shouldUpdateColgroup) {
544
- var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7, _this$props$options8, _this$props$options9;
544
+ var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7;
545
545
  var resizeState = getResizeState({
546
546
  minWidth: COLUMN_MIN_WIDTH,
547
547
  maxSize: tableRenderWidth,
@@ -564,14 +564,18 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
564
564
  shouldScaleOnColgroupUpdate = true;
565
565
  }
566
566
  var scalePercent = 1;
567
- if (!((_this$props$options8 = this.props.options) !== null && _this$props$options8 !== void 0 && _this$props$options8.isCommentEditor) || (_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && tableNode.attrs.width) {
568
- scalePercent = getTableScalingPercent(tableNode, this.table, shouldUseIncreasedScalingPercent);
569
- } else {
570
- scalePercent = getScalingPercentForTableWithoutWidth(tableNode, this.table);
571
- }
572
-
573
- // Request animation frame required for Firefox
574
567
  requestAnimationFrame(function () {
568
+ var _this2$props$options, _this2$props$options2;
569
+ // Scaling percent has to be calculated inside requestAnimationFrame, otherwise
570
+ // renderWidth calculated as `tableRef?.parentElement?.clientWidth`
571
+ // inside of getTableScalingPercent returns 0.
572
+ if (!((_this2$props$options = _this2.props.options) !== null && _this2$props$options !== void 0 && _this2$props$options.isCommentEditor) || (_this2$props$options2 = _this2.props.options) !== null && _this2$props$options2 !== void 0 && _this2$props$options2.isCommentEditor && tableNode.attrs.width) {
573
+ scalePercent = getTableScalingPercent(tableNode, _this2.table, shouldUseIncreasedScalingPercent);
574
+ } else {
575
+ scalePercent = getScalingPercentForTableWithoutWidth(tableNode, _this2.table);
576
+ }
577
+
578
+ // Request animation frame required for Firefox
575
579
  updateColgroup(resizeState, _this2.table, tableNode, shouldScaleOnColgroupUpdate, scalePercent);
576
580
  });
577
581
  }
@@ -583,8 +587,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
583
587
  }, {
584
588
  key: "componentDidUpdate",
585
589
  value: function componentDidUpdate(_, prevState) {
586
- var _this$props$options10,
587
- _this$props$options11,
590
+ var _this$props$options8,
591
+ _this$props$options9,
588
592
  _this$wrapper,
589
593
  _this3 = this;
590
594
  var _this$props11 = this.props,
@@ -613,7 +617,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
613
617
  shouldHandleColgroupUpdates = true;
614
618
  }
615
619
  var isTableScalingWithFixedColumnWidthsOptionEnabled = !!isTableScalingEnabled && tableWithFixedColumnWidthsOption;
616
- var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || !!isTableScalingEnabled && !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor);
620
+ var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled && fg('platform.editor.table.use-increased-scaling-percent') || !!isTableScalingEnabled && !!((_this$props$options8 = this.props.options) !== null && _this$props$options8 !== void 0 && _this$props$options8.isCommentEditor);
617
621
  if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
618
622
  shouldScale = true;
619
623
  shouldHandleColgroupUpdates = true;
@@ -624,7 +628,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
624
628
  if (isInDanger && !table) {
625
629
  clearHoverSelection()(view.state, view.dispatch);
626
630
  }
627
- if ((_this$props$options11 = this.props.options) !== null && _this$props$options11 !== void 0 && _this$props$options11.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
631
+ if ((_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor && options !== null && options !== void 0 && options.isTableResizingEnabled) {
628
632
  this.removeInlineTableWidth();
629
633
  }
630
634
  if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
@@ -711,7 +715,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
711
715
  key: "render",
712
716
  value: function render() {
713
717
  var _this4 = this,
714
- _this$props$options12,
718
+ _this$props$options10,
715
719
  _classnames;
716
720
  var _this$props12 = this.props,
717
721
  view = _this$props12.view,
@@ -830,7 +834,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
830
834
  stickyScrollbar = _getEditorFeatureFlag8.stickyScrollbar,
831
835
  _getEditorFeatureFlag9 = _getEditorFeatureFlag8.tableWithFixedColumnWidthsOption,
832
836
  tableWithFixedColumnWidthsOption = _getEditorFeatureFlag9 === void 0 ? false : _getEditorFeatureFlag9;
833
- var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent') || !!((_this$props$options12 = this.props.options) !== null && _this$props$options12 !== void 0 && _this$props$options12.isCommentEditor));
837
+ var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption && fg('platform.editor.table.use-increased-scaling-percent') || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
834
838
  return /*#__PURE__*/React.createElement(TableContainer
835
839
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
836
840
  , {
@@ -110,6 +110,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
110
110
  isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
111
111
  isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
112
112
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
113
+ isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
113
114
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
114
115
  })(state.schema);
115
116
  return (_api$contentInsertion = api === null || api === void 0 || (_api$contentInsertion2 = api.contentInsertion) === null || _api$contentInsertion2 === void 0 || (_api$contentInsertion2 = _api$contentInsertion2.actions) === null || _api$contentInsertion2 === void 0 ? void 0 : _api$contentInsertion2.insert({
@@ -213,9 +214,11 @@ var tablesPlugin = function tablesPlugin(_ref) {
213
214
  fullWidthEnabled = _ref7$fullWidthEnable === void 0 ? false : _ref7$fullWidthEnable,
214
215
  _ref7$isCommentEditor = _ref7.isCommentEditor,
215
216
  isCommentEditor = _ref7$isCommentEditor === void 0 ? false : _ref7$isCommentEditor,
217
+ _ref7$isChromelessEdi = _ref7.isChromelessEditor,
218
+ isChromelessEditor = _ref7$isChromelessEdi === void 0 ? false : _ref7$isChromelessEdi,
216
219
  _ref7$tableResizingEn = _ref7.tableResizingEnabled,
217
220
  tableResizingEnabled = _ref7$tableResizingEn === void 0 ? false : _ref7$tableResizingEn;
218
- return keymapPlugin(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, tableResizingEnabled);
221
+ return keymapPlugin(defaultGetEditorContainerWidth, api, editorAnalyticsAPI, dragAndDropEnabled, isTableScalingEnabled, isTableAlignmentEnabled, fullWidthEnabled, api, getIntl, isCellBackgroundDuplicated, isTableFixedColumnWidthsOptionEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, tableResizingEnabled);
219
222
  }
220
223
  }, {
221
224
  name: 'tableSelectionKeymap',
@@ -482,6 +485,7 @@ var tablesPlugin = function tablesPlugin(_ref) {
482
485
  isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.isTableAlignmentEnabled,
483
486
  isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
484
487
  isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
488
+ isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
485
489
  isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableResizingEnabled
486
490
  })(state.schema);
487
491
  var tr = insert(tableNode);
@@ -19,12 +19,13 @@ export function keymapPlugin(getEditorContainerWidth, api, editorAnalyticsAPI, d
19
19
  var isTableFixedColumnWidthsOptionEnabled = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : false;
20
20
  var shouldUseIncreasedScalingPercent = arguments.length > 11 ? arguments[11] : undefined;
21
21
  var isCommentEditor = arguments.length > 12 ? arguments[12] : undefined;
22
- var isTableResizingEnabled = arguments.length > 13 ? arguments[13] : undefined;
22
+ var isChromelessEditor = arguments.length > 13 ? arguments[13] : undefined;
23
+ var isTableResizingEnabled = arguments.length > 14 ? arguments[14] : undefined;
23
24
  var list = {};
24
25
  var ariaNotifyPlugin = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.accessibilityUtils) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions.ariaNotify;
25
26
  bindKeymapWithCommand(nextCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1), list);
26
27
  bindKeymapWithCommand(previousCell.common, goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1), list);
27
- bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isTableResizingEnabled), list);
28
+ bindKeymapWithCommand(toggleTable.common, createTable(isTableScalingEnabled, isTableAlignmentEnabled, !!isFullWidthEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled), list);
28
29
  bindKeymapWithCommand(backspace.common, chainCommands(deleteTableIfSelectedWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD), emptyMultipleCellsWithAnalytics(editorAnalyticsAPI)(INPUT_METHOD.KEYBOARD)), list);
29
30
  bindKeymapWithCommand(backspace.common, moveCursorBackward, list);
30
31
 
@@ -8,6 +8,7 @@ export var createTableWithWidth = function createTableWithWidth(_ref) {
8
8
  isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
9
9
  isFullWidthModeEnabled = _ref.isFullWidthModeEnabled,
10
10
  isCommentEditor = _ref.isCommentEditor,
11
+ isChromelessEditor = _ref.isChromelessEditor,
11
12
  isTableResizingEnabled = _ref.isTableResizingEnabled,
12
13
  createTableProps = _ref.createTableProps;
13
14
  return function (schema) {
@@ -18,7 +19,7 @@ export var createTableWithWidth = function createTableWithWidth(_ref) {
18
19
  if (isTableAlignmentEnabled && (isFullWidthModeEnabled || isCommentEditor)) {
19
20
  attrsOverrides.layout = 'align-start';
20
21
  }
21
- if (isCommentEditor && isTableResizingEnabled) {
22
+ if (isCommentEditor && isTableResizingEnabled || isChromelessEditor) {
22
23
  attrsOverrides.tableWidth = 'inherit';
23
24
  }
24
25
  return createTable(_objectSpread(_objectSpread({
@@ -9,5 +9,5 @@ export declare const addColumnBefore: (api: PluginInjectionAPI | undefined | nul
9
9
  export declare const addColumnAfter: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => Command;
10
10
  export declare const insertColumn: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => (column: number) => Command;
11
11
  export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
12
- export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
13
- export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
12
+ export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
13
+ export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean, isChromelessEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
@@ -3,5 +3,5 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
5
5
  import type { PluginInjectionAPI, PluginInjectionAPIWithA11y } from '../types';
6
- export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
6
+ export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
7
7
  export default keymapPlugin;
@@ -1,9 +1,10 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
- export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isTableResizingEnabled, createTableProps, }: {
2
+ export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isChromelessEditor, isTableResizingEnabled, createTableProps, }: {
3
3
  isTableScalingEnabled?: boolean | undefined;
4
4
  isTableAlignmentEnabled?: boolean | undefined;
5
5
  isFullWidthModeEnabled?: boolean | undefined;
6
6
  isCommentEditor?: boolean | undefined;
7
+ isChromelessEditor?: boolean | undefined;
7
8
  isTableResizingEnabled?: boolean | undefined;
8
9
  createTableProps?: {
9
10
  rowsCount?: number | undefined;
@@ -9,5 +9,5 @@ export declare const addColumnBefore: (api: PluginInjectionAPI | undefined | nul
9
9
  export declare const addColumnAfter: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => Command;
10
10
  export declare const insertColumn: (api: PluginInjectionAPI | undefined | null, isTableScalingEnabled?: boolean, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean) => (column: number) => Command;
11
11
  export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean, isCellBackgroundDuplicated?: boolean) => Command;
12
- export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
13
- export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
12
+ export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
13
+ export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean, isChromelessEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
@@ -3,5 +3,5 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
3
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
4
  import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
5
5
  import type { PluginInjectionAPI, PluginInjectionAPIWithA11y } from '../types';
6
- export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
6
+ export declare function keymapPlugin(getEditorContainerWidth: GetEditorContainerWidth, api: PluginInjectionAPI | undefined | null, editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null, dragAndDropEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthEnabled?: boolean, pluginInjectionApi?: PluginInjectionAPIWithA11y, getIntl?: () => IntlShape, isCellBackgroundDuplicated?: boolean, isTableFixedColumnWidthsOptionEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean): SafePlugin;
7
7
  export default keymapPlugin;
@@ -1,9 +1,10 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
- export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isTableResizingEnabled, createTableProps, }: {
2
+ export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isChromelessEditor, isTableResizingEnabled, createTableProps, }: {
3
3
  isTableScalingEnabled?: boolean | undefined;
4
4
  isTableAlignmentEnabled?: boolean | undefined;
5
5
  isFullWidthModeEnabled?: boolean | undefined;
6
6
  isCommentEditor?: boolean | undefined;
7
+ isChromelessEditor?: boolean | undefined;
7
8
  isTableResizingEnabled?: boolean | undefined;
8
9
  createTableProps?: {
9
10
  rowsCount?: number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "7.25.13",
3
+ "version": "7.25.15",
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.9.0",
32
32
  "@atlaskit/button": "^20.1.0",
33
33
  "@atlaskit/custom-steps": "^0.7.0",
34
- "@atlaskit/editor-common": "^88.2.0",
34
+ "@atlaskit/editor-common": "^88.4.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.8.0",
@@ -249,6 +249,7 @@ export const createTable =
249
249
  isFullWidthModeEnabled?: boolean,
250
250
  editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null,
251
251
  isCommentEditor?: boolean,
252
+ isChromelessEditor?: boolean,
252
253
  isTableResizingEnabled?: boolean,
253
254
  ): Command =>
254
255
  (state, dispatch) => {
@@ -257,6 +258,7 @@ export const createTable =
257
258
  isTableAlignmentEnabled,
258
259
  isFullWidthModeEnabled,
259
260
  isCommentEditor,
261
+ isChromelessEditor,
260
262
  isTableResizingEnabled,
261
263
  })(state.schema);
262
264
 
@@ -284,6 +286,7 @@ export const insertTableWithSize =
284
286
  isTableAlignmentEnabled?: boolean,
285
287
  editorAnalyticsAPI?: EditorAnalyticsAPI,
286
288
  isCommentEditor?: boolean,
289
+ isChromelessEditor?: boolean,
287
290
  ) =>
288
291
  (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER): EditorCommand => {
289
292
  return ({ tr }) => {
@@ -292,6 +295,7 @@ export const insertTableWithSize =
292
295
  isFullWidthModeEnabled,
293
296
  isTableAlignmentEnabled,
294
297
  isCommentEditor,
298
+ isChromelessEditor,
295
299
  createTableProps: {
296
300
  rowsCount: rowsCount,
297
301
  colsCount: colsCount,
@@ -483,21 +483,24 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
483
483
  }
484
484
 
485
485
  let scalePercent = 1;
486
- if (
487
- !this.props.options?.isCommentEditor ||
488
- (this.props.options?.isCommentEditor && tableNode.attrs.width)
489
- ) {
490
- scalePercent = getTableScalingPercent(
491
- tableNode,
492
- this.table!,
493
- shouldUseIncreasedScalingPercent,
494
- );
495
- } else {
496
- scalePercent = getScalingPercentForTableWithoutWidth(tableNode, this.table!);
497
- }
498
-
499
- // Request animation frame required for Firefox
500
486
  requestAnimationFrame(() => {
487
+ // Scaling percent has to be calculated inside requestAnimationFrame, otherwise
488
+ // renderWidth calculated as `tableRef?.parentElement?.clientWidth`
489
+ // inside of getTableScalingPercent returns 0.
490
+ if (
491
+ !this.props.options?.isCommentEditor ||
492
+ (this.props.options?.isCommentEditor && tableNode.attrs.width)
493
+ ) {
494
+ scalePercent = getTableScalingPercent(
495
+ tableNode,
496
+ this.table!,
497
+ shouldUseIncreasedScalingPercent,
498
+ );
499
+ } else {
500
+ scalePercent = getScalingPercentForTableWithoutWidth(tableNode, this.table!);
501
+ }
502
+
503
+ // Request animation frame required for Firefox
501
504
  updateColgroup(
502
505
  resizeState,
503
506
  this.table!,
package/src/plugin.tsx CHANGED
@@ -218,6 +218,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
218
218
  isTableAlignmentEnabled: options?.isTableAlignmentEnabled,
219
219
  isFullWidthModeEnabled: options?.fullWidthEnabled,
220
220
  isCommentEditor: options?.isCommentEditor,
221
+ isChromelessEditor: options?.isChromelessEditor,
221
222
  isTableResizingEnabled: options?.tableResizingEnabled,
222
223
  })(state.schema);
223
224
 
@@ -360,6 +361,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
360
361
  isTableAlignmentEnabled = false,
361
362
  fullWidthEnabled = false,
362
363
  isCommentEditor = false,
364
+ isChromelessEditor = false,
363
365
  tableResizingEnabled = false,
364
366
  } = options || ({} as TablePluginOptions);
365
367
 
@@ -377,6 +379,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
377
379
  isTableFixedColumnWidthsOptionEnabled,
378
380
  shouldUseIncreasedScalingPercent,
379
381
  isCommentEditor,
382
+ isChromelessEditor,
380
383
  tableResizingEnabled,
381
384
  );
382
385
  },
@@ -705,6 +708,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
705
708
  isTableAlignmentEnabled: options?.isTableAlignmentEnabled,
706
709
  isFullWidthModeEnabled: tableState?.isFullWidthModeEnabled,
707
710
  isCommentEditor: options?.isCommentEditor,
711
+ isChromelessEditor: options?.isChromelessEditor,
708
712
  isTableResizingEnabled: options?.tableResizingEnabled,
709
713
  })(state.schema);
710
714
 
@@ -71,6 +71,7 @@ export function keymapPlugin(
71
71
  isTableFixedColumnWidthsOptionEnabled = false,
72
72
  shouldUseIncreasedScalingPercent?: boolean,
73
73
  isCommentEditor?: boolean,
74
+ isChromelessEditor?: boolean,
74
75
  isTableResizingEnabled?: boolean,
75
76
  ): SafePlugin {
76
77
  const list = {};
@@ -95,6 +96,7 @@ export function keymapPlugin(
95
96
  !!isFullWidthEnabled,
96
97
  editorAnalyticsAPI,
97
98
  isCommentEditor,
99
+ isChromelessEditor,
98
100
  isTableResizingEnabled,
99
101
  ),
100
102
  list,
@@ -135,7 +135,7 @@ export const getTableScalingPercent = (
135
135
  : MAX_SCALING_PERCENT;
136
136
 
137
137
  const tableWidth = getTableContainerElementWidth(table);
138
- let renderWidth = tableRef?.parentElement?.clientWidth || tableWidth;
138
+ const renderWidth = tableRef?.parentElement?.clientWidth || tableWidth;
139
139
  // minus 1 here to avoid any 1px scroll in Firefox
140
140
  let scalePercent = (renderWidth - 1) / tableWidth;
141
141
  scalePercent = Math.max(scalePercent, 1 - maxScalingPercent);
@@ -15,6 +15,7 @@ export const createTableWithWidth =
15
15
  isTableAlignmentEnabled,
16
16
  isFullWidthModeEnabled,
17
17
  isCommentEditor,
18
+ isChromelessEditor,
18
19
  isTableResizingEnabled,
19
20
  createTableProps,
20
21
  }: {
@@ -22,6 +23,7 @@ export const createTableWithWidth =
22
23
  isTableAlignmentEnabled?: boolean;
23
24
  isFullWidthModeEnabled?: boolean;
24
25
  isCommentEditor?: boolean;
26
+ isChromelessEditor?: boolean;
25
27
  isTableResizingEnabled?: boolean;
26
28
  createTableProps?: {
27
29
  rowsCount?: number;
@@ -36,7 +38,7 @@ export const createTableWithWidth =
36
38
  if (isTableAlignmentEnabled && (isFullWidthModeEnabled || isCommentEditor)) {
37
39
  attrsOverrides.layout = 'align-start';
38
40
  }
39
- if (isCommentEditor && isTableResizingEnabled) {
41
+ if ((isCommentEditor && isTableResizingEnabled) || isChromelessEditor) {
40
42
  attrsOverrides.tableWidth = 'inherit';
41
43
  }
42
44