@atlaskit/editor-plugin-table 24.0.2 → 24.0.3

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
+ ## 24.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`bafa7b1c23370`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bafa7b1c23370) -
8
+ Clean up experiment `platform_editor_fix_editor_unhandled_type_errors`
9
+ - [`1e2c964dbe54e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1e2c964dbe54e) -
10
+ Clean up feature gate `platform_editor_update_table_ref_fix`
11
+ - [`137ce6a6d525e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/137ce6a6d525e) -
12
+ Prevent automatic table fit-to-content conversion from rewriting resized tables
13
+ - Updated dependencies
14
+
3
15
  ## 24.0.2
4
16
 
5
17
  ### Patch Changes
@@ -103,9 +103,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
103
103
  if (tableElement !== _this.table) {
104
104
  _this.table = tableElement;
105
105
  _this.observeTable(_this.table);
106
- if (_this.table && (!(0, _expValEquals.expValEquals)('platform_editor_table_ref_optimisation', 'isEnabled', true) || _this.props.tableActive) && _this.props.view && !(0, _expValEquals.expValEquals)('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true) || (0, _platformFeatureFlags.fg)('platform_editor_enable_table_update_ref_atlas'))) {
107
- (0, _commands.setTableRef)(_this.table)(_this.props.view.state, _this.props.view.dispatch);
108
- }
109
106
  }
110
107
  });
