@atlaskit/editor-plugin-table 10.9.24 → 10.9.25

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,11 @@
1
1
  # @atlaskit/editor-plugin-table
2
2
 
3
+ ## 10.9.25
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 10.9.24
4
10
 
5
11
  ### Patch Changes
@@ -4,10 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.pluginKey = exports.handleDocOrSelectionChanged = exports.getDecorations = exports.createPlugin = void 0;
7
+ var _coreUtils = require("@atlaskit/editor-common/core-utils");
7
8
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
9
  var _state = require("@atlaskit/editor-prosemirror/state");
9
10
  var _view = require("@atlaskit/editor-prosemirror/view");
10
11
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
12
+ var _utils = require("@atlaskit/editor-tables/utils");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
14
  var _pluginKey = require("../plugin-key");
12
15
  var _tableWidth = require("../table-width");
13
16
  var _columnControls = require("./utils/column-controls");
@@ -21,7 +24,9 @@ var handleDocOrSelectionChanged = exports.handleDocOrSelectionChanged = function
21
24
  var wasResizing = (_tableWidthPluginKey$2 = _tableWidth.pluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
22
25
  var _ref = _pluginKey.pluginKey.getState(newState) || {},
23
26
  _ref$isDragAndDropEna = _ref.isDragAndDropEnabled,
24
- isDragAndDropEnabled = _ref$isDragAndDropEna === void 0 ? false : _ref$isDragAndDropEna;
27
+ isDragAndDropEnabled = _ref$isDragAndDropEna === void 0 ? false : _ref$isDragAndDropEna,
28
+ isInDanger = _ref.isInDanger,
29
+ isTableHovered = _ref.isTableHovered;
25
30
  var changedResizing = isResizing !== wasResizing;
26
31
 
27
32
  // Remove column controls when resizing and don't add column decoration controls when DnD enabled
@@ -43,6 +48,19 @@ var handleDocOrSelectionChanged = exports.handleDocOrSelectionChanged = function
43
48
  tr: tr
44
49
  });
45
50
  }
51
+ if ((0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions')) {
52
+ var _findTable, _findTable2;
53
+ // We're exiting a table with an existing decorations so we should clean it up
54
+ if ((isInDanger || isTableHovered) && (!(0, _coreUtils.insideTable)(newState) || ((_findTable = (0, _utils.findTable)(newState.selection)) === null || _findTable === void 0 ? void 0 : _findTable.node) !== ((_findTable2 = (0, _utils.findTable)(oldState.selection)) === null || _findTable2 === void 0 ? void 0 : _findTable2.node))) {
55
+ return (0, _columnControls.buildColumnControlsDecorations)({
56
+ decorationSet: decorationSet,
57
+ tr: tr,
58
+ options: {
59
+ isDragAndDropEnabled: isDragAndDropEnabled
60
+ }
61
+ });
62
+ }
63
+ }
46
64
  }
47
65
  return decorationSet;
48
66
  };
@@ -15,7 +15,9 @@ var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-
15
15
  *
16
16
  * @param api The editor API
17
17
  * @param key Key of TableSharedStateInternal to select
18
+ * @param options
18
19
  * @returns
20
+ * @example
19
21
  */
20
22
  var useInternalTablePluginStateSelector = exports.useInternalTablePluginStateSelector = function useInternalTablePluginStateSelector(api, key, options) {
21
23
  // Need to disable the eslint rule here because the key is for the TableSharedStateInternal type
@@ -804,8 +804,8 @@ var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEd
804
804
 
805
805
  // table may be scaled, use the scale percent to calculate the table width
806
806
  if (editorView) {
807
- var tableWrapper = getDomRef(editorView);
808
- var tableWrapperWidth = (tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.clientWidth) || tableContainerWidth;
807
+ var _getDomRef;
808
+ var tableWrapperWidth = (0, _platformFeatureFlags.fg)('platform_editor_remove_slow_table_transactions') ? tableContainerWidth : ((_getDomRef = getDomRef(editorView)) === null || _getDomRef === void 0 ? void 0 : _getDomRef.clientWidth) || tableContainerWidth;
809
809
  var scalePercent = (0, _misc.getStaticTableScalingPercent)(selectedNode, tableWrapperWidth, shouldUseIncreasedScalingPercent);
810
810
  tableContainerWidth = tableContainerWidth * scalePercent;
811
811
  }
@@ -1,7 +1,10 @@
1
+ import { insideTable } from '@atlaskit/editor-common/core-utils';
1
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
4
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
5
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
6
+ import { findTable } from '@atlaskit/editor-tables/utils';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
5
8
  import { pluginKey as tablePluginKey } from '../plugin-key';
6
9
  import { pluginKey as tableWidthPluginKey } from '../table-width';
7
10
  import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './utils/column-controls';
@@ -12,7 +15,9 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
12
15
  const isResizing = (_tableWidthPluginKey$ = tableWidthPluginKey.getState(newState)) === null || _tableWidthPluginKey$ === void 0 ? void 0 : _tableWidthPluginKey$.resizing;
13
16
  const wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
14
17
  const {
15
- isDragAndDropEnabled = false
18
+ isDragAndDropEnabled = false,
19
+ isInDanger,
20
+ isTableHovered
16
21
  } = tablePluginKey.getState(newState) || {};
17
22
  const changedResizing = isResizing !== wasResizing;
18
23
 
@@ -35,6 +40,19 @@ export const handleDocOrSelectionChanged = (tr, decorationSet, oldState, newStat
35
40
  tr
36
41
  });
