@atlaskit/editor-plugin-table 17.7.2 → 18.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 18.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 17.7.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [`477d48a3021a5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/477d48a3021a5) -
14
+ EDITOR-5818 fix to not send dispatch during render or in ref callback
15
+ - Updated dependencies
16
+
3
17
  ## 17.7.2
4
18
 
5
19
  ### Patch Changes
@@ -89,6 +89,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
89
89
  tr.setMeta('mouseEnterTable', [tableId, node, pos]);
90
90
  _this.props.view.dispatch(tr);
91
91
  });
92
+ (0, _defineProperty2.default)(_this, "lastSetTableRef", null);
92
93
  (0, _defineProperty2.default)(_this, "onStickyState", function (state) {
93
94
  var pos = _this.props.getPos();
94
95
  if (!(0, _utils.isValidPosition)(pos, _this.props.view.state)) {
@@ -379,6 +380,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
379
380
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
380
381
  window.addEventListener('resize', this.handleWindowResizeNewDebounced);
381
382
  }
383
+ this.dispatchTableRefUpdate();
382
384
  }
383
385
  }, {
384
386
  key: "initialiseEventListenersAfterMount",
@@ -744,6 +746,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
744
746
  }
745
747
  this.handleTableResizingDebounced();
746
748
  }
749
+ this.dispatchTableRefUpdate();
750
+ }
751
+ }, {
752
+ key: "dispatchTableRefUpdate",
753
+ value: function dispatchTableRefUpdate() {
754
+ if (this.table && this.table !== this.lastSetTableRef && 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'))) {
755
+ this.lastSetTableRef = this.table;
756
+ (0, _commands.setTableRef)(this.table)(this.props.view.state, this.props.view.dispatch);
757
+ }
747
758
  }
748
759
  }, {
749
760
  key: "observeTable",
@@ -917,7 +928,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
917
928
 
918
929
  // // Update tableRef in plugin state when table is properly mounted
919
930
  // // At this point, both table and wrapper are in DOM with correct parent-child relationship
920
- if (_this5.table && _this5.props.view && ((0, _expValEquals.expValEquals)('platform_editor_table_update_table_ref', 'isEnabled', true) || (0, _platformFeatureFlags.fg)('platform_editor_enable_table_update_ref_atlas'))) {
931
+ if (_this5.table && _this5.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'))) {
921
932
  (0, _commands.setTableRef)(_this5.table)(_this5.props.view.state, _this5.props.view.dispatch);
922
933
  }
923
934
  }
@@ -68,6 +68,7 @@ class TableComponent extends React.Component {
68
68
  tr.setMeta('mouseEnterTable', [tableId, node, pos]);
69
69
  this.props.view.dispatch(tr);
70
70
  });
71
+ _defineProperty(this, "lastSetTableRef", null);
71
72
  _defineProperty(this, "onStickyState", state => {
72
73
  const pos = this.props.getPos();
73
74
  if (!isValidPosition(pos, this.props.view.state)) {
@@ -357,6 +358,7 @@ class TableComponent extends React.Component {
357
358
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
358
359
  window.addEventListener('resize', this.handleWindowResizeNewDebounced);
359
360
  }
361
+ this.dispatchTableRefUpdate();
360
362
  }
361
363
  initialiseEventListenersAfterMount() {
362
364
  var _this$table, _this$table2, _this$table3;
@@ -707,6 +709,13 @@ class TableComponent extends React.Component {
707
709
  }
708
710
  this.handleTableResizingDebounced();
709
711
  }
712
+ this.dispatchTableRefUpdate();
713
+ }
714
+ dispatchTableRefUpdate() {
715
+ if (this.table && this.table !== this.lastSetTableRef && 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'))) {
716
+ this.lastSetTableRef = this.table;
717
+ setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
718
+ }
710
719
  }
711
720
  observeTable(table) {
712
721
  if (table) {
@@ -882,7 +891,7 @@ class TableComponent extends React.Component {
882
891
 
883
892
  // // Update tableRef in plugin state when table is properly mounted
884
893
  // // At this point, both table and wrapper are in DOM with correct parent-child relationship
885
- if (this.table && this.props.view && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
894
+ if (this.table && 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'))) {
886
895
  setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
887
896
  }
888
897
  }
@@ -83,6 +83,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
83
83
  tr.setMeta('mouseEnterTable', [tableId, node, pos]);
84
84
  _this.props.view.dispatch(tr);
85
85
  });
86
+ _defineProperty(_this, "lastSetTableRef", null);
86
87
  _defineProperty(_this, "onStickyState", function (state) {
87
88
  var pos = _this.props.getPos();
88
89
  if (!isValidPosition(pos, _this.props.view.state)) {
@@ -373,6 +374,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
373
374
  // eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
374
375
  window.addEventListener('resize', this.handleWindowResizeNewDebounced);
375
376
  }
377
+ this.dispatchTableRefUpdate();
376
378
  }
377
379
  }, {
378
380
  key: "initialiseEventListenersAfterMount",
@@ -738,6 +740,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
738
740
  }
739
741
  this.handleTableResizingDebounced();
740
742
  }
743
+ this.dispatchTableRefUpdate();
744
+ }
745
+ }, {
746
+ key: "dispatchTableRefUpdate",
747
+ value: function dispatchTableRefUpdate() {
748
+ if (this.table && this.table !== this.lastSetTableRef && 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'))) {
749
+ this.lastSetTableRef = this.table;
750
+ setTableRef(this.table)(this.props.view.state, this.props.view.dispatch);
751
+ }
741
752
  }
742
753
  }, {
743
754
  key: "observeTable",
@@ -911,7 +922,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
911
922
 
912
923
  // // Update tableRef in plugin state when table is properly mounted
913
924
  // // At this point, both table and wrapper are in DOM with correct parent-child relationship
914
- if (_this5.table && _this5.props.view && (expValEquals('platform_editor_table_update_table_ref', 'isEnabled', true) || fg('platform_editor_enable_table_update_ref_atlas'))) {
925
+ if (_this5.table && _this5.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'))) {
915
926
  setTableRef(_this5.table)(_this5.props.view.state, _this5.props.view.dispatch);
916
927
  }
917
928
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "17.7.2",
3
+ "version": "18.0.0",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,19 +32,19 @@
32
32
  "@atlaskit/button": "^23.10.0",
33
33
  "@atlaskit/custom-steps": "^0.16.0",
34
34
  "@atlaskit/editor-palette": "^2.1.0",
35
- "@atlaskit/editor-plugin-accessibility-utils": "^7.0.0",
36
- "@atlaskit/editor-plugin-analytics": "^7.0.0",
37
- "@atlaskit/editor-plugin-batch-attribute-updates": "^7.0.0",
38
- "@atlaskit/editor-plugin-content-insertion": "^7.0.0",
39
- "@atlaskit/editor-plugin-editor-viewmode": "^9.0.0",
40
- "@atlaskit/editor-plugin-extension": "10.1.18",
41
- "@atlaskit/editor-plugin-guideline": "^7.0.0",
42
- "@atlaskit/editor-plugin-interaction": "^14.0.0",
43
- "@atlaskit/editor-plugin-limited-mode": "^4.0.0",
44
- "@atlaskit/editor-plugin-selection": "^7.1.0",
45
- "@atlaskit/editor-plugin-toolbar": "^4.1.0",
46
- "@atlaskit/editor-plugin-user-intent": "^5.0.0",
47
- "@atlaskit/editor-plugin-width": "^8.1.0",
35
+ "@atlaskit/editor-plugin-accessibility-utils": "^8.0.0",
36
+ "@atlaskit/editor-plugin-analytics": "^8.0.0",
37
+ "@atlaskit/editor-plugin-batch-attribute-updates": "^8.0.0",
38
+ "@atlaskit/editor-plugin-content-insertion": "^8.0.0",
39
+ "@atlaskit/editor-plugin-editor-viewmode": "^10.0.0",
40
+ "@atlaskit/editor-plugin-extension": "11.0.0",
41
+ "@atlaskit/editor-plugin-guideline": "^8.0.0",
42
+ "@atlaskit/editor-plugin-interaction": "^15.0.0",
43
+ "@atlaskit/editor-plugin-limited-mode": "^5.0.0",
44
+ "@atlaskit/editor-plugin-selection": "^8.0.0",
45
+ "@atlaskit/editor-plugin-toolbar": "^5.0.0",
46
+ "@atlaskit/editor-plugin-user-intent": "^6.0.0",
47
+ "@atlaskit/editor-plugin-width": "^9.0.0",
48
48
  "@atlaskit/editor-prosemirror": "^7.3.0",
49
49
  "@atlaskit/editor-shared-styles": "^3.10.0",
50
50
  "@atlaskit/editor-tables": "^2.9.0",
@@ -57,7 +57,7 @@
57
57
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
58
58
  "@atlaskit/primitives": "^18.0.0",
59
59
  "@atlaskit/theme": "^22.0.0",
60
- "@atlaskit/tmp-editor-statsig": "^35.5.0",
60
+ "@atlaskit/tmp-editor-statsig": "^35.10.0",
61
61
  "@atlaskit/toggle": "^15.2.0",
62
62
  "@atlaskit/tokens": "^11.1.0",
63
63
  "@atlaskit/tooltip": "^20.14.0",
@@ -70,7 +70,7 @@
70
70
  "uuid": "^3.1.0"
71
71
  },
72
72
  "peerDependencies": {
73
- "@atlaskit/editor-common": "^111.32.0",
73
+ "@atlaskit/editor-common": "^112.0.0",
74
74
  "react": "^18.2.0",
75
75
  "react-dom": "^18.2.0",
76
76
  "react-intl-next": "npm:react-intl@^5.18.1"