111
108
  (0, _defineProperty2.default)(_this, "onStickyState", function (state) {
@@ -807,7 +804,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
807
804
  }, {
808
805
  key: "dispatchTableRefUpdate",
809
806
  value: function dispatchTableRefUpdate() {
810
- if (this.table && this.table !== this.lastSetTableRef && (!(0, _expValEquals.expValEquals)('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view && (0, _expValEquals.expValEquals)('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true) || (0, _platformFeatureFlags.fg)('platform_editor_enable_table_update_ref_atlas'))) {
807
+ if (this.table && this.table !== this.lastSetTableRef && (!(0, _expValEquals.expValEquals)('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view && ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true) || (0, _platformFeatureFlags.fg)('platform_editor_enable_table_update_ref_atlas'))) {
811
808
  this.lastSetTableRef = this.table;
812
809
  (0, _commands.setTableRef)(this.table)(this.props.view.state, this.props.view.dispatch);
813
810
  }
@@ -37,7 +37,7 @@ var _applyMeasuredWidthToAllTables = require("./utils/tableMode/apply-measured-w
37
37
  var _isContentModeSupported = require("./utils/tableMode/is-content-mode-supported");
38
38
  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; }
39
39
  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) { (0, _defineProperty2.default)(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; }
40
- var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption) {
40
+ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption, __livePage) {
41
41
  var _accessibilityUtils;
42
42
  var state = (0, _pluginFactory.createPluginState)(dispatch, _objectSpread(_objectSpread(_objectSpread({
43
43
  pluginConfig: pluginConfig,
@@ -143,7 +143,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
143
143
  editorViewRef = editorView;
144
144
  var contentModeSizeTableId = null;
145
145
  var focusListenerBinding = null;
146
- if ((pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.mode) !== 'view' && (0, _isContentModeSupported.isContentModeSupported)({
146
+ if ((!(0, _platformFeatureFlags.fg)('platform_editor_table_auto_convert_fix') || !__livePage) && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.mode) !== 'view' && (0, _isContentModeSupported.isContentModeSupported)({
147
147
  allowColumnResizing: !!pluginConfig.allowColumnResizing,
148
148
  allowTableResizing: !!pluginConfig.allowTableResizing,
149
149
  isFullPageEditor: !isChromelessEditor && !isCommentEditor
@@ -176,7 +176,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatchAnalytic
176
176
  var tableRef;
177
177
  var parent = (0, _utils2.findParentDomRefOfType)(state.schema.nodes.table, domAtPos)(selection);
178
178
  var shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view';
179
- if ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true) && (0, _platformFeatureFlags.fg)('platform_editor_update_table_ref_fix')) {
179
+ if ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true)) {
180
180
  var _pluginInjectionApi$e3, _pluginInjectionApi$i;
181
181
  shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 || (_pluginInjectionApi$e3 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 || (_pluginInjectionApi$i = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.interactionState) !== 'hasNotHadInteraction';
182
182
  }
@@ -7,6 +7,7 @@ exports.applyMeasuredWidthToAllTables = void 0;
7
7
  var _analytics = require("@atlaskit/editor-common/analytics");
8
8
  var _styles = require("@atlaskit/editor-common/styles");
9
9
  var _table = require("@atlaskit/editor-common/table");
10
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
11
  var _contentMode = require("../../transforms/content-mode");
11
12
  /**
12
13
  * Iterates all top-level tables in the document, and for those in content mode,
@@ -24,8 +25,18 @@ var applyMeasuredWidthToAllTables = exports.applyMeasuredWidthToAllTables = func
24
25
 
25
26
  // modify only top-level tables
26
27
  doc.forEach(function (node, offset) {
27
- if (node.type !== table || (0, _table.hasTableBeenResized)(node) && node.attrs.layout !== 'align-start') {
28
- return;
28
+ if ((0, _platformFeatureFlags.fg)('platform_editor_table_auto_convert_fix')) {
29
+ if (node.type !== table || !(0, _table.isTableInContentMode)({
30
+ tableNode: node,
31
+ isSupported: true,
32
+ isTableNested: false
33
+ })) {
34
+ return;
35
+ }
36
+ } else {
37
+ if (node.type !== table || (0, _table.hasTableBeenResized)(node) && node.attrs.layout !== 'align-start') {
38
+ return;
39
+ }
29
40
  }
30
41
  var domNode = view.domAtPos(offset + 1).node;
31
42
  var tableWrapper = domNode instanceof HTMLElement ? domNode.closest(".".concat(_styles.TableSharedCssClassName.TABLE_VIEW_CONTENT_WRAP)) : null;
@@ -306,8 +306,9 @@ var tablePlugin = function tablePlugin(_ref) {
306
306
  getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
307
307
  isTableScalingEnabled = _ref3.isTableScalingEnabled,
308
308
  isCommentEditor = _ref3.isCommentEditor,
309
- isChromelessEditor = _ref3.isChromelessEditor;
310
- return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
309
+ isChromelessEditor = _ref3.isChromelessEditor,
310
+ __livePage = _ref3.__livePage;
311
+ return (0, _main.createPlugin)(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, (0, _createPluginConfig.pluginConfig)(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption, __livePage);
311
312
  }
312
313
  }, {
313
314
  name: 'tablePMColResizing',
@@ -82,9 +82,6 @@ class TableComponent extends React.Component {
82
82
  if (tableElement !== this.table) {
83
83
  this.table = tableElement;
84
84
  this.observeTable(this.table);
85
- if (this.table && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view && !expValEquals('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
86
- setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
87
- }
88
85
  }
89
86
  });
90
87
  _defineProperty(this, "onStickyState", state => {
@@ -768,7 +765,7 @@ class TableComponent extends React.Component {
768
765
  this.dispatchTableRefUpdate();
769
766
  }
770
767
  dispatchTableRefUpdate() {
771
- if (this.table && this.table !== this.lastSetTableRef && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view && expValEquals('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
768
+ if (this.table && this.table !== this.lastSetTableRef && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
772
769
  this.lastSetTableRef = this.table;
773
770
  setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
774
771
  }
@@ -27,7 +27,7 @@ import { findControlsHoverDecoration } from './utils/decoration';
27
27
  import { transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable, transformSliceToRemoveNestedTables, isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from './utils/paste';
28
28
  import { applyMeasuredWidthToAllTables } from './utils/tableMode/apply-measured-width-to-all-tables';
29
29
  import { isContentModeSupported } from './utils/tableMode/is-content-mode-supported';
30
- export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption) => {
30
+ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption, __livePage) => {
31
31
  var _accessibilityUtils;
32
32
  const state = createPluginState(dispatch, {
33
33
  pluginConfig,
@@ -128,7 +128,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
128
128
  editorViewRef = editorView;
129
129
  let contentModeSizeTableId = null;
130
130
  let focusListenerBinding = null;
131
- if ((pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : (_pluginInjectionApi$e2 = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view' && isContentModeSupported({
131
+ if ((!fg('platform_editor_table_auto_convert_fix') || !__livePage) && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 ? void 0 : (_pluginInjectionApi$e2 = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view' && isContentModeSupported({
132
132
  allowColumnResizing: !!pluginConfig.allowColumnResizing,
133
133
  allowTableResizing: !!pluginConfig.allowTableResizing,
134
134
  isFullPageEditor: !isChromelessEditor && !isCommentEditor
@@ -165,7 +165,7 @@ export const createPlugin = (dispatchAnalyticsEvent, dispatch, portalProviderAPI
165
165
  let tableRef;
166
166
  const parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
167
167
  let shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : (_pluginInjectionApi$e4 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e4 === void 0 ? void 0 : _pluginInjectionApi$e4.mode) !== 'view';
168
- if (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) && fg('platform_editor_update_table_ref_fix')) {
168
+ if (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true)) {
169
169
  var _pluginInjectionApi$e5, _pluginInjectionApi$e6, _pluginInjectionApi$i, _pluginInjectionApi$i2;
170
170
  shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$e5 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e5 === void 0 ? void 0 : (_pluginInjectionApi$e6 = _pluginInjectionApi$e5.sharedState.currentState()) === null || _pluginInjectionApi$e6 === void 0 ? void 0 : _pluginInjectionApi$e6.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 ? void 0 : (_pluginInjectionApi$i2 = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i2 === void 0 ? void 0 : _pluginInjectionApi$i2.interactionState) !== 'hasNotHadInteraction';
171
171
  }
@@ -1,6 +1,7 @@
1
1
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
2
2
  import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
3
- import { hasTableBeenResized } from '@atlaskit/editor-common/table';
3
+ import { hasTableBeenResized, isTableInContentMode } from '@atlaskit/editor-common/table';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { applyTableMeasurement, getTableMeasurement } from '../../transforms/content-mode';
5
6
 
6
7
  /**
@@ -24,8 +25,18 @@ export const applyMeasuredWidthToAllTables = (view, pluginInjectionApi) => {
24
25
 
25
26
  // modify only top-level tables
26
27
  doc.forEach((node, offset) => {
27
- if (node.type !== table || hasTableBeenResized(node) && node.attrs.layout !== 'align-start') {
28
- return;
28
+ if (fg('platform_editor_table_auto_convert_fix')) {
29
+ if (node.type !== table || !isTableInContentMode({
30
+ tableNode: node,
31
+ isSupported: true,
32
+ isTableNested: false
33
+ })) {
34
+ return;
35
+ }
36
+ } else {
37
+ if (node.type !== table || hasTableBeenResized(node) && node.attrs.layout !== 'align-start') {
38
+ return;
39
+ }
29
40
  }
30
41
  const domNode = view.domAtPos(offset + 1).node;
31
42
  const tableWrapper = domNode instanceof HTMLElement ? domNode.closest(`.${TableSharedCssClassName.TABLE_VIEW_CONTENT_WRAP}`) : null;
@@ -294,9 +294,10 @@ const tablePlugin = ({
294
294
  getEditorFeatureFlags,
295
295
  isTableScalingEnabled,
296
296
  isCommentEditor,
297
- isChromelessEditor
297
+ isChromelessEditor,
298
+ __livePage
298
299
  } = options || {};
299
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
300
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption, __livePage);
300
301
  }
301
302
  }, {
302
303
  name: 'tablePMColResizing',
@@ -97,9 +97,6 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
97
97
  if (tableElement !== _this.table) {
98
98
  _this.table = tableElement;
99
99
  _this.observeTable(_this.table);
100
- if (_this.table && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || _this.props.tableActive) && _this.props.view && !expValEquals('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
101
- setTableRef(_this.table)(_this.props.view.state, _this.props.view.dispatch);
102
- }
103
100
  }
104
101
  });
105
102
  _defineProperty(_this, "onStickyState", function (state) {
@@ -801,7 +798,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
801
798
  }, {
802
799
  key: "dispatchTableRefUpdate",
803
800
  value: function dispatchTableRefUpdate() {
804
- if (this.table && this.table !== this.lastSetTableRef && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view && expValEquals('platform_editor_fix_editor_unhandled_type_errors', 'isEnabled', true) && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
801
+ if (this.table && this.table !== this.lastSetTableRef && (!expValEquals('platform_editor_table_ref_optimisation', 'isEnabled', true) || this.props.tableActive) && this.props.view && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
805
802
  this.lastSetTableRef = this.table;
806
803
  setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
807
804
  }
@@ -30,7 +30,7 @@ import { findControlsHoverDecoration } from './utils/decoration';
30
30
  import { transformSliceToCorrectEmptyTableCells, transformSliceToFixHardBreakProblemOnCopyFromCell, transformSliceToRemoveOpenTable, transformSliceToRemoveNestedTables, isHeaderRowRequired, transformSliceTableLayoutDefaultToCenter } from './utils/paste';
31
31
  import { applyMeasuredWidthToAllTables } from './utils/tableMode/apply-measured-width-to-all-tables';
32
32
  import { isContentModeSupported } from './utils/tableMode/is-content-mode-supported';
33
- export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption) {
33
+ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig, getEditorContainerWidth, getEditorFeatureFlags, getIntl, fullWidthModeEnabled, previousFullWidthModeEnabled, editorAnalyticsAPI, pluginInjectionApi, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, allowFixedColumnWidthOption, __livePage) {
34
34
  var _accessibilityUtils;
35
35
  var state = createPluginState(dispatch, _objectSpread(_objectSpread(_objectSpread({
36
36
  pluginConfig: pluginConfig,
@@ -136,7 +136,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
136
136
  editorViewRef = editorView;
137
137
  var contentModeSizeTableId = null;
138
138
  var focusListenerBinding = null;
139
- if ((pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.mode) !== 'view' && isContentModeSupported({
139
+ if ((!fg('platform_editor_table_auto_convert_fix') || !__livePage) && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e === void 0 || (_pluginInjectionApi$e = _pluginInjectionApi$e.sharedState.currentState()) === null || _pluginInjectionApi$e === void 0 ? void 0 : _pluginInjectionApi$e.mode) !== 'view' && isContentModeSupported({
140
140
  allowColumnResizing: !!pluginConfig.allowColumnResizing,
141
141
  allowTableResizing: !!pluginConfig.allowTableResizing,
142
142
  isFullPageEditor: !isChromelessEditor && !isCommentEditor
@@ -169,7 +169,7 @@ export var createPlugin = function createPlugin(dispatchAnalyticsEvent, dispatch
169
169
  var tableRef;
170
170
  var parent = findParentDomRefOfType(state.schema.nodes.table, domAtPos)(selection);
171
171
  var shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e2 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e2 === void 0 || (_pluginInjectionApi$e2 = _pluginInjectionApi$e2.sharedState.currentState()) === null || _pluginInjectionApi$e2 === void 0 ? void 0 : _pluginInjectionApi$e2.mode) !== 'view';
172
- if (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) && fg('platform_editor_update_table_ref_fix')) {
172
+ if (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true)) {
173
173
  var _pluginInjectionApi$e3, _pluginInjectionApi$i;
174
174
  shouldSetTableRef = parent && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$e3 = pluginInjectionApi.editorViewMode) === null || _pluginInjectionApi$e3 === void 0 || (_pluginInjectionApi$e3 = _pluginInjectionApi$e3.sharedState.currentState()) === null || _pluginInjectionApi$e3 === void 0 ? void 0 : _pluginInjectionApi$e3.mode) !== 'view' && (pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$i = pluginInjectionApi.interaction) === null || _pluginInjectionApi$i === void 0 || (_pluginInjectionApi$i = _pluginInjectionApi$i.sharedState.currentState()) === null || _pluginInjectionApi$i === void 0 ? void 0 : _pluginInjectionApi$i.interactionState) !== 'hasNotHadInteraction';
175
175
  }
@@ -1,6 +1,7 @@
1
1
  import { ACTION_SUBJECT, EVENT_TYPE, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
2
2
  import { TableSharedCssClassName } from '@atlaskit/editor-common/styles';
3
- import { hasTableBeenResized } from '@atlaskit/editor-common/table';
3
+ import { hasTableBeenResized, isTableInContentMode } from '@atlaskit/editor-common/table';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  import { applyTableMeasurement, getTableMeasurement } from '../../transforms/content-mode';
5
6
 
6
7
  /**
@@ -19,8 +20,18 @@ export var applyMeasuredWidthToAllTables = function applyMeasuredWidthToAllTable
19
20
 
20
21
  // modify only top-level tables
21
22
  doc.forEach(function (node, offset) {
22
- if (node.type !== table || hasTableBeenResized(node) && node.attrs.layout !== 'align-start') {
23
- return;
23
+ if (fg('platform_editor_table_auto_convert_fix')) {
24
+ if (node.type !== table || !isTableInContentMode({
25
+ tableNode: node,
26
+ isSupported: true,
27
+ isTableNested: false
28
+ })) {
29
+ return;
30
+ }
31
+ } else {
32
+ if (node.type !== table || hasTableBeenResized(node) && node.attrs.layout !== 'align-start') {
33
+ return;
34
+ }
24
35
  }
25
36
  var domNode = view.domAtPos(offset + 1).node;
26
37
  var tableWrapper = domNode instanceof HTMLElement ? domNode.closest(".".concat(TableSharedCssClassName.TABLE_VIEW_CONTENT_WRAP)) : null;
@@ -297,8 +297,9 @@ var tablePlugin = function tablePlugin(_ref) {
297
297
  getEditorFeatureFlags = _ref3.getEditorFeatureFlags,
298
298
  isTableScalingEnabled = _ref3.isTableScalingEnabled,
299
299
  isCommentEditor = _ref3.isCommentEditor,
300
- isChromelessEditor = _ref3.isChromelessEditor;
301
- return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption);
300
+ isChromelessEditor = _ref3.isChromelessEditor,
301
+ __livePage = _ref3.__livePage;
302
+ return createPlugin(dispatchAnalyticsEvent, dispatch, portalProviderAPI, nodeViewPortalProviderAPI, eventDispatcher, pluginConfig(tableOptions), defaultGetEditorContainerWidth, getEditorFeatureFlags || defaultGetEditorFeatureFlags, getIntl, fullWidthEnabled, wasFullWidthEnabled, editorAnalyticsAPI, api, isTableScalingEnabled, shouldUseIncreasedScalingPercent, isCommentEditor, isChromelessEditor, options === null || options === void 0 ? void 0 : options.allowFixedColumnWidthOption, __livePage);
302
303
  }
303
304
  }, {
304
305
  name: 'tablePMColResizing',
@@ -5,4 +5,4 @@ import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
5
5
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
6
  import type { GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
7
7
  import type { PluginConfig, PluginInjectionAPI, TablePluginState } from '../types';
8
- export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, allowFixedColumnWidthOption?: boolean) => SafePlugin<TablePluginState>;
8
+ export declare const createPlugin: (dispatchAnalyticsEvent: DispatchAnalyticsEvent, dispatch: Dispatch, portalProviderAPI: PortalProviderAPI, nodeViewPortalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, pluginConfig: PluginConfig, getEditorContainerWidth: GetEditorContainerWidth, getEditorFeatureFlags: GetEditorFeatureFlags, getIntl: () => IntlShape, fullWidthModeEnabled?: boolean, previousFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, pluginInjectionApi?: PluginInjectionAPI, isTableScalingEnabled?: boolean, shouldUseIncreasedScalingPercent?: boolean, isCommentEditor?: boolean, isChromelessEditor?: boolean, allowFixedColumnWidthOption?: boolean, __livePage?: boolean) => SafePlugin<TablePluginState>;
@@ -17,6 +17,7 @@ import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
17
17
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
18
18
  import type { PluginConfig, TableSharedState } from './types';
19
19
  export interface TablePluginOptions {
20
+ __livePage?: boolean;
20
21
  allowContextualMenu?: boolean;
21
22
  /**
22
23
  * Enables the fixed column width option.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "24.0.2",
3
+ "version": "24.0.3",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -20,16 +20,16 @@
20
20
  "singleton": true
21
21
  },
22
22
  "dependencies": {
23
- "@atlaskit/adf-schema": "^55.0.0",
23
+ "@atlaskit/adf-schema": "^55.2.0",
24
24
  "@atlaskit/button": "^24.0.0",
25
25
  "@atlaskit/custom-steps": "^1.0.0",
26
- "@atlaskit/editor-palette": "^3.0.0",
26
+ "@atlaskit/editor-palette": "^3.1.0",
27
27
  "@atlaskit/editor-plugin-accessibility-utils": "^12.0.0",
28
28
  "@atlaskit/editor-plugin-analytics": "^12.0.0",
29
29
  "@atlaskit/editor-plugin-batch-attribute-updates": "^12.0.0",
30
30
  "@atlaskit/editor-plugin-content-insertion": "^12.0.0",
31
31
  "@atlaskit/editor-plugin-editor-viewmode": "^14.0.0",
32
- "@atlaskit/editor-plugin-extension": "15.0.2",
32
+ "@atlaskit/editor-plugin-extension": "15.0.3",
33
33
  "@atlaskit/editor-plugin-guideline": "^12.0.0",
34
34
  "@atlaskit/editor-plugin-interaction": "^21.0.0",
35
35
  "@atlaskit/editor-plugin-limited-mode": "^9.0.0",
@@ -52,7 +52,7 @@
52
52
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.0.0",
53
53
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^2.0.0",
54
54
  "@atlaskit/primitives": "^20.0.0",
55
- "@atlaskit/tmp-editor-statsig": "^106.0.0",
55
+ "@atlaskit/tmp-editor-statsig": "^107.1.0",
56
56
  "@atlaskit/toggle": "^17.0.0",
57
57
  "@atlaskit/tokens": "^14.0.0",
58
58
  "@atlaskit/tooltip": "^23.0.0",
@@ -67,7 +67,7 @@
67
67
  "uuid": "^3.1.0"
68
68
  },
69
69
  "peerDependencies": {
70
- "@atlaskit/editor-common": "^116.2.0",
70
+ "@atlaskit/editor-common": "^116.3.0",
71
71
  "react": "^18.2.0",
72
72
  "react-dom": "^18.2.0",
73
73
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -118,6 +118,9 @@
118
118
  "platform_editor_table_fit_to_content_smart_adjust": {
119
119
  "type": "boolean"
120
120
  },
121
+ "platform_editor_table_auto_convert_fix": {
122
+ "type": "boolean"
123
+ },
121
124
  "platform_editor_table_height_analytics": {
122
125
  "type": "boolean"
123
126
  },
@@ -154,9 +157,6 @@
154
157
  "platform_editor_enable_table_update_ref_atlas": {
155
158
  "type": "boolean"
156
159
  },
157
- "platform_editor_update_table_ref_fix": {
158
- "type": "boolean"
159
- },
160
160
  "platform_editor_max_width_default_width": {
161
161
  "type": "boolean"
162
162
  },