Rev 3269 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
import React from 'react';import { Controller } from 'react-hook-form';import { FormLabel } from '@mui/material';import { CKEditor } from '@ckeditor/ckeditor5-react';import ClassicEditor from './ClassicEditor';import FormErrorFeedback from '@components/UI/form/FormErrorFeedback';export default function Ckeditor({id = '',label = '',name = '',defaultValue = '',onChange = () => '',onReady = () => {},rules,error,control,disabled}) {if (control) {return (<Controllername={name}control={control}defaultValue={defaultValue}rules={rules}render={({ field: { value, onChange, disabled } }) => (<>{label && <FormLabel htmlFor={id}>{label}</FormLabel>}<CKEditoreditor={ClassicEditor}onReady={onReady}data={value}onChange={(event, editor) => onChange(editor.getData())}id={id}disabled={disabled}/>{error && <FormErrorFeedback>{error}</FormErrorFeedback>}</>)}/>);}return (<>{label && <FormLabel htmlFor={id}>{label}</FormLabel>}<CKEditoreditor={ClassicEditor}onReady={onReady}data={defaultValue}onChange={(event, editor) => onChange(editor.getData())}id={id}disabled={disabled}/>{error && <FormErrorFeedback>{error}</FormErrorFeedback>}</>);}