@atlaskit/editor-plugin-table 7.16.16 → 7.16.18
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 +34 -0
- package/dist/cjs/commands-with-analytics.js +66 -41
- package/dist/cjs/nodeviews/TableContainer.js +14 -12
- package/dist/cjs/nodeviews/TableResizer.js +17 -18
- package/dist/cjs/plugin.js +3 -2
- package/dist/cjs/pm-plugins/keymap.js +6 -0
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +1 -1
- package/dist/cjs/toolbar.js +54 -71
- package/dist/cjs/ui/icons/index.js +0 -7
- package/dist/cjs/utils/snapping.js +2 -2
- package/dist/es2019/commands-with-analytics.js +29 -6
- package/dist/es2019/nodeviews/TableContainer.js +17 -13
- package/dist/es2019/nodeviews/TableResizer.js +17 -18
- package/dist/es2019/plugin.js +3 -2
- package/dist/es2019/pm-plugins/keymap.js +7 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/es2019/toolbar.js +54 -71
- package/dist/es2019/ui/icons/index.js +0 -1
- package/dist/es2019/utils/snapping.js +3 -3
- package/dist/esm/commands-with-analytics.js +66 -41
- package/dist/esm/nodeviews/TableContainer.js +15 -13
- package/dist/esm/nodeviews/TableResizer.js +20 -21
- package/dist/esm/plugin.js +3 -2
- package/dist/esm/pm-plugins/keymap.js +7 -1
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +2 -2
- package/dist/esm/toolbar.js +55 -72
- package/dist/esm/ui/icons/index.js +0 -1
- package/dist/esm/utils/snapping.js +3 -3
- package/dist/types/commands/toggle.d.ts +1 -1
- package/dist/types/commands-with-analytics.d.ts +7 -4
- package/dist/types/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types/toolbar.d.ts +4 -5
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -0
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -0
- package/dist/types/ui/TableFloatingControls/index.d.ts +2 -0
- package/dist/types/ui/icons/index.d.ts +0 -1
- package/dist/types-ts4.5/commands/toggle.d.ts +1 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +7 -4
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/resize-state.d.ts +1 -1
- package/dist/types-ts4.5/toolbar.d.ts +4 -5
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -0
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/icons/index.d.ts +0 -1
- package/package.json +9 -6
- package/src/commands-with-analytics.ts +80 -40
- package/src/nodeviews/TableContainer.tsx +24 -14
- package/src/nodeviews/TableResizer.tsx +29 -15
- package/src/plugin.tsx +5 -2
- package/src/pm-plugins/keymap.ts +30 -0
- package/src/pm-plugins/table-resizing/utils/misc.ts +2 -2
- package/src/toolbar.tsx +80 -83
- package/src/ui/TableFloatingControls/index.tsx +0 -1
- package/src/ui/icons/index.ts +0 -1
- package/src/utils/snapping.ts +4 -4
- package/dist/cjs/ui/icons/DisplayModeIcon.js +0 -46
- package/dist/es2019/ui/icons/DisplayModeIcon.js +0 -39
- package/dist/esm/ui/icons/DisplayModeIcon.js +0 -39
- package/dist/types/ui/icons/DisplayModeIcon.d.ts +0 -4
- package/dist/types-ts4.5/ui/icons/DisplayModeIcon.d.ts +0 -4
- package/src/ui/icons/DisplayModeIcon.tsx +0 -41
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.16.
|
|
3
|
+
"version": "7.16.18",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@atlaskit/adf-schema": "^36.10.7",
|
|
32
32
|
"@atlaskit/button": "^17.17.0",
|
|
33
33
|
"@atlaskit/custom-steps": "^0.2.0",
|
|
34
|
-
"@atlaskit/editor-common": "^
|
|
34
|
+
"@atlaskit/editor-common": "^82.1.0",
|
|
35
35
|
"@atlaskit/editor-palette": "1.6.0",
|
|
36
36
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
"@atlaskit/editor-plugin-selection": "^1.2.0",
|
|
42
42
|
"@atlaskit/editor-plugin-width": "^1.1.0",
|
|
43
43
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
44
|
-
"@atlaskit/editor-shared-styles": "^2.
|
|
44
|
+
"@atlaskit/editor-shared-styles": "^2.12.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.7.0",
|
|
46
46
|
"@atlaskit/icon": "^22.3.0",
|
|
47
|
-
"@atlaskit/menu": "^2.
|
|
47
|
+
"@atlaskit/menu": "^2.4.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.2.1",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.1.0",
|
|
50
50
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.3.0",
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
|
-
"@atlaskit/primitives": "^
|
|
53
|
-
"@atlaskit/theme": "^12.
|
|
52
|
+
"@atlaskit/primitives": "^7.0.0",
|
|
53
|
+
"@atlaskit/theme": "^12.9.0",
|
|
54
54
|
"@atlaskit/toggle": "^13.1.0",
|
|
55
55
|
"@atlaskit/tokens": "^1.49.0",
|
|
56
56
|
"@atlaskit/tooltip": "^18.4.0",
|
|
@@ -114,6 +114,9 @@
|
|
|
114
114
|
"platform.editor.a11y-column-resizing_emcvz": {
|
|
115
115
|
"type": "boolean"
|
|
116
116
|
},
|
|
117
|
+
"platform.editor.a11y-help-dialog-shortcut-keys-position_aghfg": {
|
|
118
|
+
"type": "boolean"
|
|
119
|
+
},
|
|
117
120
|
"platform.editor.transform-slice-for-nested-expand": {
|
|
118
121
|
"type": "boolean"
|
|
119
122
|
},
|
|
@@ -13,11 +13,13 @@ import {
|
|
|
13
13
|
} from '@atlaskit/editor-common/analytics';
|
|
14
14
|
import type { AnalyticsEventPayload, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
15
15
|
import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
|
|
16
|
+
import { type CHANGE_ALIGNMENT_REASON } from '@atlaskit/editor-common/src/analytics/types/table-events';
|
|
16
17
|
import type { Command, GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
18
|
+
import { type NodeWithPos } from '@atlaskit/editor-prosemirror/dist/types/utils';
|
|
17
19
|
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
18
20
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
19
21
|
import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
|
|
20
|
-
import type
|
|
22
|
+
import { type Rect, TableMap } from '@atlaskit/editor-tables/table-map';
|
|
21
23
|
import {
|
|
22
24
|
findCellClosestToPos,
|
|
23
25
|
findCellRectClosestToPos,
|
|
@@ -36,6 +38,7 @@ import {
|
|
|
36
38
|
getTableSelectionType,
|
|
37
39
|
setMultipleCellAttrs,
|
|
38
40
|
setTableAlignment,
|
|
41
|
+
setTableAlignmentWithTableContentWithPos,
|
|
39
42
|
} from './commands/misc';
|
|
40
43
|
import { sortByColumn } from './commands/sort';
|
|
41
44
|
import { splitCell } from './commands/split-cell';
|
|
@@ -605,47 +608,45 @@ export const wrapTableInExpandWithAnalytics = (
|
|
|
605
608
|
};
|
|
606
609
|
})(editorAnalyticsAPI)(wrapTableInExpand);
|
|
607
610
|
|
|
608
|
-
export const
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
withEditorAnalyticsAPI((state) => {
|
|
615
|
-
const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
|
|
611
|
+
export const toggleFixedColumnWidthsOptionAnalytics = (
|
|
612
|
+
editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null,
|
|
613
|
+
inputMethod: INPUT_METHOD.FLOATING_TB,
|
|
614
|
+
) =>
|
|
615
|
+
withEditorAnalyticsAPI((state) => {
|
|
616
|
+
const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
|
|
616
617
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
618
|
+
let previousDisplayMode: TABLE_DISPLAY_MODE;
|
|
619
|
+
let newDisplayMode: TABLE_DISPLAY_MODE;
|
|
620
|
+
|
|
621
|
+
switch (table?.node.attrs.displayMode) {
|
|
622
|
+
case 'fixed':
|
|
623
|
+
previousDisplayMode = TABLE_DISPLAY_MODE.FIXED;
|
|
624
|
+
newDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
|
|
625
|
+
break;
|
|
626
|
+
case 'default':
|
|
627
|
+
previousDisplayMode = TABLE_DISPLAY_MODE.DEFAULT;
|
|
628
|
+
newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
|
|
629
|
+
break;
|
|
630
|
+
case null:
|
|
631
|
+
default:
|
|
632
|
+
previousDisplayMode = TABLE_DISPLAY_MODE.INITIAL;
|
|
633
|
+
newDisplayMode = TABLE_DISPLAY_MODE.FIXED;
|
|
634
|
+
}
|
|
634
635
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
636
|
+
return {
|
|
637
|
+
action: TABLE_ACTION.CHANGED_DISPLAY_MODE,
|
|
638
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
639
|
+
attributes: {
|
|
640
|
+
inputMethod,
|
|
641
|
+
previousDisplayMode,
|
|
642
|
+
newDisplayMode,
|
|
643
|
+
tableWidth: table?.node.attrs.width,
|
|
644
|
+
totalRowCount,
|
|
645
|
+
totalColumnCount,
|
|
646
|
+
},
|
|
647
|
+
eventType: EVENT_TYPE.TRACK,
|
|
648
|
+
};
|
|
649
|
+
})(editorAnalyticsAPI)(editorCommandToPMCommand(setTableDisplayMode));
|
|
649
650
|
|
|
650
651
|
export const setTableAlignmentWithAnalytics =
|
|
651
652
|
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
@@ -654,6 +655,7 @@ export const setTableAlignmentWithAnalytics =
|
|
|
654
655
|
// previous alignment could be a breakout value, if so use 'null' to indicate alignment was not previously set
|
|
655
656
|
previousAlignment: TableLayout,
|
|
656
657
|
inputMethod: INPUT_METHOD.FLOATING_TB,
|
|
658
|
+
reason: CHANGE_ALIGNMENT_REASON,
|
|
657
659
|
) =>
|
|
658
660
|
withEditorAnalyticsAPI((state) => {
|
|
659
661
|
const { table, totalRowCount, totalColumnCount } = getSelectedTableInfo(state.selection);
|
|
@@ -673,6 +675,44 @@ export const setTableAlignmentWithAnalytics =
|
|
|
673
675
|
totalRowCount,
|
|
674
676
|
totalColumnCount,
|
|
675
677
|
inputMethod,
|
|
678
|
+
reason,
|
|
676
679
|
},
|
|
677
680
|
};
|
|
678
681
|
})(editorAnalyticsAPI)(editorCommandToPMCommand(setTableAlignment(newAlignment)));
|
|
682
|
+
|
|
683
|
+
export const setTableAlignmentWithTableContentWithPosWithAnalytics =
|
|
684
|
+
(editorAnalyticsAPI: EditorAnalyticsAPI | undefined | null) =>
|
|
685
|
+
(
|
|
686
|
+
newAlignment: AlignmentOptions,
|
|
687
|
+
previousAlignment: AlignmentOptions | null,
|
|
688
|
+
tableNodeWithPos: NodeWithPos,
|
|
689
|
+
inputMethod: INPUT_METHOD.AUTO,
|
|
690
|
+
reason: CHANGE_ALIGNMENT_REASON,
|
|
691
|
+
) =>
|
|
692
|
+
withEditorAnalyticsAPI(() => {
|
|
693
|
+
const map = TableMap.get(tableNodeWithPos.node);
|
|
694
|
+
const totalRowCount = map.height;
|
|
695
|
+
const totalColumnCount = map.width;
|
|
696
|
+
|
|
697
|
+
const attributes = {
|
|
698
|
+
tableWidth: tableNodeWithPos.node.attrs.width,
|
|
699
|
+
newAlignment: newAlignment,
|
|
700
|
+
previousAlignment: previousAlignment,
|
|
701
|
+
totalRowCount: totalRowCount,
|
|
702
|
+
totalColumnCount: totalColumnCount,
|
|
703
|
+
inputMethod: inputMethod,
|
|
704
|
+
reason: reason,
|
|
705
|
+
};
|
|
706
|
+
|
|
707
|
+
return {
|
|
708
|
+
action: TABLE_ACTION.CHANGED_ALIGNMENT,
|
|
709
|
+
actionSubject: ACTION_SUBJECT.TABLE,
|
|
710
|
+
actionSubjectId: null,
|
|
711
|
+
eventType: EVENT_TYPE.TRACK,
|
|
712
|
+
attributes: attributes,
|
|
713
|
+
};
|
|
714
|
+
})(editorAnalyticsAPI)(
|
|
715
|
+
editorCommandToPMCommand(
|
|
716
|
+
setTableAlignmentWithTableContentWithPos(newAlignment, tableNodeWithPos),
|
|
717
|
+
),
|
|
718
|
+
);
|
|
@@ -3,7 +3,11 @@ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState }
|
|
|
3
3
|
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import {
|
|
7
|
+
CHANGE_ALIGNMENT_REASON,
|
|
8
|
+
INPUT_METHOD,
|
|
9
|
+
type TableEventPayload,
|
|
10
|
+
} from '@atlaskit/editor-common/analytics';
|
|
7
11
|
import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
|
|
8
12
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
9
13
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
@@ -12,14 +16,15 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
12
16
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
13
17
|
import {
|
|
14
18
|
akEditorDefaultLayoutWidth,
|
|
15
|
-
|
|
19
|
+
akEditorGutterPaddingDynamic,
|
|
16
20
|
akEditorMobileBreakoutPoint,
|
|
17
21
|
} from '@atlaskit/editor-shared-styles';
|
|
18
22
|
|
|
19
|
-
import {
|
|
23
|
+
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
|
|
20
24
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils';
|
|
21
25
|
import type { PluginInjectionAPI, TableSharedState } from '../types';
|
|
22
26
|
import { TableCssClassName as ClassName } from '../types';
|
|
27
|
+
import { ALIGN_CENTER, ALIGN_START } from '../utils/alignment';
|
|
23
28
|
|
|
24
29
|
import { TableResizer } from './TableResizer';
|
|
25
30
|
|
|
@@ -69,16 +74,19 @@ const AlignmentTableContainer = ({
|
|
|
69
74
|
getPos,
|
|
70
75
|
editorView,
|
|
71
76
|
}: PropsWithChildren<AlignmentTableContainerProps>) => {
|
|
72
|
-
const alignment = node.attrs.layout;
|
|
77
|
+
const alignment = node.attrs.layout !== ALIGN_START ? ALIGN_CENTER : ALIGN_START;
|
|
73
78
|
const { tableState } = useSharedPluginState(pluginInjectionApi, ['table']);
|
|
74
79
|
|
|
75
80
|
useEffect(() => {
|
|
76
81
|
if (tableState && editorView && getPos) {
|
|
77
82
|
const { wasFullWidthModeEnabled, isFullWidthModeEnabled } = tableState;
|
|
83
|
+
const { state, dispatch } = editorView;
|
|
78
84
|
|
|
79
85
|
if (
|
|
80
86
|
wasFullWidthModeEnabled &&
|
|
87
|
+
isFullWidthModeEnabled !== undefined &&
|
|
81
88
|
!isFullWidthModeEnabled &&
|
|
89
|
+
alignment !== ALIGN_CENTER &&
|
|
82
90
|
node.attrs.width > akEditorDefaultLayoutWidth
|
|
83
91
|
) {
|
|
84
92
|
const pos = getPos && getPos();
|
|
@@ -87,13 +95,15 @@ const AlignmentTableContainer = ({
|
|
|
87
95
|
return;
|
|
88
96
|
}
|
|
89
97
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
setTableAlignmentWithTableContentWithPosWithAnalytics(
|
|
99
|
+
pluginInjectionApi?.analytics?.actions,
|
|
100
|
+
)(
|
|
101
|
+
ALIGN_CENTER,
|
|
102
|
+
alignment,
|
|
103
|
+
{ pos, node },
|
|
104
|
+
INPUT_METHOD.AUTO,
|
|
105
|
+
CHANGE_ALIGNMENT_REASON.EDITOR_APPEARANCE_CHANGED,
|
|
106
|
+
)(state, dispatch);
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
109
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -276,15 +286,15 @@ export const ResizableTableContainer = React.memo(
|
|
|
276
286
|
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
277
287
|
responsiveContainerWidth = isTableScalingEnabled
|
|
278
288
|
? lineLength
|
|
279
|
-
: containerWidth -
|
|
289
|
+
: containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
|
|
280
290
|
} else {
|
|
281
291
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
282
292
|
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
283
293
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
284
294
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
285
295
|
responsiveContainerWidth = isTableScalingEnabled
|
|
286
|
-
? containerWidth -
|
|
287
|
-
: containerWidth -
|
|
296
|
+
? containerWidth - akEditorGutterPaddingDynamic() * 2
|
|
297
|
+
: containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
|
|
288
298
|
}
|
|
289
299
|
let width = Math.min(tableWidth, responsiveContainerWidth);
|
|
290
300
|
|
|
@@ -5,7 +5,11 @@ import rafSchd from 'raf-schd';
|
|
|
5
5
|
import { useIntl } from 'react-intl-next';
|
|
6
6
|
|
|
7
7
|
import type { TableEventPayload } from '@atlaskit/editor-common/analytics';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
CHANGE_ALIGNMENT_REASON,
|
|
10
|
+
INPUT_METHOD,
|
|
11
|
+
TABLE_OVERFLOW_CHANGE_TRIGGER,
|
|
12
|
+
} from '@atlaskit/editor-common/analytics';
|
|
9
13
|
import { getGuidelinesWithHighlights } from '@atlaskit/editor-common/guideline';
|
|
10
14
|
import type { GuidelineConfig } from '@atlaskit/editor-common/guideline';
|
|
11
15
|
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
@@ -18,12 +22,13 @@ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
|
18
22
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
19
23
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
20
24
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
21
|
-
import {
|
|
25
|
+
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
22
26
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
23
27
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
24
28
|
import { token } from '@atlaskit/tokens';
|
|
25
29
|
|
|
26
|
-
import {
|
|
30
|
+
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../commands-with-analytics';
|
|
31
|
+
import { updateWidthToWidest } from '../commands/misc';
|
|
27
32
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
28
33
|
import {
|
|
29
34
|
COLUMN_MIN_WIDTH,
|
|
@@ -157,7 +162,7 @@ const getVisibleGuidelines = (
|
|
|
157
162
|
|
|
158
163
|
guidelineVisibleAdjustment = isFullWidthModeEnabled
|
|
159
164
|
? preserve_table_widths_adjustment // guidelineVisibleAdjustment = -2, if lineLength = 1180, 1181 < 1180 + 2 is true.
|
|
160
|
-
: -2 *
|
|
165
|
+
: -2 * akEditorGutterPaddingDynamic() + preserve_table_widths_adjustment; // guidelineVisibleAdjustment = -62, if containerWidth is 1244, 1181 < 1244 - 62 = 1182 is true.
|
|
161
166
|
}
|
|
162
167
|
const width = isTableScalingEnabled && isFullWidthModeEnabled ? lineLength : containerWidth;
|
|
163
168
|
|
|
@@ -231,7 +236,9 @@ export const TableResizer = ({
|
|
|
231
236
|
isTableScalingEnabled
|
|
232
237
|
? defaultGuidelinesForPreserveTable(
|
|
233
238
|
PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET,
|
|
234
|
-
isFullWidthModeEnabled
|
|
239
|
+
isFullWidthModeEnabled
|
|
240
|
+
? lineLength + 2 * akEditorGutterPaddingDynamic()
|
|
241
|
+
: containerWidth,
|
|
235
242
|
excludeGuidelineConfig,
|
|
236
243
|
)
|
|
237
244
|
: defaultGuidelines,
|
|
@@ -260,7 +267,9 @@ export const TableResizer = ({
|
|
|
260
267
|
x: isTableScalingEnabled
|
|
261
268
|
? defaultTablePreserveSnappingWidths(
|
|
262
269
|
PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, // was hardcoded to 0, using PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
263
|
-
isFullWidthModeEnabled
|
|
270
|
+
isFullWidthModeEnabled
|
|
271
|
+
? lineLength + 2 * akEditorGutterPaddingDynamic()
|
|
272
|
+
: containerWidth,
|
|
264
273
|
excludeGuidelineConfig,
|
|
265
274
|
)
|
|
266
275
|
: defaultSnappingWidths,
|
|
@@ -287,18 +296,21 @@ export const TableResizer = ({
|
|
|
287
296
|
isResizing.current
|
|
288
297
|
) {
|
|
289
298
|
const tableNodeWithPos = { pos, node };
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
299
|
+
setTableAlignmentWithTableContentWithPosWithAnalytics(
|
|
300
|
+
pluginInjectionApi?.analytics?.actions,
|
|
301
|
+
)(
|
|
302
|
+
ALIGN_CENTER,
|
|
303
|
+
ALIGN_START,
|
|
304
|
+
tableNodeWithPos,
|
|
305
|
+
INPUT_METHOD.AUTO,
|
|
306
|
+
CHANGE_ALIGNMENT_REASON.EDITOR_APPEARANCE_CHANGED,
|
|
307
|
+
)(state, dispatch);
|
|
296
308
|
return true;
|
|
297
309
|
}
|
|
298
310
|
|
|
299
311
|
return false;
|
|
300
312
|
},
|
|
301
|
-
[
|
|
313
|
+
[isTableAlignmentEnabled, lineLength, pluginInjectionApi?.analytics?.actions],
|
|
302
314
|
);
|
|
303
315
|
|
|
304
316
|
useEffect(() => {
|
|
@@ -346,7 +358,9 @@ export const TableResizer = ({
|
|
|
346
358
|
isTableScalingEnabled
|
|
347
359
|
? defaultGuidelinesForPreserveTable(
|
|
348
360
|
PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET,
|
|
349
|
-
isFullWidthModeEnabled
|
|
361
|
+
isFullWidthModeEnabled
|
|
362
|
+
? lineLength + 2 * akEditorGutterPaddingDynamic()
|
|
363
|
+
: containerWidth,
|
|
350
364
|
excludeGuidelineConfig,
|
|
351
365
|
)
|
|
352
366
|
: defaultGuidelines,
|
|
@@ -402,7 +416,7 @@ export const TableResizer = ({
|
|
|
402
416
|
);
|
|
403
417
|
|
|
404
418
|
const editorContainerWidth = isFullWidthModeEnabled
|
|
405
|
-
? lineLength + 2 *
|
|
419
|
+
? lineLength + 2 * akEditorGutterPaddingDynamic()
|
|
406
420
|
: containerWidth;
|
|
407
421
|
|
|
408
422
|
const closestSnap = findClosestSnap(
|
package/src/plugin.tsx
CHANGED
|
@@ -153,9 +153,11 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
153
153
|
};
|
|
154
154
|
const editorAnalyticsAPI = api?.analytics?.actions;
|
|
155
155
|
|
|
156
|
-
const
|
|
156
|
+
const isTableScalingWithFixedColumnWidthsOptionEnabled =
|
|
157
157
|
options?.isTableScalingEnabled &&
|
|
158
|
-
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button')
|
|
158
|
+
getBooleanFF('platform.editor.table.preserve-widths-with-lock-button');
|
|
159
|
+
const shouldUseIncreasedScalingPercent =
|
|
160
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled &&
|
|
159
161
|
getBooleanFF('platform.editor.table.use-increased-scaling-percent');
|
|
160
162
|
|
|
161
163
|
return {
|
|
@@ -660,6 +662,7 @@ const tablesPlugin: TablePlugin = ({ config: options, api }) => {
|
|
|
660
662
|
options?.getEditorFeatureFlags || defaultGetEditorFeatureFlags,
|
|
661
663
|
() => editorViewRef.current,
|
|
662
664
|
options,
|
|
665
|
+
isTableScalingWithFixedColumnWidthsOptionEnabled,
|
|
663
666
|
shouldUseIncreasedScalingPercent,
|
|
664
667
|
)(pluginConfig(options?.tableOptions)),
|
|
665
668
|
},
|
package/src/pm-plugins/keymap.ts
CHANGED
|
@@ -4,9 +4,13 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import {
|
|
6
6
|
addColumnAfter,
|
|
7
|
+
addColumnAfterVO,
|
|
7
8
|
addColumnBefore,
|
|
9
|
+
addColumnBeforeVO,
|
|
8
10
|
addRowAfter,
|
|
11
|
+
addRowAfterVO,
|
|
9
12
|
addRowBefore,
|
|
13
|
+
addRowBeforeVO,
|
|
10
14
|
backspace,
|
|
11
15
|
bindKeymapWithCommand,
|
|
12
16
|
decreaseMediaSize,
|
|
@@ -122,6 +126,32 @@ export function keymapPlugin(
|
|
|
122
126
|
list,
|
|
123
127
|
);
|
|
124
128
|
|
|
129
|
+
if (getBooleanFF('platform.editor.a11y-help-dialog-shortcut-keys-position_aghfg')) {
|
|
130
|
+
bindKeymapWithCommand(
|
|
131
|
+
addRowBeforeVO.common!,
|
|
132
|
+
addRowAroundSelection(editorAnalyticsAPI)('TOP'),
|
|
133
|
+
list,
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
bindKeymapWithCommand(
|
|
137
|
+
addRowAfterVO.common!,
|
|
138
|
+
addRowAroundSelection(editorAnalyticsAPI)('BOTTOM'),
|
|
139
|
+
list,
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
bindKeymapWithCommand(
|
|
143
|
+
addColumnBeforeVO.common!,
|
|
144
|
+
addColumnBeforeCommand(isTableScalingEnabled),
|
|
145
|
+
list,
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
bindKeymapWithCommand(
|
|
149
|
+
addColumnAfterVO.common!,
|
|
150
|
+
addColumnAfterCommand(isTableScalingEnabled),
|
|
151
|
+
list,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
|
|
125
155
|
if (dragAndDropEnabled) {
|
|
126
156
|
// Move row/column shortcuts
|
|
127
157
|
/**
|
|
@@ -13,7 +13,7 @@ import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
13
13
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
14
14
|
import {
|
|
15
15
|
akEditorFullWidthLayoutWidth,
|
|
16
|
-
|
|
16
|
+
akEditorGutterPaddingDynamic,
|
|
17
17
|
akEditorTableNumberColumnWidth,
|
|
18
18
|
} from '@atlaskit/editor-shared-styles';
|
|
19
19
|
|
|
@@ -35,7 +35,7 @@ export function getLayoutSize(
|
|
|
35
35
|
|
|
36
36
|
if (isFullWidthModeEnabled) {
|
|
37
37
|
return containerWidth
|
|
38
|
-
? Math.min(containerWidth -
|
|
38
|
+
? Math.min(containerWidth - akEditorGutterPaddingDynamic() * 2, akEditorFullWidthLayoutWidth)
|
|
39
39
|
: akEditorFullWidthLayoutWidth;
|
|
40
40
|
}
|
|
41
41
|
|