@atlaskit/editor-plugin-table 10.4.4 → 10.4.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.
- package/CHANGELOG.md +18 -0
- package/afm-cc/tsconfig.json +3 -0
- package/afm-jira/tsconfig.json +3 -0
- package/afm-post-office/tsconfig.json +3 -0
- package/dist/cjs/nodeviews/TableRow.js +1 -1
- package/dist/cjs/pm-plugins/commands/go-to-next-cell.js +96 -6
- package/dist/cjs/pm-plugins/keymap.js +9 -0
- package/dist/cjs/ui/toolbar.js +54 -7
- package/dist/es2019/nodeviews/TableRow.js +1 -1
- package/dist/es2019/pm-plugins/commands/go-to-next-cell.js +97 -6
- package/dist/es2019/pm-plugins/keymap.js +10 -1
- package/dist/es2019/ui/toolbar.js +54 -7
- package/dist/esm/nodeviews/TableRow.js +1 -1
- package/dist/esm/pm-plugins/commands/go-to-next-cell.js +96 -6
- package/dist/esm/pm-plugins/keymap.js +10 -1
- package/dist/esm/ui/toolbar.js +54 -7
- package/dist/types/pm-plugins/commands/go-to-next-cell.d.ts +6 -0
- package/dist/types/tablePluginType.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/commands/go-to-next-cell.d.ts +6 -0
- package/dist/types-ts4.5/tablePluginType.d.ts +3 -1
- package/package.json +4 -6
- package/src/nodeviews/TableRow.ts +1 -2
- package/src/nodeviews/TableStickyScrollbar.ts +2 -3
- package/src/pm-plugins/commands/go-to-next-cell.ts +129 -4
- package/src/pm-plugins/keymap.ts +19 -0
- package/src/tablePluginType.ts +2 -0
- package/src/ui/toolbar.tsx +76 -12
- package/tsconfig.app.json +3 -0
package/src/ui/toolbar.tsx
CHANGED
|
@@ -8,11 +8,12 @@ import { jsx } from '@emotion/react';
|
|
|
8
8
|
import { TableSortOrder as SortOrder } from '@atlaskit/custom-steps';
|
|
9
9
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
10
10
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
11
|
+
import { DropdownMenuExtensionItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
11
12
|
import { addColumnAfter, addRowAfter, backspace, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
12
13
|
import commonMessages, { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
14
|
+
import { isSelectionTableNestedInTable } from '@atlaskit/editor-common/nesting';
|
|
13
15
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
14
16
|
import type {
|
|
15
|
-
typeOption,
|
|
16
17
|
Command,
|
|
17
18
|
CommandDispatch,
|
|
18
19
|
ConfirmDialogOptions,
|
|
@@ -24,6 +25,7 @@ import type {
|
|
|
24
25
|
GetEditorContainerWidth,
|
|
25
26
|
GetEditorFeatureFlags,
|
|
26
27
|
Icon,
|
|
28
|
+
typeOption,
|
|
27
29
|
} from '@atlaskit/editor-common/types';
|
|
28
30
|
import { cellBackgroundColorPalette, DEFAULT_BORDER_COLOR } from '@atlaskit/editor-common/ui-color';
|
|
29
31
|
import {
|
|
@@ -48,6 +50,7 @@ import {
|
|
|
48
50
|
} from '@atlaskit/editor-tables/utils';
|
|
49
51
|
import AlignImageCenterIcon from '@atlaskit/icon/core/align-image-center';
|
|
50
52
|
import AlignImageLeftIcon from '@atlaskit/icon/core/align-image-left';
|
|
53
|
+
import CopyIcon from '@atlaskit/icon/core/copy';
|
|
51
54
|
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
52
55
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
53
56
|
import TableColumnsDistributeIcon from '@atlaskit/icon/core/table-columns-distribute';
|
|
@@ -632,6 +635,9 @@ export const getToolbarConfig =
|
|
|
632
635
|
],
|
|
633
636
|
};
|
|
634
637
|
|
|
638
|
+
const isNestedTable =
|
|
639
|
+
fg('platform_editor_use_nested_table_pm_nodes') && isSelectionTableNestedInTable(state);
|
|
640
|
+
|
|
635
641
|
return {
|
|
636
642
|
title: 'Table floating controls',
|
|
637
643
|
getDomRef,
|
|
@@ -647,18 +653,76 @@ export const getToolbarConfig =
|
|
|
647
653
|
...cellItems,
|
|
648
654
|
...columnSettingsItems,
|
|
649
655
|
...colorPicker,
|
|
650
|
-
// TODO: ED-26961 - editor controls to move to overflow menu
|
|
651
|
-
{
|
|
652
|
-
type: 'extensions-placeholder',
|
|
653
|
-
separator: 'end',
|
|
654
|
-
},
|
|
655
656
|
...((editorExperiment('platform_editor_controls', 'control')
|
|
656
|
-
? ([
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
657
|
+
? ([
|
|
658
|
+
{
|
|
659
|
+
type: 'extensions-placeholder',
|
|
660
|
+
separator: 'end',
|
|
661
|
+
},
|
|
662
|
+
copyButton,
|
|
663
|
+
{ type: 'separator' },
|
|
664
|
+
deleteButton,
|
|
665
|
+
] as Array<FloatingToolbarItem<Command>>)
|
|
666
|
+
: [
|
|
667
|
+
{
|
|
668
|
+
type: 'overflow-dropdown',
|
|
669
|
+
dropdownWidth: 220,
|
|
670
|
+
options: [
|
|
671
|
+
{
|
|
672
|
+
type: 'custom',
|
|
673
|
+
fallback: [],
|
|
674
|
+
render: (editorView, dropdownOptions) => {
|
|
675
|
+
if (!editorView) {
|
|
676
|
+
return null;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
const extensionState = api?.extension?.sharedState?.currentState();
|
|
680
|
+
const extensionApi = api?.extension?.actions.api();
|
|
681
|
+
|
|
682
|
+
if (!extensionApi || !extensionState?.extensionProvider) {
|
|
683
|
+
return null;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
return (
|
|
687
|
+
<DropdownMenuExtensionItems
|
|
688
|
+
node={tableObject.node}
|
|
689
|
+
editorView={editorView}
|
|
690
|
+
extension={{
|
|
691
|
+
extensionProvider: extensionState?.extensionProvider
|
|
692
|
+
? Promise.resolve(extensionState.extensionProvider)
|
|
693
|
+
: undefined,
|
|
694
|
+
extensionApi: api?.extension?.actions.api(),
|
|
695
|
+
}}
|
|
696
|
+
dropdownOptions={dropdownOptions}
|
|
697
|
+
disabled={(key: string) => {
|
|
698
|
+
return (
|
|
699
|
+
isNestedTable &&
|
|
700
|
+
['referentiality:connections', 'chart:insert-chart'].includes(key)
|
|
701
|
+
);
|
|
702
|
+
}}
|
|
703
|
+
/>
|
|
704
|
+
);
|
|
705
|
+
},
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
709
|
+
onClick: () => {
|
|
710
|
+
api?.core?.actions.execute(
|
|
711
|
+
// @ts-ignore
|
|
712
|
+
api?.floatingToolbar?.commands.copyNode(nodeType),
|
|
713
|
+
);
|
|
714
|
+
return true;
|
|
715
|
+
},
|
|
716
|
+
icon: <CopyIcon label={intl.formatMessage(commonMessages.copyToClipboard)} />,
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
title: intl.formatMessage(commonMessages.delete),
|
|
720
|
+
onClick: deleteTableWithAnalytics(editorAnalyticsAPI),
|
|
721
|
+
icon: <DeleteIcon label={intl.formatMessage(commonMessages.delete)} />,
|
|
722
|
+
},
|
|
723
|
+
],
|
|
724
|
+
},
|
|
725
|
+
]) as Array<FloatingToolbarItem<Command>>),
|
|
662
726
|
],
|
|
663
727
|
scrollable: true,
|
|
664
728
|
};
|