@atlaskit/editor-plugin-table 13.0.4 → 13.0.6

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/nodeviews/TableComponentWithSharedState.js +19 -98
  3. package/dist/cjs/nodeviews/TableContainer.js +14 -53
  4. package/dist/cjs/nodeviews/TableResizer.js +2 -15
  5. package/dist/cjs/nodeviews/table.js +4 -4
  6. package/dist/cjs/tablePlugin.js +30 -213
  7. package/dist/cjs/ui/DragHandle/index.js +9 -26
  8. package/dist/cjs/ui/DragPreview/index.js +1 -1
  9. package/dist/cjs/ui/FloatingContextualButton/styles.js +1 -1
  10. package/dist/cjs/ui/FloatingContextualMenu/styles.js +1 -1
  11. package/dist/cjs/ui/FloatingDragMenu/styles.js +1 -1
  12. package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -20
  13. package/dist/cjs/ui/TableFloatingControls/CornerControls/DragCornerControls.js +6 -19
  14. package/dist/cjs/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -20
  15. package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +7 -20
  16. package/dist/cjs/ui/TableFullWidthLabel/index.js +1 -1
  17. package/dist/cjs/ui/global-styles.js +4 -17
  18. package/dist/cjs/ui/icons/SortingIconWrapper.js +2 -15
  19. package/dist/cjs/ui/ui-styles.js +1 -1
  20. package/dist/es2019/nodeviews/TableComponentWithSharedState.js +21 -102
  21. package/dist/es2019/nodeviews/TableContainer.js +11 -54
  22. package/dist/es2019/nodeviews/TableResizer.js +2 -17
  23. package/dist/es2019/nodeviews/table.js +4 -4
  24. package/dist/es2019/tablePlugin.js +19 -211
  25. package/dist/es2019/ui/DragHandle/index.js +8 -27
  26. package/dist/es2019/ui/DragPreview/index.js +1 -1
  27. package/dist/es2019/ui/FloatingContextualButton/styles.js +1 -1
  28. package/dist/es2019/ui/FloatingContextualMenu/styles.js +3 -3
  29. package/dist/es2019/ui/FloatingDragMenu/styles.js +2 -2
  30. package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +7 -22
  31. package/dist/es2019/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -22
  32. package/dist/es2019/ui/TableFloatingControls/FloatingControlsWithSelection.js +7 -22
  33. package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +7 -22
  34. package/dist/es2019/ui/TableFullWidthLabel/index.js +1 -1
  35. package/dist/es2019/ui/global-styles.js +6 -21
  36. package/dist/es2019/ui/icons/SortingIconWrapper.js +3 -18
  37. package/dist/es2019/ui/ui-styles.js +1 -1
  38. package/dist/esm/nodeviews/TableComponentWithSharedState.js +20 -99
  39. package/dist/esm/nodeviews/TableContainer.js +15 -54
  40. package/dist/esm/nodeviews/TableResizer.js +3 -16
  41. package/dist/esm/nodeviews/table.js +4 -4
  42. package/dist/esm/tablePlugin.js +24 -208
  43. package/dist/esm/ui/DragHandle/index.js +10 -27
  44. package/dist/esm/ui/DragPreview/index.js +1 -1
  45. package/dist/esm/ui/FloatingContextualButton/styles.js +1 -1
  46. package/dist/esm/ui/FloatingContextualMenu/styles.js +1 -1
  47. package/dist/esm/ui/FloatingDragMenu/styles.js +1 -1
  48. package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +8 -21
  49. package/dist/esm/ui/TableFloatingControls/CornerControls/DragCornerControls.js +7 -20
  50. package/dist/esm/ui/TableFloatingControls/FloatingControlsWithSelection.js +8 -21
  51. package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +8 -21
  52. package/dist/esm/ui/TableFullWidthLabel/index.js +1 -1
  53. package/dist/esm/ui/global-styles.js +5 -18
  54. package/dist/esm/ui/icons/SortingIconWrapper.js +3 -16
  55. package/dist/esm/ui/ui-styles.js +1 -1
  56. package/dist/types/nodeviews/TableComponentWithSharedState.d.ts +1 -1
  57. package/dist/types-ts4.5/nodeviews/TableComponentWithSharedState.d.ts +1 -1
  58. package/package.json +4 -4
