@atlaskit/editor-plugin-table 12.2.6 → 12.2.7
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 +8 -0
- package/package.json +4 -4
- package/afm-cc/tsconfig.json +0 -123
- package/afm-dev-agents/tsconfig.json +0 -123
- package/afm-jira/tsconfig.json +0 -123
- package/afm-passionfruit/tsconfig.json +0 -123
- package/afm-post-office/tsconfig.json +0 -123
- package/afm-rovo-extension/tsconfig.json +0 -123
- package/afm-townsquare/tsconfig.json +0 -123
- package/afm-volt/tsconfig.json +0 -114
- package/build/tsconfig.json +0 -23
- package/docs/0-intro.tsx +0 -57
- package/src/index.ts +0 -21
- package/src/nodeviews/ExternalDropTargets.tsx +0 -91
- package/src/nodeviews/OverflowShadowsObserver.ts +0 -156
- package/src/nodeviews/TableCell.ts +0 -134
- package/src/nodeviews/TableComponent.tsx +0 -1590
- package/src/nodeviews/TableComponentWithSharedState.tsx +0 -278
- package/src/nodeviews/TableContainer.tsx +0 -926
- package/src/nodeviews/TableNodeViewBase.ts +0 -29
- package/src/nodeviews/TableResizer.tsx +0 -884
- package/src/nodeviews/TableRow.ts +0 -830
- package/src/nodeviews/TableStickyScrollbar.ts +0 -211
- package/src/nodeviews/__mocks__/OverflowShadowsObserver.ts +0 -15
- package/src/nodeviews/__mocks__/OverridableMock.ts +0 -26
- package/src/nodeviews/table-container-styles.ts +0 -9
- package/src/nodeviews/table-node-views.ts +0 -76
- package/src/nodeviews/table.tsx +0 -530
- package/src/nodeviews/toDOM.ts +0 -244
- package/src/nodeviews/types.ts +0 -36
- package/src/nodeviews/update-overflow-shadows.ts +0 -11
- package/src/pm-plugins/analytics/actions.ts +0 -21
- package/src/pm-plugins/analytics/commands.ts +0 -47
- package/src/pm-plugins/analytics/plugin-factory.ts +0 -9
- package/src/pm-plugins/analytics/plugin-key.ts +0 -5
- package/src/pm-plugins/analytics/plugin.ts +0 -80
- package/src/pm-plugins/analytics/reducer.ts +0 -27
- package/src/pm-plugins/analytics/types.ts +0 -20
- package/src/pm-plugins/analytics/utils/moved-event.ts +0 -51
- package/src/pm-plugins/commands/clear.ts +0 -43
- package/src/pm-plugins/commands/collapse.ts +0 -17
- package/src/pm-plugins/commands/column-resize.ts +0 -478
- package/src/pm-plugins/commands/commands-with-analytics.ts +0 -715
- package/src/pm-plugins/commands/delete.ts +0 -42
- package/src/pm-plugins/commands/display-mode.ts +0 -18
- package/src/pm-plugins/commands/go-to-next-cell.ts +0 -198
- package/src/pm-plugins/commands/hover.ts +0 -242
- package/src/pm-plugins/commands/index.ts +0 -51
- package/src/pm-plugins/commands/insert.ts +0 -438
- package/src/pm-plugins/commands/misc.ts +0 -811
- package/src/pm-plugins/commands/referentiality.ts +0 -15
- package/src/pm-plugins/commands/selection.ts +0 -537
- package/src/pm-plugins/commands/sort.ts +0 -102
- package/src/pm-plugins/commands/split-cell.ts +0 -28
- package/src/pm-plugins/commands/toggle.ts +0 -109
- package/src/pm-plugins/create-plugin-config.ts +0 -17
- package/src/pm-plugins/decorations/plugin.ts +0 -107
- package/src/pm-plugins/decorations/utils/column-controls.ts +0 -91
- package/src/pm-plugins/decorations/utils/column-resizing.ts +0 -71
- package/src/pm-plugins/decorations/utils/compose-decorations.ts +0 -9
- package/src/pm-plugins/decorations/utils/types.ts +0 -16
- package/src/pm-plugins/default-table-selection.ts +0 -14
- package/src/pm-plugins/drag-and-drop/actions.ts +0 -48
- package/src/pm-plugins/drag-and-drop/commands-with-analytics.ts +0 -222
- package/src/pm-plugins/drag-and-drop/commands.ts +0 -194
- package/src/pm-plugins/drag-and-drop/consts.ts +0 -7
- package/src/pm-plugins/drag-and-drop/plugin-factory.ts +0 -33
- package/src/pm-plugins/drag-and-drop/plugin-key.ts +0 -5
- package/src/pm-plugins/drag-and-drop/plugin.ts +0 -398
- package/src/pm-plugins/drag-and-drop/reducer.ts +0 -38
- package/src/pm-plugins/drag-and-drop/types.ts +0 -18
- package/src/pm-plugins/drag-and-drop/utils/autoscrollers.ts +0 -49
- package/src/pm-plugins/drag-and-drop/utils/getDragBehaviour.ts +0 -9
- package/src/pm-plugins/drag-and-drop/utils/monitor.ts +0 -73
- package/src/pm-plugins/handlers.ts +0 -161
- package/src/pm-plugins/keymap.ts +0 -436
- package/src/pm-plugins/main.ts +0 -433
- package/src/pm-plugins/plugin-factory.ts +0 -42
- package/src/pm-plugins/plugin-key.ts +0 -8
- package/src/pm-plugins/reducer.ts +0 -145
- package/src/pm-plugins/safari-delete-composition-text-issue-workaround.ts +0 -102
- package/src/pm-plugins/sticky-headers/commands.ts +0 -8
- package/src/pm-plugins/sticky-headers/plugin-key.ts +0 -5
- package/src/pm-plugins/sticky-headers/plugin-state.ts +0 -52
- package/src/pm-plugins/sticky-headers/plugin.ts +0 -12
- package/src/pm-plugins/sticky-headers/types.ts +0 -20
- package/src/pm-plugins/sticky-headers/util.ts +0 -18
- package/src/pm-plugins/table-analytics.ts +0 -100
- package/src/pm-plugins/table-local-id.ts +0 -213
- package/src/pm-plugins/table-resizing/commands.ts +0 -116
- package/src/pm-plugins/table-resizing/event-handlers.ts +0 -352
- package/src/pm-plugins/table-resizing/plugin-factory.ts +0 -29
- package/src/pm-plugins/table-resizing/plugin-key.ts +0 -5
- package/src/pm-plugins/table-resizing/plugin.ts +0 -94
- package/src/pm-plugins/table-resizing/reducer.ts +0 -37
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +0 -306
- package/src/pm-plugins/table-resizing/utils/column-state.ts +0 -120
- package/src/pm-plugins/table-resizing/utils/consts.ts +0 -11
- package/src/pm-plugins/table-resizing/utils/content-width.ts +0 -118
- package/src/pm-plugins/table-resizing/utils/dom.ts +0 -132
- package/src/pm-plugins/table-resizing/utils/misc.ts +0 -282
- package/src/pm-plugins/table-resizing/utils/resize-column.ts +0 -34
- package/src/pm-plugins/table-resizing/utils/resize-logic.ts +0 -289
- package/src/pm-plugins/table-resizing/utils/resize-state.ts +0 -417
- package/src/pm-plugins/table-resizing/utils/scale-table.ts +0 -290
- package/src/pm-plugins/table-resizing/utils/types.ts +0 -25
- package/src/pm-plugins/table-resizing/utils/unit-to-number.ts +0 -1
- package/src/pm-plugins/table-selection-keymap.ts +0 -64
- package/src/pm-plugins/table-size-selector.ts +0 -39
- package/src/pm-plugins/table-width-in-comment-fix.ts +0 -113
- package/src/pm-plugins/table-width.ts +0 -153
- package/src/pm-plugins/transforms/column-width.ts +0 -249
- package/src/pm-plugins/transforms/delete-columns.ts +0 -281
- package/src/pm-plugins/transforms/delete-rows.ts +0 -154
- package/src/pm-plugins/transforms/fix-tables.ts +0 -249
- package/src/pm-plugins/transforms/merge.ts +0 -301
- package/src/pm-plugins/transforms/replace-table.ts +0 -38
- package/src/pm-plugins/transforms/split.ts +0 -90
- package/src/pm-plugins/utils/alignment.ts +0 -33
- package/src/pm-plugins/utils/analytics.ts +0 -238
- package/src/pm-plugins/utils/collapse.ts +0 -93
- package/src/pm-plugins/utils/column-controls.ts +0 -250
- package/src/pm-plugins/utils/create.ts +0 -64
- package/src/pm-plugins/utils/decoration.ts +0 -672
- package/src/pm-plugins/utils/dom.ts +0 -251
- package/src/pm-plugins/utils/drag-menu.tsx +0 -491
- package/src/pm-plugins/utils/get-allow-add-column-custom-step.ts +0 -10
- package/src/pm-plugins/utils/guidelines.ts +0 -30
- package/src/pm-plugins/utils/merged-cells.ts +0 -239
- package/src/pm-plugins/utils/nodes.ts +0 -162
- package/src/pm-plugins/utils/paste.ts +0 -386
- package/src/pm-plugins/utils/row-controls.ts +0 -211
- package/src/pm-plugins/utils/selection.ts +0 -17
- package/src/pm-plugins/utils/snapping.ts +0 -136
- package/src/pm-plugins/utils/table.ts +0 -60
- package/src/pm-plugins/utils/update-plugin-state-decorations.ts +0 -13
- package/src/pm-plugins/view-mode-sort/consts.ts +0 -3
- package/src/pm-plugins/view-mode-sort/index.ts +0 -291
- package/src/pm-plugins/view-mode-sort/plugin-key.ts +0 -7
- package/src/pm-plugins/view-mode-sort/types.ts +0 -23
- package/src/pm-plugins/view-mode-sort/utils.ts +0 -136
- package/src/tablePlugin.tsx +0 -971
- package/src/tablePluginType.ts +0 -102
- package/src/types/index.ts +0 -592
- package/src/ui/ColumnResizeWidget/index.tsx +0 -61
- package/src/ui/ContentComponent.tsx +0 -311
- package/src/ui/DragHandle/HandleIconComponent.tsx +0 -21
- package/src/ui/DragHandle/index.tsx +0 -391
- package/src/ui/DragPreview/index.tsx +0 -51
- package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +0 -59
- package/src/ui/FloatingContextualButton/FixedButton.tsx +0 -203
- package/src/ui/FloatingContextualButton/index.tsx +0 -168
- package/src/ui/FloatingContextualButton/styles.ts +0 -69
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +0 -931
- package/src/ui/FloatingContextualMenu/index.tsx +0 -141
- package/src/ui/FloatingContextualMenu/styles.ts +0 -77
- package/src/ui/FloatingDeleteButton/DeleteButton.tsx +0 -54
- package/src/ui/FloatingDeleteButton/getPopUpOptions.ts +0 -65
- package/src/ui/FloatingDeleteButton/index.tsx +0 -383
- package/src/ui/FloatingDeleteButton/types.ts +0 -3
- package/src/ui/FloatingDragMenu/DragMenu.tsx +0 -668
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +0 -221
- package/src/ui/FloatingDragMenu/index.tsx +0 -136
- package/src/ui/FloatingDragMenu/styles.ts +0 -83
- package/src/ui/FloatingInsertButton/InsertButton.tsx +0 -263
- package/src/ui/FloatingInsertButton/getPopupOptions.ts +0 -131
- package/src/ui/FloatingInsertButton/index.tsx +0 -314
- package/src/ui/FloatingToolbarLabel/FloatingToolbarLabel.tsx +0 -31
- package/src/ui/SizeSelector/index.tsx +0 -74
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +0 -397
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +0 -105
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/index.tsx +0 -63
- package/src/ui/TableFloatingColumnControls/index.tsx +0 -151
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +0 -106
- package/src/ui/TableFloatingControls/CornerControls/DragCornerControls.tsx +0 -143
- package/src/ui/TableFloatingControls/CornerControls/types.ts +0 -12
- package/src/ui/TableFloatingControls/FloatingControlsWithSelection.tsx +0 -88
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +0 -175
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +0 -131
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +0 -429
- package/src/ui/TableFloatingControls/RowDropTarget/index.tsx +0 -96
- package/src/ui/TableFloatingControls/index.tsx +0 -275
- package/src/ui/TableFullWidthLabel/index.tsx +0 -38
- package/src/ui/common-styles.ts +0 -1218
- package/src/ui/consts.ts +0 -109
- package/src/ui/event-handlers.ts +0 -662
- package/src/ui/global-styles.tsx +0 -55
- package/src/ui/hooks/useInternalTablePluginStateSelector.ts +0 -38
- package/src/ui/icons/AddColLeftIcon.tsx +0 -37
- package/src/ui/icons/AddColRightIcon.tsx +0 -37
- package/src/ui/icons/AddRowAboveIcon.tsx +0 -22
- package/src/ui/icons/AddRowBelowIcon.tsx +0 -39
- package/src/ui/icons/DragHandleDisabledIcon.tsx +0 -25
- package/src/ui/icons/DragHandleIcon.tsx +0 -16
- package/src/ui/icons/DragInMotionIcon.tsx +0 -54
- package/src/ui/icons/MergeCellsIcon.tsx +0 -26
- package/src/ui/icons/MinimisedHandle.tsx +0 -15
- package/src/ui/icons/SortingIconWrapper.tsx +0 -43
- package/src/ui/icons/SplitCellIcon.tsx +0 -34
- package/src/ui/toolbar.tsx +0 -1153
- package/src/ui/ui-styles.ts +0 -960
- package/tsconfig.app.json +0 -135
- package/tsconfig.dev.json +0 -54
- package/tsconfig.json +0 -18
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jsxRuntime classic
|
|
3
|
-
* @jsx jsx
|
|
4
|
-
*/
|
|
5
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
-
import { jsx } from '@emotion/react';
|
|
7
|
-
import { useIntl } from 'react-intl-next';
|
|
8
|
-
|
|
9
|
-
import { startColumnResizing, ToolTipContent } from '@atlaskit/editor-common/keymaps';
|
|
10
|
-
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
|
-
import Tooltip from '@atlaskit/tooltip';
|
|
12
|
-
|
|
13
|
-
import { TableCssClassName } from '../../types';
|
|
14
|
-
|
|
15
|
-
type Props = {
|
|
16
|
-
startIndex: number;
|
|
17
|
-
endIndex: number;
|
|
18
|
-
includeTooltip?: boolean;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const ColumnResizeWidget = ({ startIndex, endIndex, includeTooltip }: Props) => {
|
|
22
|
-
const { formatMessage } = useIntl();
|
|
23
|
-
|
|
24
|
-
if (!includeTooltip) {
|
|
25
|
-
return (
|
|
26
|
-
<div
|
|
27
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
28
|
-
className={TableCssClassName.RESIZE_HANDLE_DECORATION}
|
|
29
|
-
data-start-index={startIndex}
|
|
30
|
-
data-end-index={endIndex}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<Tooltip
|
|
37
|
-
content={
|
|
38
|
-
<ToolTipContent
|
|
39
|
-
description={formatMessage(messages.adjustColumns)}
|
|
40
|
-
keymap={startColumnResizing}
|
|
41
|
-
/>
|
|
42
|
-
}
|
|
43
|
-
hideTooltipOnClick
|
|
44
|
-
hideTooltipOnMouseDown
|
|
45
|
-
position="mouse"
|
|
46
|
-
mousePosition="auto-start"
|
|
47
|
-
>
|
|
48
|
-
{(tooltipProps) => (
|
|
49
|
-
<div
|
|
50
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
51
|
-
className={TableCssClassName.RESIZE_HANDLE_DECORATION}
|
|
52
|
-
data-start-index={startIndex}
|
|
53
|
-
data-end-index={endIndex}
|
|
54
|
-
// Ignored via go/ees005
|
|
55
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
56
|
-
{...tooltipProps}
|
|
57
|
-
/>
|
|
58
|
-
)}
|
|
59
|
-
</Tooltip>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ACTION_SUBJECT,
|
|
5
|
-
ACTION_SUBJECT_ID,
|
|
6
|
-
type DispatchAnalyticsEvent,
|
|
7
|
-
} from '@atlaskit/editor-common/analytics';
|
|
8
|
-
import { ErrorBoundary } from '@atlaskit/editor-common/error-boundary';
|
|
9
|
-
import { getDomRefFromSelection } from '@atlaskit/editor-common/get-dom-ref-from-selection';
|
|
10
|
-
import {
|
|
11
|
-
type NamedPluginStatesFromInjectionAPI,
|
|
12
|
-
useSharedPluginStateWithSelector,
|
|
13
|
-
} from '@atlaskit/editor-common/hooks';
|
|
14
|
-
import { ResizerBreakoutModeLabel } from '@atlaskit/editor-common/resizer';
|
|
15
|
-
import {
|
|
16
|
-
type ExtractInjectionAPI,
|
|
17
|
-
type GetEditorContainerWidth,
|
|
18
|
-
type GetEditorFeatureFlags,
|
|
19
|
-
} from '@atlaskit/editor-common/types';
|
|
20
|
-
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
21
|
-
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
22
|
-
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
23
|
-
|
|
24
|
-
import type tablePlugin from '../tablePlugin';
|
|
25
|
-
import { type TablePlugin, type TablePluginOptions } from '../tablePluginType';
|
|
26
|
-
import { type TableSharedStateInternal } from '../types';
|
|
27
|
-
|
|
28
|
-
import FloatingContextualButton from './FloatingContextualButton';
|
|
29
|
-
import FloatingContextualMenu from './FloatingContextualMenu';
|
|
30
|
-
import FloatingDeleteButton from './FloatingDeleteButton';
|
|
31
|
-
import FloatingDragMenu from './FloatingDragMenu';
|
|
32
|
-
// Ignored via go/ees005
|
|
33
|
-
// eslint-disable-next-line import/no-named-as-default
|
|
34
|
-
import FloatingInsertButton from './FloatingInsertButton';
|
|
35
|
-
import { FloatingToolbarLabel } from './FloatingToolbarLabel/FloatingToolbarLabel';
|
|
36
|
-
import { GlobalStylesWrapper } from './global-styles';
|
|
37
|
-
import { SizeSelector } from './SizeSelector';
|
|
38
|
-
import { FullWidthDisplay } from './TableFullWidthLabel';
|
|
39
|
-
|
|
40
|
-
export type ContentComponentProps = {
|
|
41
|
-
api: ExtractInjectionAPI<TablePlugin> | undefined;
|
|
42
|
-
editorView: EditorView;
|
|
43
|
-
dispatchAnalyticsEvent: DispatchAnalyticsEvent | undefined;
|
|
44
|
-
options?: TablePluginOptions;
|
|
45
|
-
popupsMountPoint?: HTMLElement;
|
|
46
|
-
popupsBoundariesElement?: HTMLElement;
|
|
47
|
-
popupsScrollableElement?: HTMLElement;
|
|
48
|
-
isTableSelectorEnabled: boolean | undefined;
|
|
49
|
-
defaultGetEditorContainerWidth: GetEditorContainerWidth;
|
|
50
|
-
defaultGetEditorFeatureFlags: GetEditorFeatureFlags;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const selector = (
|
|
54
|
-
states: NamedPluginStatesFromInjectionAPI<ExtractInjectionAPI<typeof tablePlugin>, ''> & {
|
|
55
|
-
tableState: TableSharedStateInternal | undefined;
|
|
56
|
-
},
|
|
57
|
-
) => ({
|
|
58
|
-
resizingTableLocalId: states.tableState?.resizingTableLocalId,
|
|
59
|
-
resizingTableRef: states.tableState?.resizingTableRef,
|
|
60
|
-
isTableResizing: states.tableState?.isTableResizing,
|
|
61
|
-
isResizing: states.tableState?.isResizing,
|
|
62
|
-
widthToWidest: states.tableState?.widthToWidest,
|
|
63
|
-
tableNode: states.tableState?.tableNode,
|
|
64
|
-
targetCellPosition: states.tableState?.targetCellPosition,
|
|
65
|
-
isContextualMenuOpen: states.tableState?.isContextualMenuOpen,
|
|
66
|
-
tableRef: states.tableState?.tableRef,
|
|
67
|
-
pluginConfig: states.tableState?.pluginConfig,
|
|
68
|
-
insertColumnButtonIndex: states.tableState?.insertColumnButtonIndex,
|
|
69
|
-
insertRowButtonIndex: states.tableState?.insertRowButtonIndex,
|
|
70
|
-
isHeaderColumnEnabled: states.tableState?.isHeaderColumnEnabled,
|
|
71
|
-
isHeaderRowEnabled: states.tableState?.isHeaderRowEnabled,
|
|
72
|
-
isDragAndDropEnabled: states.tableState?.isDragAndDropEnabled,
|
|
73
|
-
tableWrapperTarget: states.tableState?.tableWrapperTarget,
|
|
74
|
-
isCellMenuOpenByKeyboard: states.tableState?.isCellMenuOpenByKeyboard,
|
|
75
|
-
stickyHeader: states.tableState?.stickyHeader,
|
|
76
|
-
dragMenuDirection: states.tableState?.dragMenuDirection,
|
|
77
|
-
dragMenuIndex: states.tableState?.dragMenuIndex,
|
|
78
|
-
isDragMenuOpen: states.tableState?.isDragMenuOpen,
|
|
79
|
-
isSizeSelectorOpen: states.tableState?.isSizeSelectorOpen,
|
|
80
|
-
sizeSelectorTargetRef: states.tableState?.sizeSelectorTargetRef,
|
|
81
|
-
|
|
82
|
-
// IMPORTANT: hovered states are used by FloatingDragMenu component to render popup in the correct location
|
|
83
|
-
hoveredRows: states.tableState?.hoveredRows,
|
|
84
|
-
hoveredColumns: states.tableState?.hoveredColumns,
|
|
85
|
-
hoveredCell: states.tableState?.hoveredCell,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
const ContentComponentInternal = ({
|
|
89
|
-
api,
|
|
90
|
-
editorView,
|
|
91
|
-
dispatchAnalyticsEvent,
|
|
92
|
-
options,
|
|
93
|
-
popupsMountPoint,
|
|
94
|
-
popupsBoundariesElement,
|
|
95
|
-
popupsScrollableElement,
|
|
96
|
-
isTableSelectorEnabled,
|
|
97
|
-
defaultGetEditorContainerWidth,
|
|
98
|
-
defaultGetEditorFeatureFlags,
|
|
99
|
-
}: ContentComponentProps) => {
|
|
100
|
-
const editorAnalyticsAPI = api?.analytics?.actions;
|
|
101
|
-
const ariaNotifyPlugin = api?.accessibilityUtils?.actions.ariaNotify;
|
|
102
|
-
|
|
103
|
-
const {
|
|
104
|
-
resizingTableLocalId,
|
|
105
|
-
resizingTableRef,
|
|
106
|
-
isTableResizing,
|
|
107
|
-
isResizing,
|
|
108
|
-
widthToWidest,
|
|
109
|
-
tableNode,
|
|
110
|
-
targetCellPosition,
|
|
111
|
-
isContextualMenuOpen,
|
|
112
|
-
tableRef,
|
|
113
|
-
pluginConfig,
|
|
114
|
-
insertColumnButtonIndex,
|
|
115
|
-
insertRowButtonIndex,
|
|
116
|
-
isHeaderColumnEnabled,
|
|
117
|
-
isHeaderRowEnabled,
|
|
118
|
-
isDragAndDropEnabled,
|
|
119
|
-
tableWrapperTarget,
|
|
120
|
-
isCellMenuOpenByKeyboard,
|
|
121
|
-
stickyHeader,
|
|
122
|
-
dragMenuDirection,
|
|
123
|
-
dragMenuIndex,
|
|
124
|
-
isDragMenuOpen,
|
|
125
|
-
isSizeSelectorOpen,
|
|
126
|
-
sizeSelectorTargetRef,
|
|
127
|
-
} = useSharedPluginStateWithSelector(api, ['table'], selector);
|
|
128
|
-
|
|
129
|
-
const { allowControls } = pluginConfig ?? {};
|
|
130
|
-
|
|
131
|
-
return (
|
|
132
|
-
<>
|
|
133
|
-
{targetCellPosition &&
|
|
134
|
-
(tableRef || isCellMenuOpenByKeyboard) &&
|
|
135
|
-
!isResizing &&
|
|
136
|
-
options &&
|
|
137
|
-
options.allowContextualMenu && (
|
|
138
|
-
<FloatingContextualButton
|
|
139
|
-
isNumberColumnEnabled={tableNode && tableNode.attrs.isNumberColumnEnabled}
|
|
140
|
-
editorView={editorView}
|
|
141
|
-
tableNode={tableNode}
|
|
142
|
-
mountPoint={popupsMountPoint}
|
|
143
|
-
targetCellPosition={targetCellPosition}
|
|
144
|
-
scrollableElement={popupsScrollableElement}
|
|
145
|
-
dispatchAnalyticsEvent={dispatchAnalyticsEvent}
|
|
146
|
-
isContextualMenuOpen={isContextualMenuOpen}
|
|
147
|
-
stickyHeader={stickyHeader}
|
|
148
|
-
tableWrapper={tableWrapperTarget}
|
|
149
|
-
isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
|
|
150
|
-
/>
|
|
151
|
-
)}
|
|
152
|
-
{allowControls && (
|
|
153
|
-
<FloatingInsertButton
|
|
154
|
-
tableNode={tableNode}
|
|
155
|
-
tableRef={tableRef}
|
|
156
|
-
insertColumnButtonIndex={insertColumnButtonIndex}
|
|
157
|
-
insertRowButtonIndex={insertRowButtonIndex}
|
|
158
|
-
isHeaderColumnEnabled={isHeaderColumnEnabled}
|
|
159
|
-
isHeaderRowEnabled={isHeaderRowEnabled}
|
|
160
|
-
isDragAndDropEnabled={isDragAndDropEnabled}
|
|
161
|
-
isTableScalingEnabled={options?.isTableScalingEnabled}
|
|
162
|
-
editorView={editorView}
|
|
163
|
-
mountPoint={popupsMountPoint}
|
|
164
|
-
boundariesElement={popupsBoundariesElement}
|
|
165
|
-
scrollableElement={popupsScrollableElement}
|
|
166
|
-
hasStickyHeaders={stickyHeader && stickyHeader.sticky}
|
|
167
|
-
dispatchAnalyticsEvent={dispatchAnalyticsEvent}
|
|
168
|
-
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
169
|
-
getEditorContainerWidth={defaultGetEditorContainerWidth}
|
|
170
|
-
getEditorFeatureFlags={options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags}
|
|
171
|
-
isChromelessEditor={options?.isChromelessEditor}
|
|
172
|
-
api={api}
|
|
173
|
-
isCommentEditor={options?.isCommentEditor}
|
|
174
|
-
/>
|
|
175
|
-
)}
|
|
176
|
-
{options?.allowContextualMenu && (
|
|
177
|
-
<FloatingContextualMenu
|
|
178
|
-
editorView={editorView}
|
|
179
|
-
mountPoint={popupsMountPoint}
|
|
180
|
-
boundariesElement={popupsBoundariesElement}
|
|
181
|
-
targetCellPosition={targetCellPosition}
|
|
182
|
-
isOpen={Boolean(isContextualMenuOpen) && !isResizing}
|
|
183
|
-
pluginConfig={pluginConfig}
|
|
184
|
-
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
185
|
-
getEditorContainerWidth={defaultGetEditorContainerWidth}
|
|
186
|
-
getEditorFeatureFlags={options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags}
|
|
187
|
-
isCellMenuOpenByKeyboard={isCellMenuOpenByKeyboard}
|
|
188
|
-
isCommentEditor={options?.isCommentEditor}
|
|
189
|
-
api={api}
|
|
190
|
-
/>
|
|
191
|
-
)}
|
|
192
|
-
{isDragAndDropEnabled && (
|
|
193
|
-
<FloatingDragMenu
|
|
194
|
-
editorView={editorView}
|
|
195
|
-
mountPoint={popupsMountPoint}
|
|
196
|
-
boundariesElement={popupsBoundariesElement}
|
|
197
|
-
tableRef={tableRef as HTMLTableElement}
|
|
198
|
-
tableNode={tableNode}
|
|
199
|
-
targetCellPosition={targetCellPosition}
|
|
200
|
-
direction={dragMenuDirection}
|
|
201
|
-
index={dragMenuIndex}
|
|
202
|
-
isOpen={!!isDragMenuOpen && !isResizing}
|
|
203
|
-
getEditorContainerWidth={defaultGetEditorContainerWidth}
|
|
204
|
-
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
205
|
-
stickyHeaders={stickyHeader}
|
|
206
|
-
pluginConfig={pluginConfig}
|
|
207
|
-
isTableScalingEnabled={options?.isTableScalingEnabled}
|
|
208
|
-
getEditorFeatureFlags={options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags}
|
|
209
|
-
ariaNotifyPlugin={ariaNotifyPlugin}
|
|
210
|
-
api={api}
|
|
211
|
-
isCommentEditor={options?.isCommentEditor}
|
|
212
|
-
/>
|
|
213
|
-
)}
|
|
214
|
-
{allowControls && !isDragAndDropEnabled && !isResizing && (
|
|
215
|
-
<FloatingDeleteButton
|
|
216
|
-
editorView={editorView}
|
|
217
|
-
selection={editorView.state.selection}
|
|
218
|
-
tableRef={tableRef as HTMLTableElement}
|
|
219
|
-
mountPoint={popupsMountPoint}
|
|
220
|
-
boundariesElement={popupsBoundariesElement}
|
|
221
|
-
scrollableElement={popupsScrollableElement}
|
|
222
|
-
stickyHeaders={stickyHeader}
|
|
223
|
-
isNumberColumnEnabled={tableNode && tableNode.attrs.isNumberColumnEnabled}
|
|
224
|
-
editorAnalyticsAPI={editorAnalyticsAPI}
|
|
225
|
-
api={api}
|
|
226
|
-
/>
|
|
227
|
-
)}
|
|
228
|
-
{(options?.isTableScalingEnabled ||
|
|
229
|
-
(options?.tableOptions.allowTableResizing && options.isCommentEditor)) &&
|
|
230
|
-
isTableResizing &&
|
|
231
|
-
widthToWidest &&
|
|
232
|
-
resizingTableLocalId &&
|
|
233
|
-
resizingTableRef &&
|
|
234
|
-
widthToWidest[resizingTableLocalId] && (
|
|
235
|
-
<FloatingToolbarLabel
|
|
236
|
-
target={resizingTableRef}
|
|
237
|
-
content={
|
|
238
|
-
editorExperiment('single_column_layouts', true) ? (
|
|
239
|
-
<ResizerBreakoutModeLabel layout="full-width" />
|
|
240
|
-
) : (
|
|
241
|
-
<FullWidthDisplay />
|
|
242
|
-
)
|
|
243
|
-
}
|
|
244
|
-
alignX={'center'}
|
|
245
|
-
alignY={'bottom'}
|
|
246
|
-
stick={true}
|
|
247
|
-
forcePlacement={true}
|
|
248
|
-
zIndex={akEditorFloatingPanelZIndex}
|
|
249
|
-
offset={[0, 10]}
|
|
250
|
-
/>
|
|
251
|
-
)}
|
|
252
|
-
|
|
253
|
-
{isTableSelectorEnabled && isSizeSelectorOpen && (
|
|
254
|
-
<SizeSelector
|
|
255
|
-
api={api}
|
|
256
|
-
isOpenedByKeyboard={false}
|
|
257
|
-
popupsMountPoint={popupsMountPoint}
|
|
258
|
-
target={
|
|
259
|
-
sizeSelectorTargetRef ??
|
|
260
|
-
getDomRefFromSelection(
|
|
261
|
-
editorView,
|
|
262
|
-
ACTION_SUBJECT_ID.PICKER_TABLE_SIZE,
|
|
263
|
-
api?.analytics?.actions,
|
|
264
|
-
)
|
|
265
|
-
}
|
|
266
|
-
popupsBoundariesElement={popupsBoundariesElement}
|
|
267
|
-
popupsScrollableElement={popupsScrollableElement}
|
|
268
|
-
/>
|
|
269
|
-
)}
|
|
270
|
-
</>
|
|
271
|
-
);
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
export const ContentComponent = ({
|
|
275
|
-
api,
|
|
276
|
-
editorView,
|
|
277
|
-
dispatchAnalyticsEvent,
|
|
278
|
-
options,
|
|
279
|
-
popupsMountPoint,
|
|
280
|
-
popupsBoundariesElement,
|
|
281
|
-
popupsScrollableElement,
|
|
282
|
-
isTableSelectorEnabled,
|
|
283
|
-
defaultGetEditorContainerWidth,
|
|
284
|
-
defaultGetEditorFeatureFlags,
|
|
285
|
-
}: ContentComponentProps) => {
|
|
286
|
-
return (
|
|
287
|
-
<ErrorBoundary
|
|
288
|
-
component={ACTION_SUBJECT.TABLES_PLUGIN}
|
|
289
|
-
dispatchAnalyticsEvent={dispatchAnalyticsEvent}
|
|
290
|
-
fallbackComponent={null}
|
|
291
|
-
>
|
|
292
|
-
<GlobalStylesWrapper
|
|
293
|
-
featureFlags={api?.featureFlags?.sharedState.currentState()}
|
|
294
|
-
isDragAndDropEnabledOption={options?.dragAndDropEnabled}
|
|
295
|
-
api={api}
|
|
296
|
-
/>
|
|
297
|
-
<ContentComponentInternal
|
|
298
|
-
api={api}
|
|
299
|
-
editorView={editorView}
|
|
300
|
-
dispatchAnalyticsEvent={dispatchAnalyticsEvent}
|
|
301
|
-
options={options}
|
|
302
|
-
popupsMountPoint={popupsMountPoint}
|
|
303
|
-
popupsBoundariesElement={popupsBoundariesElement}
|
|
304
|
-
popupsScrollableElement={popupsScrollableElement}
|
|
305
|
-
isTableSelectorEnabled={isTableSelectorEnabled}
|
|
306
|
-
defaultGetEditorContainerWidth={defaultGetEditorContainerWidth}
|
|
307
|
-
defaultGetEditorFeatureFlags={defaultGetEditorFeatureFlags}
|
|
308
|
-
/>
|
|
309
|
-
</ErrorBoundary>
|
|
310
|
-
);
|
|
311
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { DragHandleDisabledIcon } from '../icons/DragHandleDisabledIcon';
|
|
4
|
-
import { DragHandleIcon } from '../icons/DragHandleIcon';
|
|
5
|
-
import { MinimisedHandleIcon } from '../icons/MinimisedHandle';
|
|
6
|
-
|
|
7
|
-
type HandleIconProps = {
|
|
8
|
-
forceDefaultHandle: boolean;
|
|
9
|
-
isHandleHovered: boolean;
|
|
10
|
-
hasMergedCells: boolean;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const HandleIconComponent = (props: HandleIconProps) => {
|
|
14
|
-
const { forceDefaultHandle, isHandleHovered, hasMergedCells } = props;
|
|
15
|
-
|
|
16
|
-
if (isHandleHovered || forceDefaultHandle) {
|
|
17
|
-
return hasMergedCells ? <DragHandleDisabledIcon /> : <DragHandleIcon />;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return <MinimisedHandleIcon />;
|
|
21
|
-
};
|