@atlaskit/editor-plugin-table 10.8.3 → 10.9.2

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.
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
3
+ import { ExtractInjectionAPI, GetEditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
4
+ import { EditorView } from '@atlaskit/editor-prosemirror/view';
5
+ import { TablePlugin, TablePluginOptions } from '../tablePluginType';
6
+ export type ContentComponentProps = {
7
+ api: ExtractInjectionAPI<TablePlugin> | undefined;
8
+ editorView: EditorView;
9
+ dispatchAnalyticsEvent: DispatchAnalyticsEvent | undefined;
10
+ options?: TablePluginOptions;
11
+ popupsMountPoint?: HTMLElement;
12
+ popupsBoundariesElement?: HTMLElement;
13
+ popupsScrollableElement?: HTMLElement;
14
+ defaultGetEditorContainerWidth: GetEditorContainerWidth;
15
+ defaultGetEditorFeatureFlags: GetEditorFeatureFlags;
16
+ };
17
+ export declare const ContentComponent: ({ api, editorView, dispatchAnalyticsEvent, options, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, defaultGetEditorContainerWidth, defaultGetEditorFeatureFlags, }: ContentComponentProps) => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-table",
3
- "version": "10.8.3",
3
+ "version": "10.9.2",
4
4
  "description": "Table plugin for the @atlaskit/editor",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -32,14 +32,14 @@
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": "^103.12.0",
35
+ "@atlaskit/editor-common": "^103.15.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.2.0",
39
39
  "@atlaskit/editor-plugin-batch-attribute-updates": "^2.1.0",
40
40
  "@atlaskit/editor-plugin-content-insertion": "^2.1.0",
41
41
  "@atlaskit/editor-plugin-editor-viewmode": "^3.1.0",
42
- "@atlaskit/editor-plugin-extension": "5.2.5",
42
+ "@atlaskit/editor-plugin-extension": "5.2.6",
43
43
  "@atlaskit/editor-plugin-guideline": "^2.0.0",
44
44
  "@atlaskit/editor-plugin-selection": "^2.1.0",
45
45
  "@atlaskit/editor-plugin-width": "^3.0.0",
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
55
55
  "@atlaskit/primitives": "^14.4.0",
56
56
  "@atlaskit/theme": "^18.0.0",
57
- "@atlaskit/tmp-editor-statsig": "^4.12.0",
57
+ "@atlaskit/tmp-editor-statsig": "^4.13.0",
58
58
  "@atlaskit/toggle": "^15.0.0",
59
59
  "@atlaskit/tokens": "^4.8.0",
60
60
  "@atlaskit/tooltip": "^20.0.0",
@@ -203,6 +203,9 @@
203
203
  },
204
204
  "platform_editor_controls_table_picker": {
205
205
  "type": "boolean"
206
+ },
207
+ "platform_editor_controls_patch_6": {
208
+ "type": "boolean"
206
209
  }
207
210
  }
208
211
  }