@@ -2,26 +2,19 @@ import React, { useEffect } from 'react';
2
2
  import { tableCell, tableCellWithNestedTable, tableHeader, tableHeaderWithLocalId, tableHeaderWithNestedTable, tableRow, tableRowWithNestedTable, tableRowWithLocalId, tableCellWithLocalId, tableCellWithNestedTableWithLocalId, tableRowWithNestedTableWithLocalId, tableHeaderWithNestedTableWithLocalId } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, TABLE_ACTION } from '@atlaskit/editor-common/analytics';
4
4
  import { browser } from '@atlaskit/editor-common/browser';
5
- import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
6
- import { getDomRefFromSelection } from '@atlaskit/editor-common/get-dom-ref-from-selection';
7
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
6
  import { IconTable } from '@atlaskit/editor-common/icons';
9
7
  import { toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
10
8
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
11
9
  import { getParentOfTypeCount, getPositionAfterTopParentNodeOfType } from '@atlaskit/editor-common/nesting';
12
10
  import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
13
- import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
14
11
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
15
- import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
16
12
  import { hasParentNodeOfType, safeInsert } from '@atlaskit/editor-prosemirror/utils';
17
- import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
18
13
  import { tableEditing } from '@atlaskit/editor-tables/pm-plugins';
19
14
  import { fg } from '@atlaskit/platform-feature-flags';
20
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
21
15
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
22
16
  import { tableNodeSpecWithFixedToDOM } from './nodeviews/toDOM';
23
17
  import { createPlugin as createTableAnalyticsPlugin } from './pm-plugins/analytics/plugin';
24
- import { pluginKey as tableAnalyticsPluginKey } from './pm-plugins/analytics/plugin-key';
25
18
  import { insertTableWithNestingSupport, insertTableWithSize } from './pm-plugins/commands/insert';
26
19
  import { pluginConfig } from './pm-plugins/create-plugin-config';
27
20
  import { createPlugin as createDecorationsPlugin } from './pm-plugins/decorations/plugin';
@@ -38,7 +31,6 @@ import { createPlugin as createTableOverflowAnalyticsPlugin } from './pm-plugins
38
31
  import { createPlugin as createTableLocalIdPlugin } from './pm-plugins/table-local-id';
39
32
  import { createPlugin as createFlexiResizingPlugin } from './pm-plugins/table-resizing/plugin';
40
33
  import { getPluginState as getFlexiResizingPlugin } from './pm-plugins/table-resizing/plugin-factory';
41
- import { pluginKey as tableResizingPluginKey } from './pm-plugins/table-resizing/plugin-key';
42
34
  import { tableSelectionKeymapPlugin } from './pm-plugins/table-selection-keymap';
43
35
  import { createPlugin as createSizeSelectorPlugin, pluginKey as sizeSelectorPluginKey } from './pm-plugins/table-size-selector';
44
36
  import { createPlugin as createTableWidthPlugin, pluginKey as tableWidthPluginKey } from './pm-plugins/table-width';
@@ -46,39 +38,8 @@ import { createPlugin as createTableWidthInCommentFixPlugin } from './pm-plugins
46
38
  import { createTableWithWidth } from './pm-plugins/utils/create';
47
39
  import { createPlugin as createViewModeSortPlugin } from './pm-plugins/view-mode-sort';
48
40
  import { ContentComponent } from './ui/ContentComponent';
49
- import FloatingContextualButton from './ui/FloatingContextualButton';
50
- import FloatingContextualMenu from './ui/FloatingContextualMenu';
51
- import FloatingDeleteButton from './ui/FloatingDeleteButton';
52
- import FloatingDragMenu from './ui/FloatingDragMenu';
53
- // Ignored via go/ees005
54
- // eslint-disable-next-line import/no-named-as-default
55
- import FloatingInsertButton from './ui/FloatingInsertButton';
56
- import { FloatingToolbarLabel } from './ui/FloatingToolbarLabel/FloatingToolbarLabel';
57
- import { GlobalStylesWrapper } from './ui/global-styles';
58
- import { SizeSelector } from './ui/SizeSelector';
59
- import { FullWidthDisplay } from './ui/TableFullWidthLabel';
60
41
  import { getToolbarConfig } from './ui/toolbar';
61
42
  const defaultGetEditorFeatureFlags = () => ({});
62
- const useTableSharedState = sharedPluginStateHookMigratorFactory(api => {
63
- const {
64
- mode
65
- } = useSharedPluginStateWithSelector(api, ['editorViewMode'], states => {
66
- var _states$editorViewMod;
67
- return {
68
- mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
69
- };
70
- });
71
- return {
72
- mode
73
- };
74
- }, api => {
75
- const {
76
- editorViewModeState
77
- } = useSharedPluginState(api, ['editorViewMode']);
78
- return {
79
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
80
- };
81
- });
82
43
 
83
44
  /**
84
45
  * Table plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
@@ -88,7 +49,7 @@ const tablePlugin = ({
88
49
  config: options,
89
50
  api
90
51
  }) => {
91
- var _api$analytics, _api$accessibilityUti, _options$getEditorFea, _options$getEditorFea2, _api$analytics2;
52
+ var _api$analytics, _options$getEditorFea, _options$getEditorFea2, _api$analytics2;
92
53
  const editorViewRef = {
93
54
  current: null
94
55
  };
@@ -99,7 +60,6 @@ const tablePlugin = ({
99
60
  };
100
61
  };
101
62
  const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
102
- const ariaNotifyPlugin = api === null || api === void 0 ? void 0 : (_api$accessibilityUti = api.accessibilityUtils) === null || _api$accessibilityUti === void 0 ? void 0 : _api$accessibilityUti.actions.ariaNotify;
103
63
  const isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 ? void 0 : (_options$getEditorFea = options.getEditorFeatureFlags) === null || _options$getEditorFea === void 0 ? void 0 : _options$getEditorFea.call(options).tableWithFixedColumnWidthsOption) || false;
104
64
  const shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
105
65
  options === null || options === void 0 ? void 0 : options.isCommentEditor));
@@ -476,175 +436,18 @@ const tablePlugin = ({
476
436
  popupsScrollableElement,
477
437
  dispatchAnalyticsEvent
478
438
  }) {
479
- var _api$featureFlags;
480
- if (expValEquals('platform_editor_usesharedpluginstatewithselector', 'isEnabled', true)) {
481
- return /*#__PURE__*/React.createElement(ContentComponent, {
482
- api: api,
483
- editorView: editorView,
484
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
485
- options: options,
486
- popupsMountPoint: popupsMountPoint,
487
- popupsBoundariesElement: popupsBoundariesElement,
488
- popupsScrollableElement: popupsScrollableElement,
489
- defaultGetEditorContainerWidth: defaultGetEditorContainerWidth,
490
- defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags,
491
- isTableSelectorEnabled: isTableSelectorEnabled
492
- });
493
- }
494
- return /*#__PURE__*/React.createElement(ErrorBoundary, {
495
- component: ACTION_SUBJECT.TABLES_PLUGIN,
439
+ return /*#__PURE__*/React.createElement(ContentComponent, {
440
+ api: api,
441
+ editorView: editorView,
496
442
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
497
- fallbackComponent: null
498
- }, /*#__PURE__*/React.createElement(GlobalStylesWrapper, {
499
- featureFlags: api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState(),
500
- isDragAndDropEnabledOption: options === null || options === void 0 ? void 0 : options.dragAndDropEnabled,
501
- api: api
502
- }), /*#__PURE__*/React.createElement(WithPluginState, {
503
- plugins: {
504
- tableAnalyticsPluginState: tableAnalyticsPluginKey,
505
- tablePluginState: pluginKey,
506
- tableWidthPluginState: tableWidthPluginKey,
507
- tableResizingPluginState: tableResizingPluginKey,
508
- stickyHeadersState: stickyHeadersPluginKey,
509
- dragAndDropState: dragAndDropPluginKey,
510
- sizeSelectorPluginState: sizeSelectorPluginKey
511
- },
512
- render: ({
513
- tableResizingPluginState: resizingPluginState,
514
- stickyHeadersState,
515
- tablePluginState,
516
- tableWidthPluginState,
517
- dragAndDropState,
518
- sizeSelectorPluginState
519
- }) => {
520
- var _sizeSelectorPluginSt, _api$analytics3;
521
- // Any changes made inside `<WithPluginState>` need to be reflected in the
522
- // `<ContentComponent>` as well.
523
- const isColumnResizing = resizingPluginState === null || resizingPluginState === void 0 ? void 0 : resizingPluginState.dragging;
524
- const isTableResizing = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.resizing;
525
- const resizingTableLocalId = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableLocalId;
526
- const resizingTableRef = tableWidthPluginState === null || tableWidthPluginState === void 0 ? void 0 : tableWidthPluginState.tableRef;
527
- const isResizing = isColumnResizing || isTableResizing;
528
- const widthToWidest = tablePluginState === null || tablePluginState === void 0 ? void 0 : tablePluginState.widthToWidest;
529
- const isSizeSelectorOpen = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.isSelectorOpen;
530
- const {
531
- tableNode,
532
- tablePos,
533
- targetCellPosition,
534
- isContextualMenuOpen,
535
- tableRef,
536
- pluginConfig,
537
- insertColumnButtonIndex,
538
- insertRowButtonIndex,
539
- isHeaderColumnEnabled,
540
- isHeaderRowEnabled,
541
- isDragAndDropEnabled,
542
- tableWrapperTarget,
543
- isCellMenuOpenByKeyboard
544
- // Ignored via go/ees005
545
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
546
- } = tablePluginState;
547
- const {
548
- allowControls
549
- } = pluginConfig;
550
- const stickyHeader = stickyHeadersState ? findStickyHeaderForTable(stickyHeadersState, tablePos) : undefined;
551
- return /*#__PURE__*/React.createElement(React.Fragment, null, targetCellPosition && (tableRef || isCellMenuOpenByKeyboard) && !isResizing && options && options.allowContextualMenu && /*#__PURE__*/React.createElement(FloatingContextualButton, {
552
- isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
553
- editorView: editorView,
554
- tableNode: tableNode,
555
- mountPoint: popupsMountPoint,
556
- targetCellPosition: targetCellPosition,
557
- scrollableElement: popupsScrollableElement,
558
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
559
- isContextualMenuOpen: isContextualMenuOpen,
560
- stickyHeader: stickyHeader,
561
- tableWrapper: tableWrapperTarget,
562
- isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard
563
- }), allowControls && /*#__PURE__*/React.createElement(FloatingInsertButton, {
564
- tableNode: tableNode,
565
- tableRef: tableRef,
566
- insertColumnButtonIndex: insertColumnButtonIndex,
567
- insertRowButtonIndex: insertRowButtonIndex,
568
- isHeaderColumnEnabled: isHeaderColumnEnabled,
569
- isHeaderRowEnabled: isHeaderRowEnabled,
570
- isDragAndDropEnabled: isDragAndDropEnabled,
571
- isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
572
- editorView: editorView,
573
- mountPoint: popupsMountPoint,
574
- boundariesElement: popupsBoundariesElement,
575
- scrollableElement: popupsScrollableElement,
576
- hasStickyHeaders: stickyHeader && stickyHeader.sticky,
577
- dispatchAnalyticsEvent: dispatchAnalyticsEvent,
578
- editorAnalyticsAPI: editorAnalyticsAPI,
579
- getEditorContainerWidth: defaultGetEditorContainerWidth,
580
- getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
581
- isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
582
- api: api,
583
- isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
584
- }), (options === null || options === void 0 ? void 0 : options.allowContextualMenu) && /*#__PURE__*/React.createElement(FloatingContextualMenu, {
585
- editorView: editorView,
586
- mountPoint: popupsMountPoint,
587
- boundariesElement: popupsBoundariesElement,
588
- targetCellPosition: targetCellPosition,
589
- isOpen: Boolean(isContextualMenuOpen) && !isResizing,
590
- pluginConfig: pluginConfig,
591
- editorAnalyticsAPI: editorAnalyticsAPI,
592
- getEditorContainerWidth: defaultGetEditorContainerWidth,
593
- getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
594
- isCellMenuOpenByKeyboard: isCellMenuOpenByKeyboard,
595
- isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
596
- api: api
597
- }), isDragAndDropEnabled && /*#__PURE__*/React.createElement(FloatingDragMenu, {
598
- editorView: editorView,
599
- mountPoint: popupsMountPoint,
600
- boundariesElement: popupsBoundariesElement,
601
- tableRef: tableRef,
602
- tableNode: tableNode,
603
- targetCellPosition: targetCellPosition,
604
- direction: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuDirection,
605
- index: dragAndDropState === null || dragAndDropState === void 0 ? void 0 : dragAndDropState.dragMenuIndex,
606
- isOpen: !!(dragAndDropState !== null && dragAndDropState !== void 0 && dragAndDropState.isDragMenuOpen) && !isResizing,
607
- getEditorContainerWidth: defaultGetEditorContainerWidth,
608
- editorAnalyticsAPI: editorAnalyticsAPI,
609
- stickyHeaders: stickyHeader,
610
- pluginConfig: pluginConfig,
611
- isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
612
- getEditorFeatureFlags: (options === null || options === void 0 ? void 0 : options.getEditorFeatureFlags) || defaultGetEditorFeatureFlags,
613
- ariaNotifyPlugin: ariaNotifyPlugin,
614
- api: api,
615
- isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor
616
- }), allowControls && !isDragAndDropEnabled && !isResizing && /*#__PURE__*/React.createElement(FloatingDeleteButton, {
617
- editorView: editorView,
618
- selection: editorView.state.selection,
619
- tableRef: tableRef,
620
- mountPoint: popupsMountPoint,
621
- boundariesElement: popupsBoundariesElement,
622
- scrollableElement: popupsScrollableElement,
623
- stickyHeaders: stickyHeader,
624
- isNumberColumnEnabled: tableNode && tableNode.attrs.isNumberColumnEnabled,
625
- editorAnalyticsAPI: editorAnalyticsAPI,
626
- api: api
627
- }), ((options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) || (options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing) && options.isCommentEditor) && isTableResizing && widthToWidest && resizingTableLocalId && resizingTableRef && widthToWidest[resizingTableLocalId] && /*#__PURE__*/React.createElement(FloatingToolbarLabel, {
628
- target: resizingTableRef,
629
- content: editorExperiment('single_column_layouts', true) ? /*#__PURE__*/React.createElement(ResizerBreakoutModeLabel, {
630
- layout: "full-width"
631
- }) : /*#__PURE__*/React.createElement(FullWidthDisplay, null),
632
- alignX: 'center',
633
- alignY: 'bottom',
634
- stick: true,
635
- forcePlacement: true,
636
- zIndex: akEditorFloatingPanelZIndex,
637
- offset: [0, 10]
638
- }), isTableSelectorEnabled && isSizeSelectorOpen && /*#__PURE__*/React.createElement(SizeSelector, {
639
- api: api,
640
- isOpenedByKeyboard: false,
641
- popupsMountPoint: popupsMountPoint,
642
- target: (_sizeSelectorPluginSt = sizeSelectorPluginState === null || sizeSelectorPluginState === void 0 ? void 0 : sizeSelectorPluginState.targetRef) !== null && _sizeSelectorPluginSt !== void 0 ? _sizeSelectorPluginSt : getDomRefFromSelection(editorView, ACTION_SUBJECT_ID.PICKER_TABLE_SIZE, api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions),
643
- popupsBoundariesElement: popupsBoundariesElement,
644
- popupsScrollableElement: popupsScrollableElement
645
- }));
646
- }
647
- }));
443
+ options: options,
444
+ popupsMountPoint: popupsMountPoint,
445
+ popupsBoundariesElement: popupsBoundariesElement,
446
+ popupsScrollableElement: popupsScrollableElement,
447
+ defaultGetEditorContainerWidth: defaultGetEditorContainerWidth,
448
+ defaultGetEditorFeatureFlags: defaultGetEditorFeatureFlags,
449
+ isTableSelectorEnabled: isTableSelectorEnabled
450
+ });
648
451
  },