37
42
  }
43
+ if (fg('platform_editor_remove_slow_table_transactions')) {
44
+ var _findTable, _findTable2;
45
+ // We're exiting a table with an existing decorations so we should clean it up
46
+ if ((isInDanger || isTableHovered) && (!insideTable(newState) || ((_findTable = findTable(newState.selection)) === null || _findTable === void 0 ? void 0 : _findTable.node) !== ((_findTable2 = findTable(oldState.selection)) === null || _findTable2 === void 0 ? void 0 : _findTable2.node))) {
47
+ return buildColumnControlsDecorations({
48
+ decorationSet,
49
+ tr,
50
+ options: {
51
+ isDragAndDropEnabled
52
+ }
53
+ });
54
+ }
55
+ }
38
56
  }
39
57
  return decorationSet;
40
58
  };
@@ -9,7 +9,9 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
9
9
  *
10
10
  * @param api The editor API
11
11
  * @param key Key of TableSharedStateInternal to select
12
+ * @param options
12
13
  * @returns
14
+ * @example
13
15
  */
14
16
  export const useInternalTablePluginStateSelector = (api, key, options) => {
15
17
  // Need to disable the eslint rule here because the key is for the TableSharedStateInternal type
@@ -754,8 +754,8 @@ const isLayoutOptionDisabled = (selectedNode, getEditorContainerWidth, getDomRef
754
754
 
755
755
  // table may be scaled, use the scale percent to calculate the table width
756
756
  if (editorView) {
757
- const tableWrapper = getDomRef(editorView);
758
- const tableWrapperWidth = (tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.clientWidth) || tableContainerWidth;
757
+ var _getDomRef;
758
+ const tableWrapperWidth = fg('platform_editor_remove_slow_table_transactions') ? tableContainerWidth : ((_getDomRef = getDomRef(editorView)) === null || _getDomRef === void 0 ? void 0 : _getDomRef.clientWidth) || tableContainerWidth;
759
759
  const scalePercent = getStaticTableScalingPercent(selectedNode, tableWrapperWidth, shouldUseIncreasedScalingPercent);
760
760
  tableContainerWidth = tableContainerWidth * scalePercent;
761
761
  }
@@ -1,7 +1,10 @@
1
+ import { insideTable } from '@atlaskit/editor-common/core-utils';
1
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
3
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
4
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
5
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
6
+ import { findTable } from '@atlaskit/editor-tables/utils';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
5
8
  import { pluginKey as tablePluginKey } from '../plugin-key';
6
9
  import { pluginKey as tableWidthPluginKey } from '../table-width';
7
10
  import { buildColumnControlsDecorations, maybeUpdateColumnControlsSelectedDecoration } from './utils/column-controls';
@@ -15,7 +18,9 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
15
18
  var wasResizing = (_tableWidthPluginKey$2 = tableWidthPluginKey.getState(oldState)) === null || _tableWidthPluginKey$2 === void 0 ? void 0 : _tableWidthPluginKey$2.resizing;
16
19
  var _ref = tablePluginKey.getState(newState) || {},
17
20
  _ref$isDragAndDropEna = _ref.isDragAndDropEnabled,
18
- isDragAndDropEnabled = _ref$isDragAndDropEna === void 0 ? false : _ref$isDragAndDropEna;
21
+ isDragAndDropEnabled = _ref$isDragAndDropEna === void 0 ? false : _ref$isDragAndDropEna,
22
+ isInDanger = _ref.isInDanger,
23
+ isTableHovered = _ref.isTableHovered;
19
24
  var changedResizing = isResizing !== wasResizing;
20
25
 
21
26
  // Remove column controls when resizing and don't add column decoration controls when DnD enabled
@@ -37,6 +42,19 @@ export var handleDocOrSelectionChanged = function handleDocOrSelectionChanged(tr
37
42
  tr: tr
38
43
  });
39
44
  }