@@ -15,7 +15,11 @@ import type {
15
15
  import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
16
16
  import type { DOMOutputSpec, Node as PmNode } from '@atlaskit/editor-prosemirror/model';
17
17
  import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
18
- import type { EditorState, PluginKey, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
18
+ import {
19
+ type EditorState,
20
+ type PluginKey,
21
+ type SelectionBookmark,
22
+ } from '@atlaskit/editor-prosemirror/state';
19
23
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
20
24
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
21
25
  import { TableMap } from '@atlaskit/editor-tables/table-map';
@@ -177,7 +181,6 @@ export default class TableView extends ReactNodeView<Props> {
177
181
  let oldIgnoreMutation: (mutation: MutationRecord) => boolean;
178
182
 
179
183
  let selectionBookmark: SelectionBookmark;
180
- let parentOffset = 0;
181
184
  let mutationsIgnored = false;
182
185
 
183
186
  // Only proceed if we have both a node and table, and the table isn't already inside the node
@@ -188,8 +191,8 @@ export default class TableView extends ReactNodeView<Props> {
188
191
  // Set up a temporary mutation handler that:
189
192
  // - Ignores all DOM mutations except selection changes
190
193
  // - Tracks when mutations have been ignored via mutationsIgnored flag
191
- this.ignoreMutation = (m: MutationRecord) => {
192
- const isSelectionMutation = m.target instanceof Selection;
194
+ this.ignoreMutation = (m: MutationRecord | { type: string; target: Node }) => {
195
+ const isSelectionMutation = m.type === 'selection';
193
196
  if (!isSelectionMutation) {
194
197
  mutationsIgnored = true;
195
198
  }
@@ -202,14 +205,8 @@ export default class TableView extends ReactNodeView<Props> {
202
205
  selectionBookmark = this.view.state.selection.getBookmark();
203
206
  }
204
207
 
205
- // Store the current cursor position within the parent node
206
- // Used to determine if we need to restore selection later
207
- if (this.view.state.selection?.ranges.length > 0) {
208
- parentOffset = this.view.state.selection?.ranges[0].$from?.parentOffset ?? 0;
209
- }
210
-
211
208
  // Remove the ProseMirror table DOM structure to avoid duplication, as it's replaced with the React table node.
212
- if (this.renderedDOM) {
209
+ if (this.dom && this.renderedDOM) {
213
210
  this.dom.removeChild(this.renderedDOM);
214
211
  }
215
212
  // Move the table from the ProseMirror table structure into the React rendered table node.
@@ -223,11 +220,13 @@ export default class TableView extends ReactNodeView<Props> {
223
220
  // Restore the selection only if:
224
221
  // - We have a selection bookmark
225
222
  // - Mutations were ignored during the table move
226
- // - The cursor wasn't at the start of the node
227
- if (selectionBookmark && mutationsIgnored && parentOffset > 0) {
228
- this.view.dispatch(
229
- this.view.state.tr.setSelection(selectionBookmark.resolve(this.view.state.tr.doc)),
230
- );
223
+ // - The bookmarked selection is different from the current selection.
224
+ if (selectionBookmark && mutationsIgnored) {
225
+ const resolvedSelection = selectionBookmark.resolve(this.view.state.tr.doc);
226
+ // Don't set the selection if it's the same as the current selection.
227
+ if (!resolvedSelection.eq(this.view.state.selection)) {
228
+ this.view.dispatch(this.view.state.tr.setSelection(resolvedSelection));
229
+ }
231
230
  }
232
231
  });
233
232
  }
@@ -50,7 +50,6 @@ import { createPlugin as createDragAndDropPlugin } from './pm-plugins/drag-and-d
50
50
  import { pluginKey as dragAndDropPluginKey } from './pm-plugins/drag-and-drop/plugin-key';
51
51
  import { keymapPlugin } from './pm-plugins/keymap';
52
52
  import { createPlugin } from './pm-plugins/main';
53
- import { getPluginState } from './pm-plugins/plugin-factory';
54
53
  import { pluginKey } from './pm-plugins/plugin-key';
55
54
  import { createPlugin as createTableSafariDeleteCompositionTextIssueWorkaroundPlugin } from './pm-plugins/safari-delete-composition-text-issue-workaround';
56
55
  import { createPlugin as createStickyHeadersPlugin } from './pm-plugins/sticky-headers/plugin';
@@ -74,7 +73,8 @@ import { createPlugin as createTableWidthInCommentFixPlugin } from './pm-plugins
74
73
  import { createTableWithWidth } from './pm-plugins/utils/create';
75
74
  import { createPlugin as createViewModeSortPlugin } from './pm-plugins/view-mode-sort';
76
75
  import type { TablePlugin, TablePluginOptions } from './tablePluginType';
77
- import type { ColumnResizingPluginState } from './types';
76
+ import type { ColumnResizingPluginState, TableSharedStateInternal } from './types';
77
+ import { ContentComponent } from './ui/ContentComponent';
78
78
  import FloatingContextualButton from './ui/FloatingContextualButton';
79
79
  import FloatingContextualMenu from './ui/FloatingContextualMenu';
80
80
  import FloatingDeleteButton from './ui/FloatingDeleteButton';
@@ -133,11 +133,19 @@ const tablePlugin: TablePlugin = ({ config: options, api }) => {
133
133
  return undefined;
134
134
  }
135
135
 
136
- const tablePluginState = getPluginState(editorState);
136
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
137
+ const tablePluginState = pluginKey.getState(editorState)!;
137
138
  const tableResizingPluginState = getFlexiResizingPlugin(editorState);
138
139
  const tableWidthResizingPluginState = tableWidthPluginKey.getState(editorState);
139
140
 
140
- return {
141
+ const stickyHeadersState = stickyHeadersPluginKey.getState(editorState);
142
+ const stickyHeader = stickyHeadersState
143
+ ? findStickyHeaderForTable(stickyHeadersState, tablePluginState?.tablePos)
144
+ : undefined;
145
+
146
+ const dragAndDropState = dragAndDropPluginKey.getState(editorState);
147
+
148
+ const sharedStateInternal: TableSharedStateInternal = {
141
149
  isFullWidthModeEnabled: !!options?.fullWidthEnabled,
142
150
  wasFullWidthModeEnabled: !!options?.wasFullWidthEnabled,
143
151
  isHeaderRowEnabled: tablePluginState.isHeaderRowEnabled,
@@ -157,7 +165,25 @@ const tablePlugin: TablePlugin = ({ config: options, api }) => {
157
165
  // TableComponent listens for node attribute changes to update colgroups
158
166
  tableNode: tablePluginState.tableNode,
159
167
  widthToWidest: tablePluginState.widthToWidest,
168
+ resizingTableLocalId: tableWidthResizingPluginState?.tableLocalId,
169
+ tableRef: tablePluginState?.tableRef ?? undefined,
170
+ resizingTableRef: tableWidthResizingPluginState?.tableRef ?? undefined,
171
+ tablePos: tablePluginState.tablePos,
172
+ targetCellPosition: tablePluginState.targetCellPosition,
173
+ isContextualMenuOpen: tablePluginState.isContextualMenuOpen,
174
+ pluginConfig: tablePluginState.pluginConfig,
175
+ insertColumnButtonIndex: tablePluginState.insertColumnButtonIndex,
176
+ insertRowButtonIndex: tablePluginState.insertRowButtonIndex,
177
+ isDragAndDropEnabled: tablePluginState.isDragAndDropEnabled,
178
+ tableWrapperTarget: tablePluginState.tableWrapperTarget,
179
+ isCellMenuOpenByKeyboard: tablePluginState.isCellMenuOpenByKeyboard,
180
+ stickyHeader,
181
+ dragMenuDirection: dragAndDropState?.dragMenuDirection,
182
+ dragMenuIndex: dragAndDropState?.dragMenuIndex,
183
+ isDragMenuOpen: dragAndDropState?.isDragMenuOpen,
160
184
  };
185
+
186
+ return sharedStateInternal;
161
187
  },
162
188
 
163
189
  actions: {
@@ -529,6 +555,22 @@ const tablePlugin: TablePlugin = ({ config: options, api }) => {
529
555
  popupsScrollableElement,
530
556
  dispatchAnalyticsEvent,
531
557
  }) {
558
+ if (editorExperiment('platform_editor_usesharedpluginstateselector', true)) {
559
+ return (
560
+ <ContentComponent
561
+ api={api}
562
+ editorView={editorView}
563
+ dispatchAnalyticsEvent={dispatchAnalyticsEvent}
564
+ options={options}
565
+ popupsMountPoint={popupsMountPoint}
566
+ popupsBoundariesElement={popupsBoundariesElement}
567
+ popupsScrollableElement={popupsScrollableElement}
568
+ defaultGetEditorContainerWidth={defaultGetEditorContainerWidth}
569
+ defaultGetEditorFeatureFlags={defaultGetEditorFeatureFlags}
570
+ />
571
+ );
572
+ }
573
+
532
574
  return (
533
575
  <ErrorBoundary
534
576
  component={ACTION_SUBJECT.TABLES_PLUGIN}
@@ -15,6 +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
19
  import type { TablePlugin } from '../tablePluginType';
19
20
 
20
21
  export const RESIZE_HANDLE_AREA_DECORATION_GAP = 30;
@@ -58,10 +59,26 @@ export type TableSharedStateInternal = Pick<
58
59
  | 'isTableHovered'
59
60
  | 'tableNode'
60
61
  | 'widthToWidest'
62
+ | 'tableRef'
63
+ | 'tablePos'
64
+ | 'targetCellPosition'
65
+ | 'isContextualMenuOpen'
66
+ | 'pluginConfig'
67
+ | 'insertColumnButtonIndex'
68
+ | 'insertRowButtonIndex'
69
+ | 'isDragAndDropEnabled'
70
+ | 'tableWrapperTarget'
71
+ | 'isCellMenuOpenByKeyboard'
61
72
  > & {
62
73
  isResizing: boolean;
63
74
  isTableResizing?: boolean;
64
75
  isWholeTableInDanger?: boolean;
76
+ resizingTableRef?: HTMLTableElement;
77
+ resizingTableLocalId?: string;
78
+ stickyHeader?: RowStickyState;
79
+ dragMenuDirection?: TableDirection;
80
+ dragMenuIndex?: number;
81
+ isDragMenuOpen?: boolean;
65
82
  };
66
83
 
67
84
  export type TableSharedState = Pick<
@@ -0,0 +1,249 @@
1
+ import React from 'react';
2
+
3
+ import { ACTION_SUBJECT, DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
4
+ import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
5
+ import {
6
+ ExtractInjectionAPI,
7
+ GetEditorContainerWidth,
8
+ GetEditorFeatureFlags,
9
+ } from '@atlaskit/editor-common/types';
10
+ import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
11
+ import { EditorView } from '@atlaskit/editor-prosemirror/view';
12
+ import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
13
+
14
+ import { TablePlugin, TablePluginOptions } from '../tablePluginType';
15
+ import { TableSharedStateInternal } from '../types';
16
+
17
+ import FloatingContextualButton from './FloatingContextualButton';
18
+ import FloatingContextualMenu from './FloatingContextualMenu';
19
+ import FloatingDeleteButton from './FloatingDeleteButton';
20
+ import FloatingDragMenu from './FloatingDragMenu';
21
+ // Ignored via go/ees005
22
+ // eslint-disable-next-line import/no-named-as-default
23
+ import FloatingInsertButton from './FloatingInsertButton';
24
+ import { FloatingToolbarLabel } from './FloatingToolbarLabel/FloatingToolbarLabel';
25
+ import { GlobalStylesWrapper } from './global-styles';
26
+ import { FullWidthDisplay } from './TableFullWidthLabel';
27
+
28
+ const useSharedTablePluginStateSelector = <K extends keyof TableSharedStateInternal>(
29
+ api: ExtractInjectionAPI<TablePlugin> | undefined,
30
+ key: K,
31
+ ) => {
32
+ const value = useSharedPluginStateSelector(
33
+ api,
34
+ `table.${key}` as never,
35
+ ) as TableSharedStateInternal[K];
36
+ return value;
37
+ };
38
+
39
+ export type ContentComponentProps = {
40
+ api: ExtractInjectionAPI<TablePlugin> | undefined;
41
+ editorView: EditorView;
42
+ dispatchAnalyticsEvent: DispatchAnalyticsEvent | undefined;
43
+ options?: TablePluginOptions;
44
+ popupsMountPoint?: HTMLElement;
45
+ popupsBoundariesElement?: HTMLElement;
46
+ popupsScrollableElement?: HTMLElement;
47
+ defaultGetEditorContainerWidth: GetEditorContainerWidth;
48
+ defaultGetEditorFeatureFlags: GetEditorFeatureFlags;
49
+ };
50
+
51
+ const ContentComponentInternal = ({
52
+ api,
53
+ editorView,
54
+ dispatchAnalyticsEvent,
55
+ options,
56
+ popupsMountPoint,
57
+ popupsBoundariesElement,
58
+ popupsScrollableElement,
59
+ defaultGetEditorContainerWidth,
60
+ defaultGetEditorFeatureFlags,
61
+ }: ContentComponentProps) => {
62
+ const editorAnalyticsAPI = api?.analytics?.actions;
63
+ const ariaNotifyPlugin = api?.accessibilityUtils?.actions.ariaNotify;
64
+
65
+ const resizingTableLocalId = useSharedTablePluginStateSelector(api, 'resizingTableLocalId');
66
+ const resizingTableRef = useSharedTablePluginStateSelector(api, 'resizingTableRef');
67
+ const isTableResizing = useSharedTablePluginStateSelector(api, 'isTableResizing');
68
+ const isResizing = useSharedTablePluginStateSelector(api, 'isResizing');
69
+ const widthToWidest = useSharedTablePluginStateSelector(api, 'widthToWidest');
70
+
71
+ const tableNode = useSharedTablePluginStateSelector(api, 'tableNode');
72
+ const targetCellPosition = useSharedTablePluginStateSelector(api, 'targetCellPosition');
73
+ const isContextualMenuOpen = useSharedTablePluginStateSelector(api, 'isContextualMenuOpen');
74
+ const tableRef = useSharedTablePluginStateSelector(api, 'tableRef');
75
+ const pluginConfig = useSharedTablePluginStateSelector(api, 'pluginConfig');
76
+ const insertColumnButtonIndex = useSharedTablePluginStateSelector(api, 'insertColumnButtonIndex');
77
+ const insertRowButtonIndex = useSharedTablePluginStateSelector(api, 'insertRowButtonIndex');
78
+ const isHeaderColumnEnabled = useSharedTablePluginStateSelector(api, 'isHeaderColumnEnabled');
79
+ const isHeaderRowEnabled = useSharedTablePluginStateSelector(api, 'isHeaderRowEnabled');
80
+ const isDragAndDropEnabled = useSharedTablePluginStateSelector(api, 'isDragAndDropEnabled');
81
+ const tableWrapperTarget = useSharedTablePluginStateSelector(api, 'tableWrapperTarget');
82
+ const isCellMenuOpenByKeyboard = useSharedTablePluginStateSelector(
83
+ api,
84
+ 'isCellMenuOpenByKeyboard',
85
+ );
86
+
87
+ const { allowControls } = pluginConfig;
88
+
89
+ const stickyHeader = useSharedTablePluginStateSelector(api, 'stickyHeader');
90
+
91
+ const dragMenuDirection = useSharedTablePluginStateSelector(api, 'dragMenuDirection');
92
+ const dragMenuIndex = useSharedTablePluginStateSelector(api, 'dragMenuIndex');
93
+ const isDragMenuOpen = useSharedTablePluginStateSelector(api, 'isDragMenuOpen');
94
+
95
+ return (
96
+ <>
97
+ {targetCellPosition &&
98
+ (tableRef || isCellMenuOpenByKeyboard) &&
99
+ !isResizing &&
100
+ options &&
101
+ options.allowContextualMenu && (
102
+ <FloatingContextualButton
103
+ isNumberColumnEnabled={tableNode && tableNode.attrs.isNumberColumnEnabled}
104
+ editorView={editorView}
105
+ tableNode={tableNode}
106
+ mountPoint={popupsMountPoint}
107
+ targetCellPosition={targetCellPosition}
108
+ scrollableElement={popupsScrollableElement}
109
+ dispatchAnalyticsEvent={dispatchAnalyticsEvent}
110
+ isContextualMenuOpen={isContextualMenuOpen}
111
+ stickyHeader={stickyHeader}
112
+ tableWrapper={tableWrapperTarget}
113
+ isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
114
+ />
115
+ )}
116
+ {allowControls && (
117
+ <FloatingInsertButton
118
+ tableNode={tableNode}
119
+ tableRef={tableRef}
120
+ insertColumnButtonIndex={insertColumnButtonIndex}
121
+ insertRowButtonIndex={insertRowButtonIndex}
122
+ isHeaderColumnEnabled={isHeaderColumnEnabled}
123
+ isHeaderRowEnabled={isHeaderRowEnabled}
124
+ isDragAndDropEnabled={isDragAndDropEnabled}
125
+ isTableScalingEnabled={options?.isTableScalingEnabled}
126
+ editorView={editorView}
127
+ mountPoint={popupsMountPoint}
128
+ boundariesElement={popupsBoundariesElement}
129
+ scrollableElement={popupsScrollableElement}
130
+ hasStickyHeaders={stickyHeader && stickyHeader.sticky}
131
+ dispatchAnalyticsEvent={dispatchAnalyticsEvent}
132
+ editorAnalyticsAPI={editorAnalyticsAPI}
133
+ getEditorContainerWidth={defaultGetEditorContainerWidth}
134
+ getEditorFeatureFlags={options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags}
135
+ isChromelessEditor={options?.isChromelessEditor}
136
+ api={api}
137
+ isCommentEditor={options?.isCommentEditor}
138
+ />
139
+ )}
140
+ {options?.allowContextualMenu && (
141
+ <FloatingContextualMenu
142
+ editorView={editorView}
143
+ mountPoint={popupsMountPoint}
144
+ boundariesElement={popupsBoundariesElement}
145
+ targetCellPosition={targetCellPosition}
146
+ isOpen={Boolean(isContextualMenuOpen) && !isResizing}
147
+ pluginConfig={pluginConfig}
148
+ editorAnalyticsAPI={editorAnalyticsAPI}
149
+ getEditorContainerWidth={defaultGetEditorContainerWidth}
150
+ getEditorFeatureFlags={options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags}
151
+ isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
152
+ isCommentEditor={options?.isCommentEditor}
153
+ api={api}
154
+ />
155
+ )}
156
+ {isDragAndDropEnabled && (
157
+ <FloatingDragMenu
158
+ editorView={editorView}
159
+ mountPoint={popupsMountPoint}
160
+ boundariesElement={popupsBoundariesElement}
161
+ tableRef={tableRef as HTMLTableElement}
162
+ tableNode={tableNode}
163
+ targetCellPosition={targetCellPosition}
164
+ direction={dragMenuDirection}
165
+ index={dragMenuIndex}
166
+ isOpen={!!isDragMenuOpen && !isResizing}
167
+ getEditorContainerWidth={defaultGetEditorContainerWidth}
168
+ editorAnalyticsAPI={editorAnalyticsAPI}
169
+ stickyHeaders={stickyHeader}
170
+ pluginConfig={pluginConfig}
171
+ isTableScalingEnabled={options?.isTableScalingEnabled}
172
+ getEditorFeatureFlags={options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags}
173
+ ariaNotifyPlugin={ariaNotifyPlugin}
174
+ api={api}
175
+ isCommentEditor={options?.isCommentEditor}
176
+ />
177
+ )}
178
+ {allowControls && !isDragAndDropEnabled && !isResizing && (
179
+ <FloatingDeleteButton
180
+ editorView={editorView}
181
+ selection={editorView.state.selection}
182
+ tableRef={tableRef as HTMLTableElement}
183
+ mountPoint={popupsMountPoint}
184
+ boundariesElement={popupsBoundariesElement}
185
+ scrollableElement={popupsScrollableElement}
186
+ stickyHeaders={stickyHeader}
187
+ isNumberColumnEnabled={tableNode && tableNode.attrs.isNumberColumnEnabled}
188
+ editorAnalyticsAPI={editorAnalyticsAPI}
189
+ api={api}
190
+ />
191
+ )}
192
+ {(options?.isTableScalingEnabled ||
193
+ (options?.tableOptions.allowTableResizing && options.isCommentEditor)) &&
194
+ isTableResizing &&
195
+ widthToWidest &&
196
+ resizingTableLocalId &&
197
+ resizingTableRef &&
198
+ widthToWidest[resizingTableLocalId] && (
199
+ <FloatingToolbarLabel
200
+ target={resizingTableRef}
201
+ content={<FullWidthDisplay />}
202
+ alignX={'center'}
203
+ alignY={'bottom'}
204
+ stick={true}
205
+ forcePlacement={true}
206
+ zIndex={akEditorFloatingPanelZIndex}
207
+ offset={[0, 10]}
208
+ />
209
+ )}
210
+ </>
211
+ );
212
+ };
213
+
214
+ export const ContentComponent = ({
215
+ api,
216
+ editorView,
217
+ dispatchAnalyticsEvent,
218
+ options,
219
+ popupsMountPoint,
220
+ popupsBoundariesElement,
221
+ popupsScrollableElement,
222
+ defaultGetEditorContainerWidth,
223
+ defaultGetEditorFeatureFlags,
224
+ }: ContentComponentProps) => {
225
+ return (
226
+ <ErrorBoundary
227
+ component={ACTION_SUBJECT.TABLES_PLUGIN}
228
+ dispatchAnalyticsEvent={dispatchAnalyticsEvent}
229
+ fallbackComponent={null}
230
+ >
231
+ <GlobalStylesWrapper
232
+ featureFlags={api?.featureFlags?.sharedState.currentState()}
233
+ isDragAndDropEnabledOption={options?.dragAndDropEnabled}
234
+ api={api}
235
+ />
236
+ <ContentComponentInternal
237
+ api={api}
238
+ editorView={editorView}
239
+ dispatchAnalyticsEvent={dispatchAnalyticsEvent}
240
+ options={options}
241
+ popupsMountPoint={popupsMountPoint}
242
+ popupsBoundariesElement={popupsBoundariesElement}
243
+ popupsScrollableElement={popupsScrollableElement}
244
+ defaultGetEditorContainerWidth={defaultGetEditorContainerWidth}
245
+ defaultGetEditorFeatureFlags={defaultGetEditorFeatureFlags}
246
+ />
247
+ </ErrorBoundary>
248
+ );
249
+ };
@@ -672,6 +672,10 @@ export const getToolbarConfig =
672
672
  onBlur: clearHoverSelection(),
673
673
  });
674
674
 
675
+ const shouldGroupWithoutSeparators =
676
+ editorExperiment('platform_editor_controls', 'variant1') &&
677
+ fg('platform_editor_controls_patch_6');
678
+
675
679
  return {
676
680
  title: toolbarTitle,
677
681
  getDomRef,
@@ -681,9 +685,9 @@ export const getToolbarConfig =
681
685
  zIndex: akEditorFloatingPanelZIndex + 1, // Place the context menu slightly above the others
682
686
  items: [
683
687
  menu,
684
- separator(menu.hidden),
688
+ ...(!shouldGroupWithoutSeparators ? [separator(menu.hidden)] : []),
685
689
  ...alignmentMenu,
686
- separator(alignmentMenu.length === 0),
690
+ ...(!shouldGroupWithoutSeparators ? [separator(alignmentMenu.length === 0)] : []),
687
691
  ...cellItems,
688
692
  ...columnSettingsItems,
689
693
  ...colorPicker,
@@ -698,6 +702,7 @@ export const getToolbarConfig =
698
702
  deleteButton,
699
703
  ] as Array<FloatingToolbarItem<Command>>)
700
704
  : [
705
+ shouldGroupWithoutSeparators && { type: 'separator', fullHeight: true },
701
706
  {
702
707
  type: 'overflow-dropdown',
703
708
  dropdownWidth: 220,
@@ -900,7 +905,11 @@ const getColumnSettingItems = (
900
905
  });
901
906
  }
902
907
 
903
- if (items.length !== 0) {
908
+ if (
909
+ items.length !== 0 &&
910
+ (!editorExperiment('platform_editor_controls', 'variant1') ||
911
+ !fg('platform_editor_controls_patch_6'))
912
+ ) {
904
913
  items.push({
905
914
  type: 'separator',
906
915
  });