649
452
  pluginsOptions: {
650
453
  quickInsert: ({
@@ -722,7 +525,12 @@ const tablePlugin = ({
722
525
  }) {
723
526
  const {
724
527
  mode
725
- } = useTableSharedState(api);
528
+ } = useSharedPluginStateWithSelector(api, ['editorViewMode'], states => {
529
+ var _states$editorViewMod;
530
+ return {
531
+ mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
532
+ };
533
+ });
726
534
  useEffect(() => {
727
535
  const {
728
536
  state,
@@ -5,7 +5,7 @@ import classnames from 'classnames';
5
5
  import ReactDOM from 'react-dom';
6
6
  import { injectIntl } from 'react-intl-next';
7
7
  import { browser } from '@atlaskit/editor-common/browser';
8
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
9
9
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
10
10
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
11
11
  import { findTable, TableMap } from '@atlaskit/editor-tables';
@@ -250,31 +250,6 @@ const DragHandleComponent = ({
250
250
  height: previewHeight
251
251
  }), previewContainer));
252
252
  };
253
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
254
- const {
255
- hoveredColumns,
256
- hoveredRows
257
- } = useSharedPluginStateWithSelector(api, ['table'], states => {
258
- var _states$tableState, _states$tableState2;
259
- return {
260
- hoveredColumns: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.hoveredColumns,
261
- hoveredRows: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.hoveredRows
262
- };
263
- });
264
- return {
265
- hoveredColumns,
266
- hoveredRows
267
- };
268
- }, api => {
269
- const {
270
- tableState
271
- } = useSharedPluginState(api, ['table']);
272
- const tableStateInternal = tableState;
273
- return {
274
- hoveredColumns: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredColumns,
275
- hoveredRows: tableStateInternal === null || tableStateInternal === void 0 ? void 0 : tableStateInternal.hoveredRows
276
- };
277
- });
278
253
  const DragHandleComponentWithSharedState = ({
279
254
  isDragMenuTarget,
280
255
  tableLocalId,
@@ -296,7 +271,13 @@ const DragHandleComponentWithSharedState = ({
296
271
  const {
297
272
  hoveredColumns,
298
273
  hoveredRows
299
- } = useSharedState(api);
274
+ } = useSharedPluginStateWithSelector(api, ['table'], states => {
275
+ var _states$tableState, _states$tableState2;
276
+ return {
277
+ hoveredColumns: (_states$tableState = states.tableState) === null || _states$tableState === void 0 ? void 0 : _states$tableState.hoveredColumns,
278
+ hoveredRows: (_states$tableState2 = states.tableState) === null || _states$tableState2 === void 0 ? void 0 : _states$tableState2.hoveredRows
279
+ };
280
+ });
300
281
  return /*#__PURE__*/React.createElement(DragHandleComponent, {
301
282
  isDragMenuTarget: isDragMenuTarget,
302
283
  tableLocalId: tableLocalId,
@@ -6,7 +6,7 @@ import { DragInMotionIcon } from '../icons/DragInMotionIcon';
6
6
  const boxStyles = xcss({
7
7
  borderColor: 'color.border.focused',
8
8
  borderStyle: 'solid',
9
- borderRadius: 'border.radius.100',
9
+ borderRadius: 'radius.small',
10
10
  borderWidth: 'border.width.outline',
11
11
  backgroundColor: 'color.blanket.selected'
12
12
  });
@@ -8,7 +8,7 @@ export const tableFloatingCellButtonStyles = () => css({
8
8
  '> div': {
9
9
  // Sits behind button to provide surface-color background
10
10
  background: `var(--ds-surface, ${N20})`,
11
- borderRadius: "var(--ds-border-radius, 3px)",
11
+ borderRadius: "var(--ds-radius-small, 3px)",
12
12
  display: 'flex',
13
13
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
14
14
  height: `${contextualMenuTriggerSize + 2}px`,
@@ -14,7 +14,7 @@ export const tablePopupStyles = (isDragAndDropEnabled
14
14
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
15
15
  ) => css`
16
16
  .${ClassName.CONTEXTUAL_SUBMENU} {
17
- border-radius: ${"var(--ds-border-radius, 3px)"};
17
+ border-radius: ${"var(--ds-radius-small, 3px)"};
18
18
  background: ${"var(--ds-surface-overlay, white)"};
19
19
  box-shadow: ${`var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`})`};
20
20
  display: block;
@@ -35,7 +35,7 @@ export const tablePopupStyles = (isDragAndDropEnabled
35
35
  content: '';
36
36
  display: block;
37
37
  border: 1px solid ${tableBackgroundBorderColor};
38
- border-radius: ${"var(--ds-border-radius, 3px)"};
38
+ border-radius: ${"var(--ds-radius-small, 3px)"};
39
39
  width: 20px;
40
40
  height: 20px;
41
41
  }
@@ -55,7 +55,7 @@ export const tablePopupStyles = (isDragAndDropEnabled
55
55
  content: '';
56
56
  display: block;
57
57
  border: 1px solid ${tableBackgroundBorderColor};
58
- border-radius: ${"var(--ds-border-radius, 3px)"};
58
+ border-radius: ${"var(--ds-radius-small, 3px)"};
59
59
  width: 14px;
60
60
  height: 14px;
61
61
  }
@@ -14,7 +14,7 @@ export const cellColourPreviewStyles = selectedColor => css({
14
14
  // eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression -- needs manual remediation
15
15
  export const dragMenuBackgroundColorStyles = () => css`
16
16
  .${ClassName.DRAG_SUBMENU} {
17
- border-radius: ${"var(--ds-border-radius, 3px)"};
17
+ border-radius: ${"var(--ds-radius-small, 3px)"};
18
18
  background: ${"var(--ds-surface-overlay, white)"};
19
19
  box-shadow: ${`var(--ds-shadow-overlay, ${`0 4px 8px -2px ${N60A}, 0 0 1px ${N60A}`})`};
20
20
  display: block;
@@ -35,7 +35,7 @@ export const dragMenuBackgroundColorStyles = () => css`
35
35
  content: '';
36
36
  display: block;
37
37
  border: 1px solid ${tableBackgroundBorderColor};
38
- border-radius: ${"var(--ds-border-radius, 3px)"};
38
+ border-radius: ${"var(--ds-radius-small, 3px)"};
39
39
  width: 14px;
40
40
  height: 14px;
41
41
  }
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @atlaskit/design-system/prefer-primitives */
2
2
 
3
3
  import React, { useCallback, useMemo, useRef } from 'react';
4
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
6
6
  import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
7
7
  import { CellSelection } from '@atlaskit/editor-tables';
@@ -23,26 +23,6 @@ const getSelectedColumns = selection => {
23
23
  }
24
24
  return [];
25
25
  };
26
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
27
- const {
28
- selection
29
- } = useSharedPluginStateWithSelector(api, ['selection'], states => {
30
- var _states$selectionStat;
31
- return {
32
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
33
- };
34
- });
35
- return {
36
- selection
37
- };
38
- }, api => {
39
- const {
40
- selectionState
41
- } = useSharedPluginState(api, ['selection']);
42
- return {
43
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
44
- };
45
- });
46
26
  export const ColumnControls = ({
47
27
  editorView,
48
28
  tableActive,
@@ -64,7 +44,12 @@ export const ColumnControls = ({
64
44
  const columnControlsRef = useRef(null);
65
45
  const {
66
46
  selection
67
- } = useSharedState(api);
47
+ } = useSharedPluginStateWithSelector(api, ['selection'], states => {
48
+ var _states$selectionStat;
49
+ return {
50
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
51
+ };
52
+ });
68
53
  const widths = (_colWidths$map$join = colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(width =>
69
54
  // when there is sticky header, a `margin-right: -1px` applied to `tr.sticky th` so it causes colWidths to be 1px wider
70
55
  // we need to reduce the width by 1px to avoid misalignment of column controls.
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import classnames from 'classnames';
3
3
  import { injectIntl } from 'react-intl-next';
4
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { tableMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { findTable, isTableSelected, selectTable } from '@atlaskit/editor-tables/utils';
7
7
  import { clearHoverSelection } from '../../../pm-plugins/commands';
@@ -58,26 +58,6 @@ const DragCornerControlsComponent = ({
58
58
  className: ClassName.DRAG_CORNER_BUTTON_INNER
59
59
  }));
60
60
  };
61
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
62
- const {
63
- selection
64
- } = useSharedPluginStateWithSelector(api, ['selection'], states => {
65
- var _states$selectionStat;
66
- return {
67
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
68
- };
69
- });
70
- return {
71
- selection
72
- };
73
- }, api => {
74
- const {
75
- selectionState
76
- } = useSharedPluginState(api, ['selection']);
77
- return {
78
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
79
- };
80
- });
81
61
  const DragCornerControlsComponentWithSelection = ({
82
62
  editorView,
83
63
  isInDanger,
@@ -89,7 +69,12 @@ const DragCornerControlsComponentWithSelection = ({
89
69
  }) => {
90
70
  const {
91
71
  selection
92
- } = useSharedState(api);
72
+ } = useSharedPluginStateWithSelector(api, ['selection'], states => {
73
+ var _states$selectionStat;
74
+ return {
75
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
76
+ };
77
+ });
93
78
  const handleOnClick = () => {
94
79
  const {
95
80
  state,
@@ -1,27 +1,7 @@
1
1
  import React from 'react';
2
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
2
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
3
3
  import { CornerControls } from './CornerControls/ClassicCornerControls';
4
4
  import { RowControls } from './RowControls/ClassicControls';
5
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
6
- const {
7
- selection
8
- } = useSharedPluginStateWithSelector(api, ['selection'], states => {
9
- var _states$selectionStat;
10
- return {
11
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
12
- };
13
- });
14
- return {
15
- selection
16
- };
17
- }, api => {
18
- const {
19
- selectionState
20
- } = useSharedPluginState(api, ['selection']);
21
- return {
22
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
23
- };
24
- });
25
5
  export const FloatingControlsWithSelection = ({
26
6
  editorView,
27
7
  tableRef,
@@ -38,7 +18,12 @@ export const FloatingControlsWithSelection = ({
38
18
  }) => {
39
19
  const {
40
20
  selection
41
- } = useSharedState(api);
21
+ } = useSharedPluginStateWithSelector(api, ['selection'], states => {
22
+ var _states$selectionStat;
23
+ return {
24
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
25
+ };
26
+ });
42
27
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CornerControls, {
43
28
  editorView: editorView,
44
29
  tableRef: tableRef,
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @atlaskit/design-system/prefer-primitives */
2
2
 
3
3
  import React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react';
4
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
4
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
5
5
  import { CellSelection } from '@atlaskit/editor-tables';
6
6
  import { getSelectionRect } from '@atlaskit/editor-tables/utils';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
@@ -275,26 +275,6 @@ export const DragControls = ({
275
275
  }))), rowHandles())
276
276
  );
277
277
  };
278
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
279
- const {
280
- selection
281
- } = useSharedPluginStateWithSelector(api, ['selection'], states => {
282
- var _states$selectionStat;
283
- return {
284
- selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
285
- };
286
- });
287
- return {
288
- selection
289
- };
290
- }, api => {
291
- const {
292
- selectionState
293
- } = useSharedPluginState(api, ['selection']);
294
- return {
295
- selection: selectionState === null || selectionState === void 0 ? void 0 : selectionState.selection
296
- };
297
- });
298
278
  export const DragControlsWithSelection = ({
299
279
  editorView,
300
280
  tableRef,
@@ -313,7 +293,12 @@ export const DragControlsWithSelection = ({
313
293
  }) => {
314
294
  const {
315
295
  selection
316
- } = useSharedState(api);
296
+ } = useSharedPluginStateWithSelector(api, ['selection'], states => {
297
+ var _states$selectionStat;
298
+ return {
299
+ selection: (_states$selectionStat = states.selectionState) === null || _states$selectionStat === void 0 ? void 0 : _states$selectionStat.selection
300
+ };
301
+ });
317
302
  return /*#__PURE__*/React.createElement(DragControls, {
318
303
  editorView: editorView,
319
304
  tableRef: tableRef,
@@ -7,7 +7,7 @@ const tableFullWidthLabelWrapperStyles = xcss({
7
7
  height: "var(--ds-space-400, 32px)",
8
8
  display: 'flex',
9
9
  backgroundColor: 'elevation.surface.overlay',
10
- borderRadius: 'border.radius',
10
+ borderRadius: 'radius.small',
11
11
  boxShadow: 'elevation.shadow.overlay',
12
12
  // eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
13
13
  lineHeight: 1,
@@ -4,9 +4,13 @@
4
4
  */
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { Global, jsx } from '@emotion/react';
7
- import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
7
+ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
8
8
  import { tableStyles } from './common-styles';
9
- const useSharedState = sharedPluginStateHookMigratorFactory(api => {
9
+ export const GlobalStylesWrapper = ({
10
+ featureFlags,
11
+ isDragAndDropEnabledOption,
12
+ api
13
+ }) => {
10
14
  const {
11
15
  mode
12
16
  } = useSharedPluginStateWithSelector(api, ['editorViewMode'], states => {
@@ -15,25 +19,6 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
15
19
  mode: (_states$editorViewMod = states.editorViewModeState) === null || _states$editorViewMod === void 0 ? void 0 : _states$editorViewMod.mode
16
20
  };
17
21
  });
18
- return {
19
- mode
20
- };
21
- }, api => {
22
- const {
23
- editorViewModeState
24
- } = useSharedPluginState(api, ['editorViewMode']);
25
- return {
26
- mode: editorViewModeState === null || editorViewModeState === void 0 ? void 0 : editorViewModeState.mode
27
- };
28
- });
29
- export const GlobalStylesWrapper = ({
30
- featureFlags,
31
- isDragAndDropEnabledOption,
32
- api
33
- }) => {
34
- const {
35
- mode
36
- } = useSharedState(api);
37
22
  const isLivePageViewMode = mode === 'view';
38
23
  return jsx(Global, {
39
24
  styles: tableStyles({