mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
allow single/multiselect to be copy/pasted
This commit is contained in:
@@ -25,6 +25,8 @@ const SUPPORTED_TYPES = new Set([
|
||||
FieldType.richText,
|
||||
FieldType.url,
|
||||
FieldType.json,
|
||||
FieldType.singleSelect,
|
||||
FieldType.multiSelect,
|
||||
]);
|
||||
|
||||
export function useMenuAction(
|
||||
@@ -136,14 +138,22 @@ export function useMenuAction(
|
||||
|
||||
const checkEnabled = useCallback(
|
||||
(func: Function) => {
|
||||
if (!selectedCol) {
|
||||
return function () {
|
||||
enqueueSnackbar(`No selected cell`, {
|
||||
variant: "error",
|
||||
});
|
||||
};
|
||||
}
|
||||
const fieldType = getFieldType(selectedCol);
|
||||
return function () {
|
||||
if (SUPPORTED_TYPES.has(selectedCol?.type)) {
|
||||
if (SUPPORTED_TYPES.has(fieldType)) {
|
||||
return func();
|
||||
} else {
|
||||
enqueueSnackbar(
|
||||
`${selectedCol?.type} field cannot be copied using keyboard shortcut`,
|
||||
`${fieldType} field cannot be copied using keyboard shortcut`,
|
||||
{
|
||||
variant: "info",
|
||||
variant: "error",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ export const config: IFieldConfig = {
|
||||
type: FieldType.singleSelect,
|
||||
name: "Single Select",
|
||||
group: "Select",
|
||||
dataType: "string | null",
|
||||
dataType: "string",
|
||||
initialValue: null,
|
||||
initializable: true,
|
||||
icon: <SingleSelectIcon />,
|
||||
|
||||
Reference in New Issue
Block a user