@atlaskit/editor-plugin-table 7.6.3 → 7.6.5
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 +13 -0
- package/dist/cjs/commands/column-resize.js +62 -16
- package/dist/cjs/commands/go-to-next-cell.js +5 -2
- package/dist/cjs/commands/misc.js +3 -2
- package/dist/cjs/commands-with-analytics.js +8 -2
- package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/cjs/nodeviews/TableComponent.js +8 -6
- package/dist/cjs/nodeviews/TableContainer.js +32 -20
- package/dist/cjs/nodeviews/TableResizer.js +40 -28
- package/dist/cjs/plugin.js +60 -58
- package/dist/cjs/pm-plugins/keymap.js +26 -8
- package/dist/cjs/pm-plugins/main.js +15 -4
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/cjs/toolbar.js +5 -4
- package/dist/cjs/ui/DragHandle/index.js +2 -2
- package/dist/cjs/ui/DragPreview/index.js +2 -0
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +21 -28
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/cjs/ui/LayoutButton/index.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/cjs/ui/common-styles.js +4 -0
- package/dist/cjs/ui/ui-styles.js +93 -37
- package/dist/cjs/utils/guidelines.js +1 -1
- package/dist/es2019/commands/column-resize.js +53 -4
- package/dist/es2019/commands/go-to-next-cell.js +5 -2
- package/dist/es2019/commands/misc.js +6 -2
- package/dist/es2019/commands-with-analytics.js +8 -2
- package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/es2019/nodeviews/TableComponent.js +9 -7
- package/dist/es2019/nodeviews/TableContainer.js +17 -3
- package/dist/es2019/nodeviews/TableResizer.js +27 -17
- package/dist/es2019/plugin.js +6 -3
- package/dist/es2019/pm-plugins/keymap.js +25 -9
- package/dist/es2019/pm-plugins/main.js +15 -4
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/es2019/toolbar.js +5 -4
- package/dist/es2019/ui/DragHandle/index.js +2 -2
- package/dist/es2019/ui/DragPreview/index.js +2 -0
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +20 -27
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/es2019/ui/LayoutButton/index.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/es2019/ui/common-styles.js +4 -0
- package/dist/es2019/ui/ui-styles.js +66 -70
- package/dist/es2019/utils/guidelines.js +1 -1
- package/dist/esm/commands/column-resize.js +62 -16
- package/dist/esm/commands/go-to-next-cell.js +5 -2
- package/dist/esm/commands/misc.js +3 -2
- package/dist/esm/commands-with-analytics.js +8 -2
- package/dist/esm/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/esm/nodeviews/TableComponent.js +9 -7
- package/dist/esm/nodeviews/TableContainer.js +32 -20
- package/dist/esm/nodeviews/TableResizer.js +41 -29
- package/dist/esm/plugin.js +60 -58
- package/dist/esm/pm-plugins/keymap.js +26 -8
- package/dist/esm/pm-plugins/main.js +15 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/esm/toolbar.js +5 -4
- package/dist/esm/ui/DragHandle/index.js +2 -2
- package/dist/esm/ui/DragPreview/index.js +2 -0
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +21 -28
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/esm/ui/LayoutButton/index.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/esm/ui/common-styles.js +4 -0
- package/dist/esm/ui/ui-styles.js +93 -37
- package/dist/esm/utils/guidelines.js +1 -1
- package/dist/types/commands/column-resize.d.ts +23 -4
- package/dist/types/commands/go-to-next-cell.d.ts +2 -1
- package/dist/types/commands/misc.d.ts +2 -1
- package/dist/types/commands-with-analytics.d.ts +2 -1
- package/dist/types/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types/pm-plugins/keymap.d.ts +3 -1
- package/dist/types/types.d.ts +13 -3
- package/dist/types-ts4.5/commands/column-resize.d.ts +23 -4
- package/dist/types-ts4.5/commands/go-to-next-cell.d.ts +2 -1
- package/dist/types-ts4.5/commands/misc.d.ts +2 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -1
- package/dist/types-ts4.5/types.d.ts +13 -3
- package/package.json +3 -6
- package/src/commands/column-resize.ts +105 -29
- package/src/commands/go-to-next-cell.ts +10 -2
- package/src/commands/misc.ts +6 -3
- package/src/commands-with-analytics.ts +11 -5
- package/src/nodeviews/ExternalDropTargets.tsx +2 -0
- package/src/nodeviews/TableComponent.tsx +14 -16
- package/src/nodeviews/TableContainer.tsx +18 -3
- package/src/nodeviews/TableResizer.tsx +35 -21
- package/src/plugin.tsx +4 -1
- package/src/pm-plugins/keymap.ts +44 -6
- package/src/pm-plugins/main.ts +18 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +6 -2
- package/src/toolbar.tsx +20 -19
- package/src/types.ts +14 -2
- package/src/ui/DragHandle/index.tsx +2 -2
- package/src/ui/DragPreview/index.tsx +2 -0
- package/src/ui/FloatingContextualButton/FixedButton.tsx +9 -6
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +66 -112
- package/src/ui/FloatingDeleteButton/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -12
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +19 -28
- package/src/ui/FloatingInsertButton/InsertButton.tsx +1 -0
- package/src/ui/LayoutButton/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +3 -0
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +1 -0
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -0
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +4 -0
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -1
- package/src/ui/common-styles.ts +2 -0
- package/src/ui/ui-styles.ts +90 -79
- package/src/utils/guidelines.ts +5 -4
|
@@ -25,14 +25,12 @@ import type {
|
|
|
25
25
|
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
26
26
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
27
27
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
28
|
-
import {
|
|
29
|
-
MAX_BROWSER_SCROLLBAR_HEIGHT,
|
|
30
|
-
akEditorTableToolbarSize as tableToolbarSize,
|
|
31
|
-
} from '@atlaskit/editor-shared-styles';
|
|
28
|
+
import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
32
29
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
33
30
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
34
31
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
35
32
|
import type { CleanupFn } from '@atlaskit/pragmatic-drag-and-drop/types';
|
|
33
|
+
import { token } from '@atlaskit/tokens';
|
|
36
34
|
|
|
37
35
|
import { autoSizeTable, clearHoverSelection } from '../commands';
|
|
38
36
|
import { autoScrollerFactory } from '../pm-plugins/drag-and-drop/utils';
|
|
@@ -59,10 +57,6 @@ import { TABLE_EDITOR_MARGIN } from '../pm-plugins/table-resizing/utils/consts';
|
|
|
59
57
|
import { updateControls } from '../pm-plugins/table-resizing/utils/dom';
|
|
60
58
|
import type { CellHoverMeta, PluginInjectionAPI } from '../types';
|
|
61
59
|
import { TableCssClassName as ClassName, ShadowEvent } from '../types';
|
|
62
|
-
import {
|
|
63
|
-
tableOverflowShadowWidth,
|
|
64
|
-
tableOverflowShadowWidthWide,
|
|
65
|
-
} from '../ui/consts';
|
|
66
60
|
import TableFloatingColumnControls from '../ui/TableFloatingColumnControls';
|
|
67
61
|
import TableFloatingControls from '../ui/TableFloatingControls';
|
|
68
62
|
import {
|
|
@@ -751,7 +745,9 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
751
745
|
visibility:
|
|
752
746
|
showBeforeShadow && hasHeaderRow ? 'visible' : 'hidden',
|
|
753
747
|
top: `${topStickyShadowPosition}px`,
|
|
754
|
-
paddingBottom: `${
|
|
748
|
+
paddingBottom: `${
|
|
749
|
+
isDragAndDropEnabled && token('space.025', '2px')
|
|
750
|
+
}`,
|
|
755
751
|
}}
|
|
756
752
|
/>
|
|
757
753
|
)}
|
|
@@ -776,10 +772,10 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
776
772
|
<div
|
|
777
773
|
className={ClassName.TABLE_STICKY_SCROLLBAR_CONTAINER}
|
|
778
774
|
style={{
|
|
779
|
-
height: MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
775
|
+
height: token('space.250', '20px'), // MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
780
776
|
display: 'none',
|
|
781
777
|
// prevent unwanted scroll during table resize without removing scrollbar container from the dom
|
|
782
|
-
width: isResizing ? '0px' : '100%',
|
|
778
|
+
width: isResizing ? token('space.0', '0px') : '100%',
|
|
783
779
|
}}
|
|
784
780
|
>
|
|
785
781
|
<div
|
|
@@ -804,10 +800,10 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
804
800
|
getBooleanFF(
|
|
805
801
|
'platform.editor.table.increase-shadow-visibility_lh89r',
|
|
806
802
|
)
|
|
807
|
-
? tableOverflowShadowWidthWide
|
|
808
|
-
: tableOverflowShadowWidth
|
|
809
|
-
}
|
|
810
|
-
: '-2px',
|
|
803
|
+
? token('space.400', '32px') // tableOverflowShadowWidthWide
|
|
804
|
+
: token('space.100', '8px') // tableOverflowShadowWidth
|
|
805
|
+
}`
|
|
806
|
+
: token('space.negative.025', '-2px'),
|
|
811
807
|
}}
|
|
812
808
|
>
|
|
813
809
|
<div
|
|
@@ -816,7 +812,9 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
816
812
|
visibility:
|
|
817
813
|
showAfterShadow && hasHeaderRow ? 'visible' : 'hidden',
|
|
818
814
|
top: `${topStickyShadowPosition}px`,
|
|
819
|
-
paddingBottom: `${
|
|
815
|
+
paddingBottom: `${
|
|
816
|
+
isDragAndDropEnabled && token('space.025', '2px')
|
|
817
|
+
}`,
|
|
820
818
|
}}
|
|
821
819
|
/>
|
|
822
820
|
</div>
|
|
@@ -5,6 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
|
|
6
6
|
import type { TableEventPayload } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
|
|
8
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
8
9
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
9
10
|
import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
10
11
|
import type { EditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
20
21
|
|
|
21
22
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
22
|
-
import type { PluginInjectionAPI } from '../types';
|
|
23
|
+
import type { PluginInjectionAPI, TableSharedStateInternal } from '../types';
|
|
23
24
|
import { TableCssClassName as ClassName } from '../types';
|
|
24
25
|
|
|
25
26
|
import { TableResizer } from './TableResizer';
|
|
@@ -61,7 +62,7 @@ export const InnerContainer = forwardRef<
|
|
|
61
62
|
className={className}
|
|
62
63
|
data-number-column={node.attrs.isNumberColumnEnabled}
|
|
63
64
|
data-layout={node.attrs.layout}
|
|
64
|
-
data-
|
|
65
|
+
data-testid="table-container"
|
|
65
66
|
>
|
|
66
67
|
{children}
|
|
67
68
|
</div>
|
|
@@ -180,6 +181,10 @@ export const ResizableTableContainer = React.memo(
|
|
|
180
181
|
);
|
|
181
182
|
|
|
182
183
|
const tableWidth = getTableContainerWidth(node);
|
|
184
|
+
const { tableState } = useSharedPluginState(pluginInjectionApi, ['table']);
|
|
185
|
+
const { widthToWidest } = tableState as TableSharedStateInternal;
|
|
186
|
+
const currentTableNodeLocalId = node?.attrs?.localId ?? '';
|
|
187
|
+
|
|
183
188
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
184
189
|
const responsiveContainerWidth = isTableScalingEnabled
|
|
185
190
|
? containerWidth -
|
|
@@ -189,7 +194,16 @@ export const ResizableTableContainer = React.memo(
|
|
|
189
194
|
akEditorGutterPadding * 2 -
|
|
190
195
|
akEditorMediaResizeHandlerPaddingWide;
|
|
191
196
|
|
|
192
|
-
|
|
197
|
+
let width = Math.min(tableWidth, responsiveContainerWidth);
|
|
198
|
+
|
|
199
|
+
if (
|
|
200
|
+
isTableScalingEnabled &&
|
|
201
|
+
currentTableNodeLocalId &&
|
|
202
|
+
widthToWidest &&
|
|
203
|
+
widthToWidest[currentTableNodeLocalId]
|
|
204
|
+
) {
|
|
205
|
+
width = TABLE_MAX_WIDTH;
|
|
206
|
+
}
|
|
193
207
|
|
|
194
208
|
if (!isResizing) {
|
|
195
209
|
tableWidthRef.current = width;
|
|
@@ -210,6 +224,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
210
224
|
displayGapCursor,
|
|
211
225
|
isTableScalingEnabled,
|
|
212
226
|
isWholeTableInDanger,
|
|
227
|
+
pluginInjectionApi,
|
|
213
228
|
};
|
|
214
229
|
|
|
215
230
|
if (getBooleanFF('platform.editor.resizing-table-height-improvement')) {
|
|
@@ -16,6 +16,7 @@ import type { TableEventPayload } from '@atlaskit/editor-common/analytics';
|
|
|
16
16
|
import { TABLE_OVERFLOW_CHANGE_TRIGGER } from '@atlaskit/editor-common/analytics';
|
|
17
17
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
18
18
|
import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
|
|
19
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
19
20
|
import {
|
|
20
21
|
focusTableResizer,
|
|
21
22
|
ToolTipContent,
|
|
@@ -27,21 +28,21 @@ import { browser } from '@atlaskit/editor-common/utils';
|
|
|
27
28
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
28
29
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
29
30
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
30
|
-
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
31
31
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
32
32
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
33
33
|
import { token } from '@atlaskit/tokens';
|
|
34
34
|
|
|
35
35
|
import { updateWidthToWidest } from '../commands/misc';
|
|
36
|
-
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
37
36
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
38
37
|
import {
|
|
39
38
|
COLUMN_MIN_WIDTH,
|
|
40
39
|
getColgroupChildrenLength,
|
|
41
40
|
previewScaleTable,
|
|
42
41
|
scaleTable,
|
|
42
|
+
TABLE_MAX_WIDTH,
|
|
43
43
|
} from '../pm-plugins/table-resizing/utils';
|
|
44
44
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
45
|
+
import type { PluginInjectionAPI, TableSharedStateInternal } from '../types';
|
|
45
46
|
import {
|
|
46
47
|
TABLE_GUIDELINE_VISIBLE_ADJUSTMENT,
|
|
47
48
|
TABLE_HIGHLIGHT_GAP,
|
|
@@ -77,6 +78,7 @@ interface TableResizerProps {
|
|
|
77
78
|
payload: TableEventPayload,
|
|
78
79
|
) => ((tr: Transaction) => boolean) | undefined;
|
|
79
80
|
displayGapCursor: (toggle: boolean) => boolean;
|
|
81
|
+
pluginInjectionApi?: PluginInjectionAPI;
|
|
80
82
|
isTableScalingEnabled?: boolean;
|
|
81
83
|
isWholeTableInDanger?: boolean;
|
|
82
84
|
}
|
|
@@ -96,7 +98,7 @@ const RESIZE_STEP_VALUE = 10;
|
|
|
96
98
|
const handles = { right: true };
|
|
97
99
|
const handleStyles = {
|
|
98
100
|
right: {
|
|
99
|
-
// eslint-disable-next-line
|
|
101
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
100
102
|
right: '-14px',
|
|
101
103
|
marginTop: token('space.150', '12px'),
|
|
102
104
|
},
|
|
@@ -172,13 +174,16 @@ export const TableResizer = ({
|
|
|
172
174
|
displayGapCursor,
|
|
173
175
|
isTableScalingEnabled,
|
|
174
176
|
isWholeTableInDanger,
|
|
177
|
+
pluginInjectionApi,
|
|
175
178
|
}: PropsWithChildren<TableResizerImprovementProps>) => {
|
|
176
179
|
const currentGap = useRef(0);
|
|
177
180
|
// track resizing state - use ref over state to avoid re-render
|
|
178
181
|
const isResizing = useRef(false);
|
|
179
182
|
const areResizeMetaKeysPressed = useRef(false);
|
|
180
|
-
|
|
183
|
+
const [localTableWidth, setLocalTableWidth] = useState(width);
|
|
181
184
|
const resizerRef = useRef<ResizerNextHandler>(null);
|
|
185
|
+
const { tableState } = useSharedPluginState(pluginInjectionApi, ['table']);
|
|
186
|
+
const { widthToWidest } = tableState as TableSharedStateInternal;
|
|
182
187
|
|
|
183
188
|
// used to reposition tooltip when table is resizing via keyboard
|
|
184
189
|
const updateTooltip = React.useRef<() => void>();
|
|
@@ -349,25 +354,28 @@ export const TableResizer = ({
|
|
|
349
354
|
// and a table is resized to fit the widest guideline when view port width is between 1011 and 1800
|
|
350
355
|
// set the width of the table to 1800 pixels.
|
|
351
356
|
const { state, dispatch } = editorView;
|
|
352
|
-
const
|
|
357
|
+
const currentTableNodeLocalId = node?.attrs?.localId ?? '';
|
|
358
|
+
|
|
359
|
+
const widestGuideline = defaultGuidelinesForPreserveTable(
|
|
353
360
|
containerWidth,
|
|
354
|
-
)[
|
|
355
|
-
|
|
356
|
-
?.
|
|
357
|
-
|
|
358
|
-
widestGuideLineWidthString || '',
|
|
359
|
-
10,
|
|
360
|
-
);
|
|
361
|
+
).filter((guideline) => guideline.isFullWidth)[0];
|
|
362
|
+
const widestGuideLineWidth = widestGuideline
|
|
363
|
+
? ((widestGuideline.position?.x || 0) as number) * 2
|
|
364
|
+
: null;
|
|
361
365
|
const shouldUpdateWidthToWidest = !!(
|
|
362
366
|
isTableScalingEnabled &&
|
|
363
|
-
|
|
364
|
-
widestGuideLineWidth - newWidth <= 1
|
|
367
|
+
widestGuideLineWidth &&
|
|
368
|
+
Math.abs(widestGuideLineWidth - newWidth) <= 1
|
|
365
369
|
);
|
|
366
|
-
|
|
370
|
+
shouldUpdateWidthToWidest
|
|
371
|
+
? setLocalTableWidth(TABLE_MAX_WIDTH)
|
|
372
|
+
: setLocalTableWidth(newWidth);
|
|
367
373
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
);
|
|
374
|
+
updateWidthToWidest({
|
|
375
|
+
[currentTableNodeLocalId]: shouldUpdateWidthToWidest,
|
|
376
|
+
})(state, dispatch);
|
|
377
|
+
|
|
378
|
+
updateWidth(shouldUpdateWidthToWidest ? TABLE_MAX_WIDTH : newWidth);
|
|
371
379
|
|
|
372
380
|
return newWidth;
|
|
373
381
|
},
|
|
@@ -392,8 +400,13 @@ export const TableResizer = ({
|
|
|
392
400
|
let newWidth = originalState.width + delta.width;
|
|
393
401
|
const { state, dispatch } = editorView;
|
|
394
402
|
const pos = getPos();
|
|
395
|
-
const
|
|
396
|
-
newWidth =
|
|
403
|
+
const currentTableNodeLocalId = node?.attrs?.localId ?? '';
|
|
404
|
+
newWidth =
|
|
405
|
+
widthToWidest &&
|
|
406
|
+
currentTableNodeLocalId &&
|
|
407
|
+
widthToWidest[currentTableNodeLocalId]
|
|
408
|
+
? TABLE_MAX_WIDTH
|
|
409
|
+
: newWidth;
|
|
397
410
|
|
|
398
411
|
let tr = state.tr.setMeta(tableWidthPluginKey, { resizing: false });
|
|
399
412
|
const frameRateSamples = endMeasure();
|
|
@@ -467,6 +480,7 @@ export const TableResizer = ({
|
|
|
467
480
|
endMeasure,
|
|
468
481
|
onResizeStop,
|
|
469
482
|
isTableScalingEnabled,
|
|
483
|
+
widthToWidest,
|
|
470
484
|
],
|
|
471
485
|
);
|
|
472
486
|
|
|
@@ -617,7 +631,7 @@ export const TableResizer = ({
|
|
|
617
631
|
<ResizerNext
|
|
618
632
|
ref={resizerRef}
|
|
619
633
|
enable={handles}
|
|
620
|
-
width={
|
|
634
|
+
width={localTableWidth}
|
|
621
635
|
handleAlignmentMethod="sticky"
|
|
622
636
|
handleSize={handleSize}
|
|
623
637
|
handleStyles={handleStyles}
|
package/src/plugin.tsx
CHANGED
|
@@ -192,6 +192,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
192
192
|
// IMPORTANT: Need to continue to pass tableNode to control re-renders
|
|
193
193
|
// TableComponent listens for node attribute changes to update colgroups
|
|
194
194
|
tableNode: tablePluginState.tableNode,
|
|
195
|
+
widthToWidest: tablePluginState.widthToWidest,
|
|
195
196
|
};
|
|
196
197
|
},
|
|
197
198
|
|
|
@@ -305,7 +306,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
305
306
|
// plugin as it is currently swallowing backspace events inside tables
|
|
306
307
|
{
|
|
307
308
|
name: 'tableKeymap',
|
|
308
|
-
plugin: () => {
|
|
309
|
+
plugin: ({ getIntl }) => {
|
|
309
310
|
const {
|
|
310
311
|
dragAndDropEnabled,
|
|
311
312
|
isTableScalingEnabled = false,
|
|
@@ -317,6 +318,8 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
317
318
|
dragAndDropEnabled,
|
|
318
319
|
isTableScalingEnabled,
|
|
319
320
|
fullWidthEnabled,
|
|
321
|
+
api,
|
|
322
|
+
getIntl,
|
|
320
323
|
);
|
|
321
324
|
},
|
|
322
325
|
},
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { IntlShape } from 'react-intl-next/src/types';
|
|
2
|
+
|
|
1
3
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
4
|
import {
|
|
3
5
|
ACTION,
|
|
@@ -53,6 +55,7 @@ import {
|
|
|
53
55
|
addColumnBefore as addColumnBeforeCommand,
|
|
54
56
|
} from '../commands/insert';
|
|
55
57
|
import { moveSourceWithAnalyticsViaShortcut } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
58
|
+
import type { PluginInjectionAPIWithA11y } from '../types';
|
|
56
59
|
import { withEditorAnalyticsAPI } from '../utils/analytics';
|
|
57
60
|
|
|
58
61
|
const createTableWithAnalytics = (
|
|
@@ -76,17 +79,22 @@ export function keymapPlugin(
|
|
|
76
79
|
dragAndDropEnabled?: boolean,
|
|
77
80
|
isTableScalingEnabled = false,
|
|
78
81
|
isFullWidthEnabled?: boolean,
|
|
82
|
+
pluginInjectionApi?: PluginInjectionAPIWithA11y,
|
|
83
|
+
getIntl?: () => IntlShape,
|
|
79
84
|
): SafePlugin {
|
|
80
85
|
const list = {};
|
|
81
86
|
|
|
87
|
+
const ariaNotifyPlugin =
|
|
88
|
+
pluginInjectionApi?.accessibilityUtils?.actions.ariaNotify;
|
|
89
|
+
|
|
82
90
|
bindKeymapWithCommand(
|
|
83
91
|
nextCell.common!,
|
|
84
|
-
goToNextCell(editorAnalyticsAPI)(1),
|
|
92
|
+
goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(1),
|
|
85
93
|
list,
|
|
86
94
|
);
|
|
87
95
|
bindKeymapWithCommand(
|
|
88
96
|
previousCell.common!,
|
|
89
|
-
goToNextCell(editorAnalyticsAPI)(-1),
|
|
97
|
+
goToNextCell(editorAnalyticsAPI, ariaNotifyPlugin, getIntl)(-1),
|
|
90
98
|
list,
|
|
91
99
|
);
|
|
92
100
|
bindKeymapWithCommand(
|
|
@@ -190,13 +198,32 @@ export function keymapPlugin(
|
|
|
190
198
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
191
199
|
bindKeymapWithCommand(
|
|
192
200
|
startColumnResizing.common!,
|
|
193
|
-
initiateKeyboardColumnResizing
|
|
201
|
+
initiateKeyboardColumnResizing({
|
|
202
|
+
ariaNotify: ariaNotifyPlugin,
|
|
203
|
+
getIntl: getIntl,
|
|
204
|
+
}),
|
|
194
205
|
list,
|
|
195
206
|
);
|
|
196
207
|
|
|
197
|
-
bindKeymapWithCommand(
|
|
208
|
+
bindKeymapWithCommand(
|
|
209
|
+
moveRight.common!,
|
|
210
|
+
activateNextResizeArea({
|
|
211
|
+
direction: 1,
|
|
212
|
+
ariaNotify: ariaNotifyPlugin,
|
|
213
|
+
getIntl: getIntl,
|
|
214
|
+
}),
|
|
215
|
+
list,
|
|
216
|
+
);
|
|
198
217
|
|
|
199
|
-
bindKeymapWithCommand(
|
|
218
|
+
bindKeymapWithCommand(
|
|
219
|
+
moveLeft.common!,
|
|
220
|
+
activateNextResizeArea({
|
|
221
|
+
direction: -1,
|
|
222
|
+
ariaNotify: ariaNotifyPlugin,
|
|
223
|
+
getIntl: getIntl,
|
|
224
|
+
}),
|
|
225
|
+
list,
|
|
226
|
+
);
|
|
200
227
|
|
|
201
228
|
bindKeymapWithCommand(
|
|
202
229
|
decreaseMediaSize.common!,
|
|
@@ -205,6 +232,8 @@ export function keymapPlugin(
|
|
|
205
232
|
getEditorContainerWidth,
|
|
206
233
|
isTableScalingEnabled,
|
|
207
234
|
INPUT_METHOD.SHORTCUT,
|
|
235
|
+
ariaNotifyPlugin,
|
|
236
|
+
getIntl,
|
|
208
237
|
),
|
|
209
238
|
list,
|
|
210
239
|
);
|
|
@@ -216,10 +245,19 @@ export function keymapPlugin(
|
|
|
216
245
|
getEditorContainerWidth,
|
|
217
246
|
isTableScalingEnabled,
|
|
218
247
|
INPUT_METHOD.SHORTCUT,
|
|
248
|
+
ariaNotifyPlugin,
|
|
249
|
+
getIntl,
|
|
219
250
|
),
|
|
220
251
|
list,
|
|
221
252
|
);
|
|
222
|
-
bindKeymapWithCommand(
|
|
253
|
+
bindKeymapWithCommand(
|
|
254
|
+
escape.common!,
|
|
255
|
+
stopKeyboardColumnResizing({
|
|
256
|
+
ariaNotify: ariaNotifyPlugin,
|
|
257
|
+
getIntl: getIntl,
|
|
258
|
+
}),
|
|
259
|
+
list,
|
|
260
|
+
);
|
|
223
261
|
}
|
|
224
262
|
|
|
225
263
|
return keymap(list) as SafePlugin;
|
package/src/pm-plugins/main.ts
CHANGED
|
@@ -80,6 +80,7 @@ import type {
|
|
|
80
80
|
InvalidNodeAttr,
|
|
81
81
|
PluginConfig,
|
|
82
82
|
PluginInjectionAPI,
|
|
83
|
+
PluginInjectionAPIWithA11y,
|
|
83
84
|
} from '../types';
|
|
84
85
|
import { TableCssClassName as ClassName } from '../types';
|
|
85
86
|
import {
|
|
@@ -136,6 +137,10 @@ export const createPlugin = (
|
|
|
136
137
|
// Used to prevent invalid table cell spans being reported more than once per editor/document
|
|
137
138
|
const invalidTableIds: string[] = [];
|
|
138
139
|
let editorViewRef: EditorView | null = null;
|
|
140
|
+
|
|
141
|
+
const ariaNotifyPlugin = (pluginInjectionApi as PluginInjectionAPIWithA11y)
|
|
142
|
+
?.accessibilityUtils?.actions.ariaNotify;
|
|
143
|
+
|
|
139
144
|
const getCurrentEditorState = (): EditorState | null => {
|
|
140
145
|
const editorView = editorViewRef;
|
|
141
146
|
if (!editorView) {
|
|
@@ -215,7 +220,7 @@ export const createPlugin = (
|
|
|
215
220
|
}
|
|
216
221
|
const tableNode = findTable(state.selection);
|
|
217
222
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
218
|
-
// when cursor leaves the table we need to stop column resizing
|
|
223
|
+
// when keyboard cursor leaves the table we need to stop column resizing
|
|
219
224
|
const pluginPrevState = getPluginState(prevState);
|
|
220
225
|
const isStopKeyboardColumResizing =
|
|
221
226
|
pluginPrevState.isResizeHandleWidgetAdded &&
|
|
@@ -238,11 +243,17 @@ export const createPlugin = (
|
|
|
238
243
|
pluginPrevState.tableNode.attrs.localId
|
|
239
244
|
) {
|
|
240
245
|
// Jump to another table
|
|
241
|
-
stopKeyboardColumnResizing(
|
|
246
|
+
stopKeyboardColumnResizing({
|
|
247
|
+
ariaNotify: ariaNotifyPlugin,
|
|
248
|
+
getIntl: getIntl,
|
|
249
|
+
})(state, dispatch);
|
|
242
250
|
}
|
|
243
251
|
} else if (!tableNode) {
|
|
244
252
|
// selection outside of table
|
|
245
|
-
stopKeyboardColumnResizing(
|
|
253
|
+
stopKeyboardColumnResizing({
|
|
254
|
+
ariaNotify: ariaNotifyPlugin,
|
|
255
|
+
getIntl: getIntl,
|
|
256
|
+
})(state, dispatch);
|
|
246
257
|
}
|
|
247
258
|
}
|
|
248
259
|
}
|
|
@@ -366,7 +377,10 @@ export const createPlugin = (
|
|
|
366
377
|
if (getBooleanFF('platform.editor.a11y-column-resizing_emcvz')) {
|
|
367
378
|
const { isKeyboardResize } = getPluginState(state);
|
|
368
379
|
if (isKeyboardResize) {
|
|
369
|
-
stopKeyboardColumnResizing(
|
|
380
|
+
stopKeyboardColumnResizing({
|
|
381
|
+
ariaNotify: ariaNotifyPlugin,
|
|
382
|
+
getIntl: getIntl,
|
|
383
|
+
})(state, dispatch);
|
|
370
384
|
return false;
|
|
371
385
|
}
|
|
372
386
|
}
|
|
@@ -179,7 +179,7 @@ export const handleMouseDown = (
|
|
|
179
179
|
/** if column resize had started via keyboard but continued by mouse
|
|
180
180
|
* or mouse pointer leaves the table but mouse button still pressed
|
|
181
181
|
*/
|
|
182
|
-
return stopKeyboardColumnResizing()(state, dispatch, view);
|
|
182
|
+
return stopKeyboardColumnResizing({})(state, dispatch, view);
|
|
183
183
|
} else {
|
|
184
184
|
return stopResizing()(state, dispatch);
|
|
185
185
|
}
|
|
@@ -261,7 +261,11 @@ export const handleMouseDown = (
|
|
|
261
261
|
/** if column resize had started via keyboard but continued by mouse
|
|
262
262
|
* or mouse pointer leaves the table but mouse button still pressed
|
|
263
263
|
*/
|
|
264
|
-
return stopKeyboardColumnResizing(tr)(
|
|
264
|
+
return stopKeyboardColumnResizing({ originalTr: tr })(
|
|
265
|
+
state,
|
|
266
|
+
dispatch,
|
|
267
|
+
view,
|
|
268
|
+
);
|
|
265
269
|
} else {
|
|
266
270
|
return stopResizing(tr)(state, dispatch);
|
|
267
271
|
}
|
package/src/toolbar.tsx
CHANGED
|
@@ -51,7 +51,6 @@ import {
|
|
|
51
51
|
import DistributeColumnIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
52
52
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
53
53
|
import TableOptionsIcon from '@atlaskit/icon/glyph/preferences';
|
|
54
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
55
54
|
|
|
56
55
|
import {
|
|
57
56
|
clearHoverSelection,
|
|
@@ -135,10 +134,7 @@ export const getToolbarMenuConfig = (
|
|
|
135
134
|
},
|
|
136
135
|
];
|
|
137
136
|
|
|
138
|
-
if (
|
|
139
|
-
state.isDragAndDropEnabled &&
|
|
140
|
-
getBooleanFF('platform.editor.table.new-cell-context-menu-styling')
|
|
141
|
-
) {
|
|
137
|
+
if (state.isDragAndDropEnabled) {
|
|
142
138
|
return {
|
|
143
139
|
id: 'editor.table.tableOptions',
|
|
144
140
|
type: 'dropdown',
|
|
@@ -454,8 +450,15 @@ export const getToolbarConfig =
|
|
|
454
450
|
const isWidthResizing = tableWidthState?.resizing;
|
|
455
451
|
|
|
456
452
|
const { isTableScalingEnabled, widthToWidest } = pluginState;
|
|
457
|
-
|
|
458
|
-
|
|
453
|
+
const currentTableNodeLocalId = tableObject?.node?.attrs?.localId ?? '';
|
|
454
|
+
|
|
455
|
+
if (
|
|
456
|
+
isTableScalingEnabled &&
|
|
457
|
+
isWidthResizing &&
|
|
458
|
+
widthToWidest &&
|
|
459
|
+
currentTableNodeLocalId &&
|
|
460
|
+
widthToWidest[currentTableNodeLocalId]
|
|
461
|
+
) {
|
|
459
462
|
const { stickyScrollbar } = getEditorFeatureFlags();
|
|
460
463
|
|
|
461
464
|
const nodeType = state.schema.nodes.table;
|
|
@@ -526,18 +529,16 @@ export const getToolbarConfig =
|
|
|
526
529
|
);
|
|
527
530
|
|
|
528
531
|
let columnSettingsItems;
|
|
529
|
-
columnSettingsItems =
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
)
|
|
540
|
-
: [];
|
|
532
|
+
columnSettingsItems = pluginState.isDragAndDropEnabled
|
|
533
|
+
? getColumnSettingItems(
|
|
534
|
+
state,
|
|
535
|
+
getEditorView(),
|
|
536
|
+
intl,
|
|
537
|
+
getEditorContainerWidth,
|
|
538
|
+
editorAnalyticsAPI,
|
|
539
|
+
isTableScalingEnabled,
|
|
540
|
+
)
|
|
541
|
+
: [];
|
|
541
542
|
const colorPicker = getColorPicker(state, menu, intl, editorAnalyticsAPI);
|
|
542
543
|
|
|
543
544
|
// Check if we need to show confirm dialog for delete button
|
package/src/types.ts
CHANGED
|
@@ -35,6 +35,14 @@ export interface InsertRowOptions {
|
|
|
35
35
|
|
|
36
36
|
export type PluginInjectionAPI = ExtractInjectionAPI<TablePlugin>;
|
|
37
37
|
|
|
38
|
+
export type PluginInjectionAPIWithA11y = ExtractInjectionAPI<TablePlugin> & {
|
|
39
|
+
accessibilityUtils?: {
|
|
40
|
+
actions: {
|
|
41
|
+
ariaNotify: (message: string) => void | undefined;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
38
46
|
// override getPluginState but do not expose publicly as this type is experimental and will change
|
|
39
47
|
// in the future
|
|
40
48
|
export type TableSharedStateInternal = Pick<
|
|
@@ -49,6 +57,7 @@ export type TableSharedStateInternal = Pick<
|
|
|
49
57
|
| 'hoveredCell'
|
|
50
58
|
| 'isTableHovered'
|
|
51
59
|
| 'tableNode'
|
|
60
|
+
| 'widthToWidest'
|
|
52
61
|
> & {
|
|
53
62
|
isResizing: boolean;
|
|
54
63
|
isTableResizing?: boolean;
|
|
@@ -121,6 +130,9 @@ export interface CellHoverMeta {
|
|
|
121
130
|
colIndex?: number;
|
|
122
131
|
rowIndex?: number;
|
|
123
132
|
}
|
|
133
|
+
export interface WidthToWidest {
|
|
134
|
+
[tableLocalId: string]: boolean;
|
|
135
|
+
}
|
|
124
136
|
|
|
125
137
|
export interface TablePluginState {
|
|
126
138
|
editorHasFocus?: boolean;
|
|
@@ -155,7 +167,7 @@ export interface TablePluginState {
|
|
|
155
167
|
// for table wrap/collapse
|
|
156
168
|
isTableCollapsed?: boolean; // is the current table already in an expand?
|
|
157
169
|
canCollapseTable?: boolean; // enabled/disabled state of collapse option
|
|
158
|
-
widthToWidest?:
|
|
170
|
+
widthToWidest?: WidthToWidest; // is the current table set to the widest width regarding view port
|
|
159
171
|
|
|
160
172
|
getIntl: () => IntlShape;
|
|
161
173
|
|
|
@@ -246,7 +258,7 @@ export type TablePluginAction =
|
|
|
246
258
|
| {
|
|
247
259
|
type: 'UPDATE_TABLE_WIDTH_TO_WIDEST';
|
|
248
260
|
data: {
|
|
249
|
-
widthToWidest:
|
|
261
|
+
widthToWidest: WidthToWidest | undefined;
|
|
250
262
|
};
|
|
251
263
|
}
|
|
252
264
|
| {
|
|
@@ -222,8 +222,8 @@ const DragHandleComponent = ({
|
|
|
222
222
|
width: isRow
|
|
223
223
|
? `${token('space.200', '16px')}` // 16px here because it's the size of drag handle button's large side
|
|
224
224
|
: `calc(100% - ${dragTableInsertColumnButtonSize}px)`,
|
|
225
|
-
left: isRow ? '
|
|
226
|
-
bottom: isColumn ? '0' : undefined,
|
|
225
|
+
left: isRow ? `${token('space.050', '4px')}` : undefined,
|
|
226
|
+
bottom: isColumn ? `${token('space.0', '0px')}` : undefined,
|
|
227
227
|
alignSelf: isColumn ? 'none' : 'center',
|
|
228
228
|
zIndex: isColumn ? '-1' : 'auto',
|
|
229
229
|
}}
|
|
@@ -36,7 +36,9 @@ export const DragPreview = ({
|
|
|
36
36
|
<DragInMotionIcon
|
|
37
37
|
style={{
|
|
38
38
|
position: 'absolute',
|
|
39
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
39
40
|
marginLeft: `${marginLeft}px`,
|
|
41
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
40
42
|
marginTop: `${marginTop}px`,
|
|
41
43
|
transform: transform,
|
|
42
44
|
}}
|
|
@@ -4,6 +4,7 @@ import rafSchedule from 'raf-schd';
|
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
|
|
6
6
|
import { akEditorTableCellOnStickyHeaderZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { token } from '@atlaskit/tokens';
|
|
7
8
|
|
|
8
9
|
import type { RowStickyState } from '../../pm-plugins/sticky-headers';
|
|
9
10
|
import { TableCssClassName as ClassName } from '../../types';
|
|
@@ -144,26 +145,28 @@ export const FixedButton = ({
|
|
|
144
145
|
ref={observerTargetRef}
|
|
145
146
|
style={{
|
|
146
147
|
position: 'absolute',
|
|
147
|
-
top: '0px',
|
|
148
|
-
left: '0px',
|
|
149
|
-
width:
|
|
150
|
-
height:
|
|
148
|
+
top: token('space.0', '0px'),
|
|
149
|
+
left: token('space.0', '0px'),
|
|
150
|
+
width: token('space.250', '20px'), // BUTTON_WIDTH
|
|
151
|
+
height: token('space.250', '20px'), // BUTTON_WIDTH
|
|
151
152
|
}}
|
|
152
153
|
>
|
|
153
154
|
<div
|
|
154
155
|
ref={fixedButtonRef}
|
|
155
156
|
style={{
|
|
156
157
|
position: 'fixed',
|
|
158
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
157
159
|
top: stickyHeader.top + stickyHeader.padding + offset * 2,
|
|
158
160
|
zIndex: akEditorTableCellOnStickyHeaderZIndex,
|
|
161
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
159
162
|
left: calcLeftPos({
|
|
160
163
|
buttonWidth: BUTTON_WIDTH,
|
|
161
164
|
cellRectLeft: targetCellRect.left,
|
|
162
165
|
cellRefWidth: targetCellRef.clientWidth,
|
|
163
166
|
offset,
|
|
164
167
|
}),
|
|
165
|
-
width:
|
|
166
|
-
height:
|
|
168
|
+
width: token('space.250', '20px'), // BUTTON_WIDTH
|
|
169
|
+
height: token('space.250', '20px'), // BUTTON_WIDTH
|
|
167
170
|
}}
|
|
168
171
|
className={ClassName.CONTEXTUAL_MENU_BUTTON_FIXED}
|
|
169
172
|
>
|