45
+ if (fg('platform_editor_remove_slow_table_transactions')) {
46
+ var _findTable, _findTable2;
47
+ // We're exiting a table with an existing decorations so we should clean it up
48
+ if ((isInDanger || isTableHovered) && (!insideTable(newState) || ((_findTable = findTable(newState.selection)) === null || _findTable === void 0 ? void 0 : _findTable.node) !== ((_findTable2 = findTable(oldState.selection)) === null || _findTable2 === void 0 ? void 0 : _findTable2.node))) {
49
+ return buildColumnControlsDecorations({
50
+ decorationSet: decorationSet,
51
+ tr: tr,
52
+ options: {
53
+ isDragAndDropEnabled: isDragAndDropEnabled
54
+ }
55
+ });
56
+ }
57
+ }
40
58
  }
41
59
  return decorationSet;
42
60
  };
@@ -9,7 +9,9 @@ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared
9
9
  *
10
10
  * @param api The editor API
11
11
  * @param key Key of TableSharedStateInternal to select
12
+ * @param options
12
13
  * @returns
14
+ * @example
13
15
  */
14
16
  export var useInternalTablePluginStateSelector = function useInternalTablePluginStateSelector(api, key, options) {
15
17
  // Need to disable the eslint rule here because the key is for the TableSharedStateInternal type
@@ -796,8 +796,8 @@ var isLayoutOptionDisabled = function isLayoutOptionDisabled(selectedNode, getEd
796
796
 
797
797
  // table may be scaled, use the scale percent to calculate the table width
798
798
  if (editorView) {
799
- var tableWrapper = getDomRef(editorView);
800
- var tableWrapperWidth = (tableWrapper === null || tableWrapper === void 0 ? void 0 : tableWrapper.clientWidth) || tableContainerWidth;
799
+ var _getDomRef;
800
+ var tableWrapperWidth = fg('platform_editor_remove_slow_table_transactions') ? tableContainerWidth : ((_getDomRef = getDomRef(editorView)) === null || _getDomRef === void 0 ? void 0 : _getDomRef.clientWidth) || tableContainerWidth;
801
801
  var scalePercent = getStaticTableScalingPercent(selectedNode, tableWrapperWidth, shouldUseIncreasedScalingPercent);
802
802
  tableContainerWidth = tableContainerWidth * scalePercent;
803
803
  }
@@ -8,7 +8,7 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
8
8
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { Rect } from '@atlaskit/editor-tables/table-map';
10
10
  import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
11
- import { RowStickyState } from '../pm-plugins/sticky-headers/types';
11
+ import type { RowStickyState } from '../pm-plugins/sticky-headers/types';
12
12
  import type { TablePlugin } from '../tablePluginType';
13
13
  export declare const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
14
14
  export type RowInsertPosition = 'TOP' | 'BOTTOM';
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
- import { ExtractInjectionAPI, GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
2
+ import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
+ import { type ExtractInjectionAPI, type GetEditorContainerWidth, type GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import { TablePlugin, TablePluginOptions } from '../tablePluginType';
5
+ import { type TablePlugin, type TablePluginOptions } from '../tablePluginType';
6
6
  export type ContentComponentProps = {
7
7
  api: ExtractInjectionAPI<TablePlugin> | undefined;
8
8
  editorView: EditorView;
@@ -1,7 +1,7 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import { type TableSelectorPopupProps } from '@atlaskit/editor-common/ui';
4
- import { TablePlugin } from '../../tablePluginType';
4
+ import type { TablePlugin } from '../../tablePluginType';
5
5
  interface SizeSelectorProps extends Omit<TableSelectorPopupProps, 'handleClickOutside' | 'onSelection' | 'unUnmount'> {
6
6
  api?: ExtractInjectionAPI<TablePlugin>;
7
7
  }
@@ -1,6 +1,6 @@
1
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import { TablePlugin } from '../../tablePluginType';
3
- import { TableSharedStateInternal } from '../../types';
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { TablePlugin } from '../../tablePluginType';
3
+ import type { TableSharedStateInternal } from '../../types';
4
4
  type Options = {
5
5
  disabled?: boolean;
6
6
  };
@@ -14,7 +14,9 @@ type Options = {
14
14
  *
15
15
  * @param api The editor API
16
16
  * @param key Key of TableSharedStateInternal to select
17
+ * @param options
17
18
  * @returns
19
+ * @example
18
20
  */
19
21
  export declare const useInternalTablePluginStateSelector: <K extends "isFullWidthModeEnabled" | "wasFullWidthModeEnabled" | "isHeaderRowEnabled" | "isHeaderColumnEnabled" | "ordering" | "isInDanger" | "hoveredRows" | "hoveredColumns" | "hoveredCell" | "isTableHovered" | "tableNode" | "widthToWidest" | "tableRef" | "tablePos" | "targetCellPosition" | "isContextualMenuOpen" | "pluginConfig" | "insertColumnButtonIndex" | "insertRowButtonIndex" | "isDragAndDropEnabled" | "tableWrapperTarget" | "isCellMenuOpenByKeyboard" | "isWholeTableInDanger" | "isDragMenuOpen" | "dragMenuDirection" | "dragMenuIndex" | "isResizing" | "isTableResizing" | "resizingTableRef" | "resizingTableLocalId" | "stickyHeader" | "isSizeSelectorOpen" | "sizeSelectorTargetRef">(api: ExtractInjectionAPI<TablePlugin> | undefined, key: K, options?: Options) => TableSharedStateInternal[K] | undefined;
20
22
  export {};
@@ -8,7 +8,7 @@ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
8
8
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
9
9
  import type { Rect } from '@atlaskit/editor-tables/table-map';
10
10
  import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
11
- import { RowStickyState } from '../pm-plugins/sticky-headers/types';
11
+ import type { RowStickyState } from '../pm-plugins/sticky-headers/types';
12
12
  import type { TablePlugin } from '../tablePluginType';
13
13
  export declare const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
14
14
  export type RowInsertPosition = 'TOP' | 'BOTTOM';
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
- import { ExtractInjectionAPI, GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
2
+ import { type DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
+ import { type ExtractInjectionAPI, type GetEditorContainerWidth, type GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
4
4
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import { TablePlugin, TablePluginOptions } from '../tablePluginType';
5
+ import { type TablePlugin, type TablePluginOptions } from '../tablePluginType';
6
6
  export type ContentComponentProps = {
7
7
  api: ExtractInjectionAPI<TablePlugin> | undefined;
8
8
  editorView: EditorView;
@@ -1,7 +1,7 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import { type TableSelectorPopupProps } from '@atlaskit/editor-common/ui';
4
- import { TablePlugin } from '../../tablePluginType';
4
+ import type { TablePlugin } from '../../tablePluginType';
5
5
  interface SizeSelectorProps extends Omit<TableSelectorPopupProps, 'handleClickOutside' | 'onSelection' | 'unUnmount'> {
6
6
  api?: ExtractInjectionAPI<TablePlugin>;
7
7
  }
@@ -1,6 +1,6 @@
1
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import { TablePlugin } from '../../tablePluginType';
3
- import { TableSharedStateInternal } from '../../types';
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
+ import type { TablePlugin } from '../../tablePluginType';
3
+ import type { TableSharedStateInternal } from '../../types';
4
4
  type Options = {
5
5
  disabled?: boolean;
6
6
  };
@@ -14,7 +14,9 @@ type Options = {
14
14
  *
15
15
  * @param api The editor API
16
16
  * @param key Key of TableSharedStateInternal to select
17
+ * @param options
17
18
  * @returns
19
+ * @example
18
20
  */
19
21
  export declare const useInternalTablePluginStateSelector: <K extends "isFullWidthModeEnabled" | "wasFullWidthModeEnabled" | "isHeaderRowEnabled" | "isHeaderColumnEnabled" | "ordering" | "isInDanger" | "hoveredRows" | "hoveredColumns" | "hoveredCell" | "isTableHovered" | "tableNode" | "widthToWidest" | "tableRef" | "tablePos" | "targetCellPosition" | "isContextualMenuOpen" | "pluginConfig" | "insertColumnButtonIndex" | "insertRowButtonIndex" | "isDragAndDropEnabled" | "tableWrapperTarget" | "isCellMenuOpenByKeyboard" | "isWholeTableInDanger" | "isDragMenuOpen" | "dragMenuDirection" | "dragMenuIndex" | "isResizing" | "isTableResizing" | "resizingTableRef" | "resizingTableLocalId" | "stickyHeader" | "isSizeSelectorOpen" | "sizeSelectorTargetRef">(api: ExtractInjectionAPI<TablePlugin> | undefined, key: K, options?: Options) => TableSharedStateInternal[K] | undefined;
20
22
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "10.9.24",
3
+ "version": "10.9.25",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/adf-schema": "^47.6.0",
33
33
  "@atlaskit/button": "^23.0.0",
34
34
  "@atlaskit/custom-steps": "^0.11.0",
35
- "@atlaskit/editor-common": "^105.2.0",
35
+ "@atlaskit/editor-common": "^105.5.0",
36
36
  "@atlaskit/editor-palette": "^2.1.0",
37
37
  "@atlaskit/editor-plugin-accessibility-utils": "^2.0.0",
38
38
  "@atlaskit/editor-plugin-analytics": "^2.3.0",
@@ -47,14 +47,14 @@
47
47
  "@atlaskit/editor-shared-styles": "^3.4.0",
48
48
  "@atlaskit/editor-tables": "^2.9.0",
49
49
  "@atlaskit/icon": "^26.0.0",
50
- "@atlaskit/menu": "^5.0.0",
50
+ "@atlaskit/menu": "^6.0.0",
51
51
  "@atlaskit/platform-feature-flags": "^1.1.0",
52
52
  "@atlaskit/pragmatic-drag-and-drop": "^1.6.0",
53
53
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
54
54
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
55
55
  "@atlaskit/primitives": "^14.7.0",
56
56
  "@atlaskit/theme": "^18.0.0",
57
- "@atlaskit/tmp-editor-statsig": "^4.21.0",
57
+ "@atlaskit/tmp-editor-statsig": "^4.22.0",
58
58
  "@atlaskit/toggle": "^15.0.0",
59
59
  "@atlaskit/tokens": "^4.8.0",
60
60
  "@atlaskit/tooltip": "^20.0.0",
@@ -195,6 +195,9 @@
195
195
  "platform_editor_controls_table_picker": {
196
196
  "type": "boolean"
197
197
  },
198
+ "platform_editor_remove_slow_table_transactions": {
199
+ "type": "boolean"
200
+ },
198
201
  "platform_editor_controls_patch_6": {
199
202
  "type": "boolean"
200
203
  },
@@ -1,3 +1,4 @@
1
+ import { insideTable } from '@atlaskit/editor-common/core-utils';
1
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
3
  import type {
3
4
  EditorState,
@@ -8,6 +9,8 @@ import type {
8
9
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
9
10
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
10
11
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
12
+ import { findTable } from '@atlaskit/editor-tables/utils';
13
+ import { fg } from '@atlaskit/platform-feature-flags';
11
14
 
12
15
  import { pluginKey as tablePluginKey } from '../plugin-key';
13
16
  import { pluginKey as tableWidthPluginKey } from '../table-width';
@@ -29,7 +32,11 @@ export const handleDocOrSelectionChanged = (
29
32
  ): DecorationSet => {
30
33
  const isResizing = tableWidthPluginKey.getState(newState)?.resizing;
31
34
  const wasResizing = tableWidthPluginKey.getState(oldState)?.resizing;
32
- const { isDragAndDropEnabled = false } = tablePluginKey.getState(newState) || {};
35
+ const {
36
+ isDragAndDropEnabled = false,
37
+ isInDanger,
38
+ isTableHovered,
39
+ } = tablePluginKey.getState(newState) || {};
33
40
 
34
41
  const changedResizing = isResizing !== wasResizing;
35
42
 
@@ -52,6 +59,22 @@ export const handleDocOrSelectionChanged = (
52
59
  tr,
53
60
  });
54
61
  }
62
+ if (fg('platform_editor_remove_slow_table_transactions')) {
63
+ // We're exiting a table with an existing decorations so we should clean it up
64
+ if (
65
+ (isInDanger || isTableHovered) &&
66
+ (!insideTable(newState) ||
67
+ findTable(newState.selection)?.node !== findTable(oldState.selection)?.node)
68
+ ) {
69
+ return buildColumnControlsDecorations({
70
+ decorationSet,
71
+ tr,
72
+ options: {
73
+ isDragAndDropEnabled,
74
+ },
75
+ });
76
+ }
77
+ }
55
78
  }
56
79
 
57
80
  return decorationSet;
@@ -15,7 +15,7 @@ import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
15
15
  import type { Rect } from '@atlaskit/editor-tables/table-map';
16
16
  import type { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
17
17
 
18
- import { RowStickyState } from '../pm-plugins/sticky-headers/types';
18
+ import type { RowStickyState } from '../pm-plugins/sticky-headers/types';
19
19
  import type { TablePlugin } from '../tablePluginType';
20
20
 
21
21
  export const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
@@ -3,21 +3,21 @@ import React from 'react';
3
3
  import {
4
4
  ACTION_SUBJECT,
5
5
  ACTION_SUBJECT_ID,
6
- DispatchAnalyticsEvent,
6
+ type DispatchAnalyticsEvent,
7
7
  } from '@atlaskit/editor-common/analytics';
8
8
  import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
9
9
  import { getDomRefFromSelection } from '@atlaskit/editor-common/get-dom-ref-from-selection';
10
10
  import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
11
11
  import {
12
- ExtractInjectionAPI,
13
- GetEditorContainerWidth,
14
- GetEditorFeatureFlags,
12
+ type ExtractInjectionAPI,
13
+ type GetEditorContainerWidth,
14
+ type GetEditorFeatureFlags,
15
15
  } from '@atlaskit/editor-common/types';
16
16
  import { EditorView } from '@atlaskit/editor-prosemirror/view';
17
17
  import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
18
18
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
19
19
 
20
- import { TablePlugin, TablePluginOptions } from '../tablePluginType';
20
+ import { type TablePlugin, type TablePluginOptions } from '../tablePluginType';
21
21
 
22
22
  import FloatingContextualButton from './FloatingContextualButton';
23
23
  import FloatingContextualMenu from './FloatingContextualMenu';
@@ -11,7 +11,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
11
11
  import { TableSelectorPopup, type TableSelectorPopupProps } from '@atlaskit/editor-common/ui';
12
12
 
13
13
  import { pluginKey } from '../../pm-plugins/table-size-selector';
14
- import { TablePlugin } from '../../tablePluginType';
14
+ import type { TablePlugin } from '../../tablePluginType';
15
15
 
16
16
  interface SizeSelectorProps
17
17
  extends Omit<TableSelectorPopupProps, 'handleClickOutside' | 'onSelection' | 'unUnmount'> {
@@ -1,8 +1,8 @@
1
- import { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
1
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
2
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
3
3
 
4
- import { TablePlugin } from '../../tablePluginType';
5
- import { TableSharedStateInternal } from '../../types';
4
+ import type { TablePlugin } from '../../tablePluginType';
5
+ import type { TableSharedStateInternal } from '../../types';
6
6
 
7
7
  type Options = {
8
8
  disabled?: boolean;
@@ -18,7 +18,9 @@ type Options = {
18
18
  *
19
19
  * @param api The editor API
20
20
  * @param key Key of TableSharedStateInternal to select
21
+ * @param options
21
22
  * @returns
23
+ * @example
22
24
  */
23
25
  export const useInternalTablePluginStateSelector = <K extends keyof TableSharedStateInternal>(
24
26
  api: ExtractInjectionAPI<TablePlugin> | undefined,
@@ -1144,8 +1144,9 @@ const isLayoutOptionDisabled = (
1144
1144
 
1145
1145
  // table may be scaled, use the scale percent to calculate the table width
1146
1146
  if (editorView) {
1147
- const tableWrapper = getDomRef(editorView);
1148
- const tableWrapperWidth = tableWrapper?.clientWidth || tableContainerWidth;
1147
+ const tableWrapperWidth = fg('platform_editor_remove_slow_table_transactions')
1148
+ ? tableContainerWidth
1149
+ : getDomRef(editorView)?.clientWidth || tableContainerWidth;
1149
1150
  const scalePercent = getStaticTableScalingPercent(
1150
1151
  selectedNode,
1151
1152
  tableWrapperWidth,