Add Edit Rich Text functionality to table view (#11390)
Fixes https://github.com/twentyhq/core-team-issues/issues/729 [recording.webm](https://github.com/user-attachments/assets/ea95d67b-64a3-4fef-91ed-b06318099a78) --------- Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
@ -0,0 +1,33 @@
|
||||
import { ActivityRichTextEditor } from '@/activities/components/ActivityRichTextEditor';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
import styled from '@emotion/styled';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { viewableRichTextComponentState } from '../states/viewableRichTextComponentState';
|
||||
|
||||
const StyledContainer = styled.div`
|
||||
margin: ${({ theme }) => theme.spacing(4)} ${({ theme }) => theme.spacing(-2)};
|
||||
`;
|
||||
|
||||
export const CommandMenuEditRichTextPage = () => {
|
||||
const { activityId, activityObjectNameSingular } = useRecoilValue(
|
||||
viewableRichTextComponentState,
|
||||
);
|
||||
|
||||
if (
|
||||
activityObjectNameSingular !== CoreObjectNameSingular.Note &&
|
||||
activityObjectNameSingular !== CoreObjectNameSingular.Task
|
||||
) {
|
||||
throw new Error(
|
||||
`Invalid activity object name singular: ${activityObjectNameSingular}`,
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledContainer>
|
||||
<ActivityRichTextEditor
|
||||
activityId={activityId}
|
||||
activityObjectNameSingular={activityObjectNameSingular}
|
||||
/>
|
||||
</StyledContainer>
|
||||
);
|
||||
};
|
||||
@ -0,0 +1,12 @@
|
||||
import { atom, RecoilState } from 'recoil';
|
||||
|
||||
export const viewableRichTextComponentState: RecoilState<{
|
||||
activityId: string;
|
||||
activityObjectNameSingular: string;
|
||||
}> = atom({
|
||||
key: 'viewableRichTextComponentState',
|
||||
default: {
|
||||
activityId: '',
|
||||
activityObjectNameSingular: '',
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user