@atlaskit/editor-plugin-table 0.0.1 → 0.0.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.
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import type { Schema } from 'prosemirror-model';
4
+ import type { EditorView } from 'prosemirror-view';
4
5
 
5
6
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
7
  import { browser } from '@atlaskit/editor-common/utils';
@@ -68,346 +69,372 @@ interface TablePluginOptions {
68
69
  wasFullWidthEnabled?: boolean;
69
70
  editorAnalyticsAPI?: EditorAnalyticsAPI;
70
71
  editorSelectionAPI?: EditorSelectionAPI;
71
- getEditorContainerWidth?: GetEditorContainerWidth;
72
72
  getEditorFeatureFlags?: GetEditorFeatureFlags;
73
73
  }
74
74
 
75
- const defaultGetEditorContainerWidth = () => {
76
- return {
77
- width: document?.body?.offsetWidth || 500,
78
- };
79
- };
80
75
  const defaultGetEditorFeatureFlags = () => ({});
81
76
 
82
- const tablesPlugin = (options?: TablePluginOptions): EditorPlugin => ({
83
- name: 'table',
77
+ const tablesPlugin = (options?: TablePluginOptions): EditorPlugin => {
78
+ const editorViewRef: Record<'current', EditorView | null> = { current: null };
79
+ const defaultGetEditorContainerWidth: GetEditorContainerWidth = () => {
80
+ if (!editorViewRef.current) {
81
+ return {
82
+ width: document?.body?.offsetWidth || 500,
83
+ };
84
+ }
85
+
86
+ const {
87
+ current: { state },
88
+ } = editorViewRef;
89
+
90
+ // TODO: ED-15663
91
+ // Please, do not copy or use this kind of code below
92
+ // @ts-ignore
93
+ return (state as any)['widthPlugin$'];
94
+ };
95
+
96
+ return {
97
+ name: 'table',
84
98
 
85
- nodes() {
86
- return [
87
- { name: 'table', node: table },
88
- { name: 'tableHeader', node: tableHeader },
89
- { name: 'tableRow', node: tableRow },
90
- { name: 'tableCell', node: tableCell },
91
- ];
92
- },
99
+ nodes() {
100
+ return [
101
+ { name: 'table', node: table },
102
+ { name: 'tableHeader', node: tableHeader },
103
+ { name: 'tableRow', node: tableRow },
104
+ { name: 'tableCell', node: tableCell },
105
+ ];
106
+ },
93
107
 
94
- pmPlugins() {
95
- const plugins: ReturnType<NonNullable<EditorPlugin['pmPlugins']>> = [
96
- {
97
- name: 'table',
98
- plugin: ({
99
- dispatchAnalyticsEvent,
100
- dispatch,
101
- portalProviderAPI,
102
- eventDispatcher,
103
- }) => {
104
- const {
105
- fullWidthEnabled,
106
- wasFullWidthEnabled,
107
- breakoutEnabled,
108
- tableOptions,
109
- editorAnalyticsAPI,
110
- getEditorFeatureFlags,
111
- } = options || ({} as TablePluginOptions);
112
- return createPlugin(
108
+ pmPlugins() {
109
+ const plugins: ReturnType<NonNullable<EditorPlugin['pmPlugins']>> = [
110
+ {
111
+ name: 'table',
112
+ plugin: ({
113
113
  dispatchAnalyticsEvent,
114
114
  dispatch,
115
115
  portalProviderAPI,
116
116
  eventDispatcher,
117
- pluginConfig(tableOptions),
118
- options?.getEditorContainerWidth || defaultGetEditorContainerWidth,
119
- getEditorFeatureFlags || defaultGetEditorFeatureFlags,
120
- breakoutEnabled,
121
- fullWidthEnabled,
122
- wasFullWidthEnabled,
123
- editorAnalyticsAPI,
124
- );
117
+ }) => {
118
+ const {
119
+ fullWidthEnabled,
120
+ wasFullWidthEnabled,
121
+ breakoutEnabled,
122
+ tableOptions,
123
+ editorAnalyticsAPI,
124
+ getEditorFeatureFlags,
125
+ } = options || ({} as TablePluginOptions);
126
+ return createPlugin(
127
+ dispatchAnalyticsEvent,
128
+ dispatch,
129
+ portalProviderAPI,
130
+ eventDispatcher,
131
+ pluginConfig(tableOptions),
132
+
133
+ defaultGetEditorContainerWidth,
134
+ getEditorFeatureFlags || defaultGetEditorFeatureFlags,
135
+ breakoutEnabled,
136
+ fullWidthEnabled,
137
+ wasFullWidthEnabled,
138
+ editorAnalyticsAPI,
139
+ );
140
+ },
125
141
  },
126
- },
127
- {
128
- name: 'tablePMColResizing',
129
- plugin: ({ dispatch }) => {
130
- const {
131
- fullWidthEnabled,
132
- tableOptions,
133
- editorAnalyticsAPI,
134
- getEditorContainerWidth,
135
- getEditorFeatureFlags,
136
- } = options || ({} as TablePluginOptions);
137
- const { allowColumnResizing } = pluginConfig(tableOptions);
138
- return allowColumnResizing
139
- ? createFlexiResizingPlugin(
140
- dispatch,
141
- {
142
- lastColumnResizable: !fullWidthEnabled,
143
- } as ColumnResizingPluginState,
144
- getEditorContainerWidth || defaultGetEditorContainerWidth,
145
- getEditorFeatureFlags || defaultGetEditorFeatureFlags,
146
- editorAnalyticsAPI,
147
- )
148
- : undefined;
142
+ {
143
+ name: 'tablePMColResizing',
144
+ plugin: ({ dispatch }) => {
145
+ const {
146
+ fullWidthEnabled,
147
+ tableOptions,
148
+ editorAnalyticsAPI,
149
+ getEditorFeatureFlags,
150
+ } = options || ({} as TablePluginOptions);
151
+ const { allowColumnResizing } = pluginConfig(tableOptions);
152
+ return allowColumnResizing
153
+ ? createFlexiResizingPlugin(
154
+ dispatch,
155
+ {
156
+ lastColumnResizable: !fullWidthEnabled,
157
+ } as ColumnResizingPluginState,
158
+ defaultGetEditorContainerWidth,
159
+ getEditorFeatureFlags || defaultGetEditorFeatureFlags,
160
+ editorAnalyticsAPI,
161
+ )
162
+ : undefined;
163
+ },
149
164
  },
150
- },
151
- { name: 'tableEditing', plugin: () => createDecorationsPlugin() },
152
- // Needs to be lower priority than editor-tables.tableEditing
153
- // plugin as it is currently swallowing backspace events inside tables
154
- {
155
- name: 'tableKeymap',
156
- plugin: () =>
157
- keymapPlugin(
158
- options?.getEditorContainerWidth || defaultGetEditorContainerWidth,
159
- options?.editorAnalyticsAPI,
160
- ),
161
- },
162
- {
163
- name: 'tableSelectionKeymap',
164
- plugin: () => tableSelectionKeymapPlugin(options?.editorSelectionAPI),
165
- },
166
- { name: 'tableEditing', plugin: () => tableEditing() as SafePlugin },
167
-
168
- {
169
- name: 'tableStickyHeaders',
170
- plugin: ({ dispatch, eventDispatcher }) =>
171
- options && options.tableOptions.stickyHeaders
172
- ? createStickyHeadersPlugin(
173
- dispatch,
174
- eventDispatcher,
175
- () => [],
176
- options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags,
177
- )
178
- : undefined,
179
- },
180
-
181
- {
182
- name: 'tableLocalId',
183
- plugin: ({ dispatch }) => createTableLocalIdPlugin(dispatch),
184
- },
185
- ];
165
+ { name: 'tableEditing', plugin: () => createDecorationsPlugin() },
166
+ // Needs to be lower priority than editor-tables.tableEditing
167
+ // plugin as it is currently swallowing backspace events inside tables
168
+ {
169
+ name: 'tableKeymap',
170
+ plugin: () =>
171
+ keymapPlugin(
172
+ defaultGetEditorContainerWidth,
173
+ options?.editorAnalyticsAPI,
174
+ ),
175
+ },
176
+ {
177
+ name: 'tableSelectionKeymap',
178
+ plugin: () => tableSelectionKeymapPlugin(options?.editorSelectionAPI),
179
+ },
180
+ { name: 'tableEditing', plugin: () => tableEditing() as SafePlugin },
186
181
 
187
- // workaround for prosemirrors delayed dom selection syncing during pointer drag
188
- // causing issues with table selections in Safari
189
- // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
182
+ {
183
+ name: 'tableStickyHeaders',
184
+ plugin: ({ dispatch, eventDispatcher }) =>
185
+ options && options.tableOptions.stickyHeaders
186
+ ? createStickyHeadersPlugin(
187
+ dispatch,
188
+ eventDispatcher,
189
+ () => [],
190
+ options?.getEditorFeatureFlags ||
191
+ defaultGetEditorFeatureFlags,
192
+ )
193
+ : undefined,
194
+ },
190
195
 
191
- // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
192
- // https://github.com/ProseMirror/prosemirror-view/pull/116
193
- if (browser.safari) {
194
- plugins.push({
195
- name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
196
- plugin: () => {
197
- return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
196
+ {
197
+ name: 'tableLocalId',
198
+ plugin: ({ dispatch }) => createTableLocalIdPlugin(dispatch),
198
199
  },
199
- });
200
- }
201
200
 
202
- // Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
203
- // https://github.com/ProseMirror/prosemirror/issues/934
204
- if (browser.safari) {
205
- plugins.push({
206
- name: 'tableSafariDeleteCompositionTextIssueWorkaround',
207
- plugin: () => {
208
- return createTableSafariDeleteCompositionTextIssueWorkaroundPlugin();
201
+ {
202
+ name: 'tableGetEditorViewReferencePlugin',
203
+ plugin: () => {
204
+ return new SafePlugin({
205
+ view: (editorView) => {
206
+ editorViewRef.current = editorView;
207
+ return {
208
+ destroy: () => {
209
+ editorViewRef.current = null;
210
+ },
211
+ };
212
+ },
213
+ });
214
+ },
209
215
  },
210
- });
211
- }
216
+ ];
212
217
 
213
- return plugins;
214
- },
218
+ // workaround for prosemirrors delayed dom selection syncing during pointer drag
219
+ // causing issues with table selections in Safari
220
+ // https://github.com/ProseMirror/prosemirror-view/commit/885258b80551ac87b81601d3ed25f552aeb22293
215
221
 
216
- contentComponent({
217
- editorView,
218
- popupsMountPoint,
219
- popupsBoundariesElement,
220
- popupsScrollableElement,
221
- dispatchAnalyticsEvent,
222
- }) {
223
- return (
224
- <ErrorBoundary
225
- component={ACTION_SUBJECT.TABLES_PLUGIN}
226
- dispatchAnalyticsEvent={dispatchAnalyticsEvent}
227
- fallbackComponent={null}
228
- >
229
- <WithPluginState
230
- plugins={{
231
- tablePluginState: pluginKey,
232
- tableResizingPluginState: tableResizingPluginKey,
233
- stickyHeadersState: stickyHeadersPluginKey,
234
- }}
235
- render={({
236
- tableResizingPluginState: resizingPluginState,
237
- stickyHeadersState,
238
- tablePluginState,
239
- }) => {
240
- const { state } = editorView;
241
- const isDragging = resizingPluginState?.dragging;
242
- const {
243
- tableNode,
244
- tablePos,
245
- targetCellPosition,
246
- isContextualMenuOpen,
247
- layout,
248
- tableRef,
249
- pluginConfig,
250
- insertColumnButtonIndex,
251
- insertRowButtonIndex,
252
- isHeaderColumnEnabled,
253
- isHeaderRowEnabled,
254
- tableWrapperTarget,
255
- } = tablePluginState!;
222
+ // NOTE: this workaround can be removed when next upgrading prosemirror as the issue will be fixed
223
+ // https://github.com/ProseMirror/prosemirror-view/pull/116
224
+ if (browser.safari) {
225
+ plugins.push({
226
+ name: 'tableSafariDelayedDomSelectionSyncingWorkaround',
227
+ plugin: () => {
228
+ return createTableSafariDelayedDomSelectionSyncingWorkaroundPlugin();
229
+ },
230
+ });
231
+ }
256
232
 
257
- const { allowControls } = pluginConfig;
233
+ // Workaround for table element breaking issue caused by composition event with an inputType of deleteCompositionText.
234
+ // https://github.com/ProseMirror/prosemirror/issues/934
235
+ if (browser.safari) {
236
+ plugins.push({
237
+ name: 'tableSafariDeleteCompositionTextIssueWorkaround',
238
+ plugin: () => {
239
+ return createTableSafariDeleteCompositionTextIssueWorkaroundPlugin();
240
+ },
241
+ });
242
+ }
258
243
 
259
- const stickyHeader = stickyHeadersState
260
- ? findStickyHeaderForTable(stickyHeadersState, tablePos)
261
- : undefined;
244
+ return plugins;
245
+ },
262
246
 
263
- return (
264
- <>
265
- {targetCellPosition &&
266
- tableRef &&
267
- !isDragging &&
268
- options &&
269
- options.allowContextualMenu && (
270
- <FloatingContextualButton
271
- isNumberColumnEnabled={
272
- tableNode && tableNode.attrs.isNumberColumnEnabled
273
- }
274
- editorView={editorView}
247
+ contentComponent({
248
+ editorView,
249
+ popupsMountPoint,
250
+ popupsBoundariesElement,
251
+ popupsScrollableElement,
252
+ dispatchAnalyticsEvent,
253
+ }) {
254
+ return (
255
+ <ErrorBoundary
256
+ component={ACTION_SUBJECT.TABLES_PLUGIN}
257
+ dispatchAnalyticsEvent={dispatchAnalyticsEvent}
258
+ fallbackComponent={null}
259
+ >
260
+ <WithPluginState
261
+ plugins={{
262
+ tablePluginState: pluginKey,
263
+ tableResizingPluginState: tableResizingPluginKey,
264
+ stickyHeadersState: stickyHeadersPluginKey,
265
+ }}
266
+ render={({
267
+ tableResizingPluginState: resizingPluginState,
268
+ stickyHeadersState,
269
+ tablePluginState,
270
+ }) => {
271
+ const { state } = editorView;
272
+ const isDragging = resizingPluginState?.dragging;
273
+ const {
274
+ tableNode,
275
+ tablePos,
276
+ targetCellPosition,
277
+ isContextualMenuOpen,
278
+ layout,
279
+ tableRef,
280
+ pluginConfig,
281
+ insertColumnButtonIndex,
282
+ insertRowButtonIndex,
283
+ isHeaderColumnEnabled,
284
+ isHeaderRowEnabled,
285
+ tableWrapperTarget,
286
+ } = tablePluginState!;
287
+
288
+ const { allowControls } = pluginConfig;
289
+
290
+ const stickyHeader = stickyHeadersState
291
+ ? findStickyHeaderForTable(stickyHeadersState, tablePos)
292
+ : undefined;
293
+
294
+ return (
295
+ <>
296
+ {targetCellPosition &&
297
+ tableRef &&
298
+ !isDragging &&
299
+ options &&
300
+ options.allowContextualMenu && (
301
+ <FloatingContextualButton
302
+ isNumberColumnEnabled={
303
+ tableNode && tableNode.attrs.isNumberColumnEnabled
304
+ }
305
+ editorView={editorView}
306
+ tableNode={tableNode}
307
+ mountPoint={popupsMountPoint}
308
+ targetCellPosition={targetCellPosition}
309
+ scrollableElement={popupsScrollableElement}
310
+ dispatchAnalyticsEvent={dispatchAnalyticsEvent}
311
+ isContextualMenuOpen={isContextualMenuOpen}
312
+ layout={layout}
313
+ stickyHeader={stickyHeader}
314
+ />
315
+ )}
316
+ {allowControls && (
317
+ <FloatingInsertButton
275
318
  tableNode={tableNode}
319
+ tableRef={tableRef}
320
+ insertColumnButtonIndex={insertColumnButtonIndex}
321
+ insertRowButtonIndex={insertRowButtonIndex}
322
+ isHeaderColumnEnabled={isHeaderColumnEnabled}
323
+ isHeaderRowEnabled={isHeaderRowEnabled}
324
+ editorView={editorView}
276
325
  mountPoint={popupsMountPoint}
277
- targetCellPosition={targetCellPosition}
326
+ boundariesElement={popupsBoundariesElement}
278
327
  scrollableElement={popupsScrollableElement}
328
+ hasStickyHeaders={stickyHeader && stickyHeader.sticky}
279
329
  dispatchAnalyticsEvent={dispatchAnalyticsEvent}
280
- isContextualMenuOpen={isContextualMenuOpen}
281
- layout={layout}
282
- stickyHeader={stickyHeader}
330
+ editorAnalyticsAPI={options?.editorAnalyticsAPI}
331
+ getEditorContainerWidth={defaultGetEditorContainerWidth}
283
332
  />
284
333
  )}
285
- {allowControls && (
286
- <FloatingInsertButton
287
- tableNode={tableNode}
288
- tableRef={tableRef}
289
- insertColumnButtonIndex={insertColumnButtonIndex}
290
- insertRowButtonIndex={insertRowButtonIndex}
291
- isHeaderColumnEnabled={isHeaderColumnEnabled}
292
- isHeaderRowEnabled={isHeaderRowEnabled}
293
- editorView={editorView}
294
- mountPoint={popupsMountPoint}
295
- boundariesElement={popupsBoundariesElement}
296
- scrollableElement={popupsScrollableElement}
297
- hasStickyHeaders={stickyHeader && stickyHeader.sticky}
298
- dispatchAnalyticsEvent={dispatchAnalyticsEvent}
299
- editorAnalyticsAPI={options?.editorAnalyticsAPI}
300
- getEditorContainerWidth={
301
- options?.getEditorContainerWidth ||
302
- defaultGetEditorContainerWidth
303
- }
304
- />
305
- )}
306
- <FloatingContextualMenu
307
- editorView={editorView}
308
- mountPoint={popupsMountPoint}
309
- boundariesElement={popupsBoundariesElement}
310
- targetCellPosition={targetCellPosition}
311
- isOpen={Boolean(isContextualMenuOpen)}
312
- pluginConfig={pluginConfig}
313
- editorAnalyticsAPI={options?.editorAnalyticsAPI}
314
- getEditorContainerWidth={
315
- options?.getEditorContainerWidth ||
316
- defaultGetEditorContainerWidth
317
- }
318
- />
319
- {allowControls && (
320
- <FloatingDeleteButton
334
+ <FloatingContextualMenu
321
335
  editorView={editorView}
322
- selection={editorView.state.selection}
323
- tableRef={tableRef as HTMLTableElement}
324
336
  mountPoint={popupsMountPoint}
325
337
  boundariesElement={popupsBoundariesElement}
326
- scrollableElement={popupsScrollableElement}
327
- stickyHeaders={stickyHeader}
328
- isNumberColumnEnabled={
329
- tableNode && tableNode.attrs.isNumberColumnEnabled
330
- }
338
+ targetCellPosition={targetCellPosition}
339
+ isOpen={Boolean(isContextualMenuOpen)}
340
+ pluginConfig={pluginConfig}
331
341
  editorAnalyticsAPI={options?.editorAnalyticsAPI}
342
+ getEditorContainerWidth={defaultGetEditorContainerWidth}
332
343
  />
333
- )}
334
- {isLayoutSupported(state) &&
335
- options &&
336
- options.breakoutEnabled && (
337
- <LayoutButton
344
+ {allowControls && (
345
+ <FloatingDeleteButton
338
346
  editorView={editorView}
347
+ selection={editorView.state.selection}
348
+ tableRef={tableRef as HTMLTableElement}
339
349
  mountPoint={popupsMountPoint}
340
350
  boundariesElement={popupsBoundariesElement}
341
351
  scrollableElement={popupsScrollableElement}
342
- targetRef={tableWrapperTarget!}
343
- layout={layout}
344
- isResizing={
345
- !!resizingPluginState && !!resizingPluginState.dragging
352
+ stickyHeaders={stickyHeader}
353
+ isNumberColumnEnabled={
354
+ tableNode && tableNode.attrs.isNumberColumnEnabled
346
355
  }
347
- stickyHeader={stickyHeader}
348
356
  editorAnalyticsAPI={options?.editorAnalyticsAPI}
349
357
  />
350
358
  )}
351
- </>
352
- );
353
- }}
354
- />
355
- </ErrorBoundary>
356
- );
357
- },
358
-
359
- pluginsOptions: {
360
- // TODO: ED-14676 This is not the final API design
361
- // For now, we are using this on (insert-api/api.ts) but we may create a proper place for it
362
- createNodeHandler: ({
363
- nodeName,
364
- schema,
365
- }: {
366
- nodeName: string;
367
- schema: Schema;
368
- }) => {
369
- // An EditorPlugin may manage more than one node.
370
- if (nodeName !== 'table') {
371
- return null;
372
- }
359
+ {isLayoutSupported(state) &&
360
+ options &&
361
+ options.breakoutEnabled && (
362
+ <LayoutButton
363
+ editorView={editorView}
364
+ mountPoint={popupsMountPoint}
365
+ boundariesElement={popupsBoundariesElement}
366
+ scrollableElement={popupsScrollableElement}
367
+ targetRef={tableWrapperTarget!}
368
+ layout={layout}
369
+ isResizing={
370
+ !!resizingPluginState &&
371
+ !!resizingPluginState.dragging
372
+ }
373
+ stickyHeader={stickyHeader}
374
+ editorAnalyticsAPI={options?.editorAnalyticsAPI}
375
+ />
376
+ )}
377
+ </>
378
+ );
379
+ }}
380
+ />
381
+ </ErrorBoundary>
382
+ );
383
+ },
373
384
 
374
- const table = createTable({
385
+ pluginsOptions: {
386
+ // TODO: ED-14676 This is not the final API design
387
+ // For now, we are using this on (insert-api/api.ts) but we may create a proper place for it
388
+ createNodeHandler: ({
389
+ nodeName,
375
390
  schema,
376
- });
391
+ }: {
392
+ nodeName: string;
393
+ schema: Schema;
394
+ }) => {
395
+ // An EditorPlugin may manage more than one node.
396
+ if (nodeName !== 'table') {
397
+ return null;
398
+ }
377
399
 
378
- return table;
379
- },
380
- quickInsert: ({ formatMessage }) => [
381
- {
382
- id: 'table',
383
- title: formatMessage(messages.table),
384
- description: formatMessage(messages.tableDescription),
385
- keywords: ['cell', 'table'],
386
- priority: 600,
387
- keyshortcut: tooltip(toggleTable),
388
- // icon: () => <IconTable />,
389
- action(insert, state) {
390
- const tr = insert(
391
- createTable({
392
- schema: state.schema,
393
- }),
394
- );
395
- options?.editorAnalyticsAPI?.attachAnalyticsEvent({
396
- action: ACTION.INSERTED,
397
- actionSubject: ACTION_SUBJECT.DOCUMENT,
398
- actionSubjectId: ACTION_SUBJECT_ID.TABLE,
399
- attributes: { inputMethod: INPUT_METHOD.QUICK_INSERT },
400
- eventType: EVENT_TYPE.TRACK,
401
- })(tr);
402
- return tr;
403
- },
400
+ const table = createTable({
401
+ schema,
402
+ });
403
+
404
+ return table;
404
405
  },
405
- ],
406
- floatingToolbar: getToolbarConfig(
407
- options?.getEditorContainerWidth || defaultGetEditorContainerWidth,
408
- options?.editorAnalyticsAPI,
409
- )(pluginConfig(options?.tableOptions)),
410
- },
411
- });
406
+ quickInsert: ({ formatMessage }) => [
407
+ {
408
+ id: 'table',
409
+ title: formatMessage(messages.table),
410
+ description: formatMessage(messages.tableDescription),
411
+ keywords: ['cell', 'table'],
412
+ priority: 600,
413
+ keyshortcut: tooltip(toggleTable),
414
+ // icon: () => <IconTable />,
415
+ action(insert, state) {
416
+ const tr = insert(
417
+ createTable({
418
+ schema: state.schema,
419
+ }),
420
+ );
421
+ options?.editorAnalyticsAPI?.attachAnalyticsEvent({
422
+ action: ACTION.INSERTED,
423
+ actionSubject: ACTION_SUBJECT.DOCUMENT,
424
+ actionSubjectId: ACTION_SUBJECT_ID.TABLE,
425
+ attributes: { inputMethod: INPUT_METHOD.QUICK_INSERT },
426
+ eventType: EVENT_TYPE.TRACK,
427
+ })(tr);
428
+ return tr;
429
+ },
430
+ },
431
+ ],
432
+ floatingToolbar: getToolbarConfig(
433
+ defaultGetEditorContainerWidth,
434
+ options?.editorAnalyticsAPI,
435
+ )(pluginConfig(options?.tableOptions)),
436
+ },
437
+ };
438
+ };
412
439
 
413
440
  export default tablesPlugin;