File size: 952 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
import { Paper } from '@mui/material';
import type { EditorProps } from '@react-page/editor';
import Editor from '@react-page/editor';
import React from 'react';
import { Labeled, useInput } from 'react-admin';
export type RaReactPageInputProps = {
label?: string;
source: string;
style?: React.CSSProperties;
} & EditorProps;
const RaReactPageInput: React.FC<RaReactPageInputProps> = ({
label = 'Content',
source,
style,
...editorProps
}) => {
const {
input: { value, onChange },
} = useInput({ source });
return (
<Labeled label={label} source={source} fullWidth>
<>
<Paper
elevation={5}
style={{
overflow: 'visible',
padding: 16,
marginRight: 64,
...style,
}}
>
<Editor value={value} onChange={onChange} {...editorProps} />
</Paper>
</>
</Labeled>
);
};
export default RaReactPageInput;
|