Rev 3475 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react';import { Controller, useFormContext } from 'react-hook-form';import { FormControl, FormLabel, Typography } from '@mui/material';import { CKEditor } from '@ckeditor/ckeditor5-react';import Editor from '@components/common/ckeditor/ClassicEditor';export function FormRichEditor({ label = '', name = '', disabled, rules, onReady = () => {} }) {const { control } = useFormContext();return (<Controllername={name}control={control}disabled={disabled}rules={rules}render={({ field: { value, onChange, disabled }, fieldState: { error } }) => (<FormControl variant='standard' fullWidth>{label && <FormLabel>{label}</FormLabel>}<CKEditoreditor={Editor}onReady={onReady}data={value}onChange={(event, editor) => onChange(editor.getData())}disabled={disabled}/>{error && (<Typography sx={{ color: 'red', fontSize: '0.75rem' }}>{error.message}</Typography>)}</FormControl>)}/>);}