2025-04-01 10:38:02 +09:00

19 lines
591 B
TypeScript

import { useMemo } from 'react';
import { EditableDashboardElement } from '../scene/types/EditableDashboardElement';
import { MultiSelectedEditableDashboardElement } from '../scene/types/MultiSelectedEditableDashboardElement';
import { ElementSelection } from './ElementSelection';
export function useEditableElement(
selection: ElementSelection | undefined
): EditableDashboardElement | MultiSelectedEditableDashboardElement | undefined {
return useMemo(() => {
if (!selection) {
return undefined;
}
return selection.createSelectionElement();
}, [selection]);
}