@atlaskit/editor-plugin-table 38.0.7 → 38.0.9

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,20 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 38.0.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`752e644c309ef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/752e644c309ef) -
8
+ Avoid re-rendering every table when the selection changes by selecting only selection state that
9
+ is relevant to each table, behind the `platform_editor_reduce_memory_leaks` experiment.
10
+ - Updated dependencies
11
+
12
+ ## 38.0.8
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 38.0.7
4
19
 
5
20
  ### Patch Changes
@@ -8,10 +8,16 @@ exports.TableComponentWithSharedState = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
10
10
  var _editorTables = require("@atlaskit/editor-tables");
11
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
11
12
  var _TableComponent = _interopRequireDefault(require("./TableComponent"));
12
13
  // Ignored via go/ees005
13
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
15
 
16
+ var getSelectionWithinTable = function getSelectionWithinTable(selection, tableNode) {
17
+ var found = selection && (0, _editorTables.findTable)(selection);
18
+ return found && found.node === tableNode ? selection : undefined;
19
+ };
20
+
15
21
  /**
16
22
  * Use useSharedPluginState to control re-renders from plugin dependencies
17
23
  */
@@ -31,7 +37,7 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
31
37
  allowTableResizing = _ref.allowTableResizing,
32
38
  allowFixedColumnWidthOption = _ref.allowFixedColumnWidthOption;
33
39
  var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction', 'limitedMode'], function (states) {
34
- var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
40
+ var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$selectionStat2, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
35
41
  return {
36
42
  // tableState
37
43
  isTableResizing: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isTableResizing,
@@ -49,7 +55,7 @@ var TableComponentWithSharedState = exports.TableComponentWithSharedState = func
49
55
  // mediaState
50
56
  isFullscreen: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.isFullscreen,
51
57
  // selectionState
52
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
58
+ selection: (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? getSelectionWithinTable((_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection, getNode()) : (_states$selectionStat2 = states.selectionState) === null || _states$selectionStat2 === void 0 ? void 0 : _states$selectionStat2.selection,
53
59
  // editorViewModeState
54
60
  mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
55
61
  // widthState
@@ -1,11 +1,17 @@
1
1
  import React from 'react';
2
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
3
3
  import { findTable } from '@atlaskit/editor-tables';
4
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
5
  import TableComponent from './TableComponent';
5
6
 
6
7
  // Ignored via go/ees005
7
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
9
 
10
+ const getSelectionWithinTable = (selection, tableNode) => {
11
+ const found = selection && findTable(selection);
12
+ return found && found.node === tableNode ? selection : undefined;
13
+ };
14
+
9
15
  /**
10
16
  * Use useSharedPluginState to control re-renders from plugin dependencies
11
17
  */
@@ -44,7 +50,7 @@ export const TableComponentWithSharedState = ({
44
50
  width,
45
51
  limitedModeEnabled
46
52
  } = useSharedPluginStateWithSelector(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction', 'limitedMode'], states => {
47
- var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
53
+ var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$selectionStat2, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
48
54
  return {
49
55
  // tableState
50
56
  isTableResizing: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isTableResizing,
@@ -62,7 +68,7 @@ export const TableComponentWithSharedState = ({
62
68
  // mediaState
63
69
  isFullscreen: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.isFullscreen,
64
70
  // selectionState
65
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
71
+ selection: isExperimentEnabled('platform_editor_reduce_memory_leaks') ? getSelectionWithinTable((_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection, getNode()) : (_states$selectionStat2 = states.selectionState) === null || _states$selectionStat2 === void 0 ? void 0 : _states$selectionStat2.selection,
66
72
  // editorViewModeState
67
73
  mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
68
74
  // widthState
@@ -1,11 +1,17 @@
1
1
  import React from 'react';
2
2
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
3
3
  import { findTable } from '@atlaskit/editor-tables';
4
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
4
5
  import TableComponent from './TableComponent';
5
6
 
6
7
  // Ignored via go/ees005
7
8
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
9
 
10
+ var getSelectionWithinTable = function getSelectionWithinTable(selection, tableNode) {
11
+ var found = selection && findTable(selection);
12
+ return found && found.node === tableNode ? selection : undefined;
13
+ };
14
+
9
15
  /**
10
16
  * Use useSharedPluginState to control re-renders from plugin dependencies
11
17
  */
@@ -25,7 +31,7 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
25
31
  allowTableResizing = _ref.allowTableResizing,
26
32
  allowFixedColumnWidthOption = _ref.allowFixedColumnWidthOption;
27
33
  var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['table', 'width', 'media', 'selection', 'editorViewMode', 'interaction', 'limitedMode'], function (states) {
28
- var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
34
+ var _states$tableState, _states$tableState2, _states$tableState3, _states$tableState4, _states$tableState5, _states$tableState6, _states$tableState7, _states$tableState8, _states$tableState9, _states$tableState0, _states$tableState1, _states$mediaState, _states$selectionStat, _states$selectionStat2, _states$editorViewMod, _states$widthState, _states$widthState2, _states$interactionSt, _states$limitedModeSt;
29
35
  return {
30
36
  // tableState
31
37
  isTableResizing: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.isTableResizing,
@@ -43,7 +49,7 @@ export var TableComponentWithSharedState = function TableComponentWithSharedStat
43
49
  // mediaState
44
50
  isFullscreen: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.isFullscreen,
45
51
  // selectionState
46
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection,
52
+ selection: isExperimentEnabled('platform_editor_reduce_memory_leaks') ? getSelectionWithinTable((_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection, getNode()) : (_states$selectionStat2 = states.selectionState) === null || _states$selectionStat2 === void 0 ? void 0 : _states$selectionStat2.selection,
47
53
  // editorViewModeState
48
54
  mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode,
49
55
  // widthState
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "38.0.7",
3
+ "version": "38.0.9",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/editor-plugin-batch-attribute-updates": "^26.0.0",
30
30
  "@atlaskit/editor-plugin-content-insertion": "^26.0.0",
31
31
  "@atlaskit/editor-plugin-editor-viewmode": "^28.0.0",
32
- "@atlaskit/editor-plugin-extension": "29.0.5",
32
+ "@atlaskit/editor-plugin-extension": "29.0.7",
33
33
  "@atlaskit/editor-plugin-guideline": "^26.0.0",
34
34
  "@atlaskit/editor-plugin-interaction": "^40.0.0",
35
35
  "@atlaskit/editor-plugin-limited-mode": "^23.0.0",
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^3.2.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^3.0.0",
55
55
  "@atlaskit/primitives": "^22.5.0",
56
- "@atlaskit/tmp-editor-statsig": "^232.0.0",
56
+ "@atlaskit/tmp-editor-statsig": "^234.0.0",
57
57
  "@atlaskit/toggle": "^17.3.0",
58
58
  "@atlaskit/tokens": "^20.4.0",
59
59
  "@atlaskit/tooltip": "^24.4.0",
@@ -68,7 +68,7 @@
68
68
  "uuid": "^11.1.1"
69
69
  },
70
70
  "peerDependencies": {
71
- "@atlaskit/editor-common": "^130.4.0",
71
+ "@atlaskit/editor-common": "^130.5.0",
72
72
  "react": "^18.2.0 || ^19.2.0",
73
73
  "react-dom": "^18.2.0 || ^19.2.0",
74
74
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"