Rev 2764 | AutorÃa | 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 'ckeditor5.css'import ClassicEditor from '../ckeditor/ClassicEditor'import FormErrorFeedback from './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: { name, value, onChange, disabled } }) => (<>{label ? <FormLabel htmlFor={id}>{label}</FormLabel> : null}<CKEditoreditor={ClassicEditor}onReady={onReady}data={value}onChange={(event, editor) => onChange(editor.getData())}id={id}disabled={disabled}/>{error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}</>)}/>)}return (<>{label ? <FormLabel htmlFor={id}>{label}</FormLabel> : null}<CKEditoreditor={ClassicEditor}onReady={onReady}data={defaultValue}onChange={(event, editor) => onChange(editor.getData())}id={id}disabled={disabled}/>{error ? <FormErrorFeedback>{error}</FormErrorFeedback> : null}</>)}