feat: intègre éditeur riche pour articles uniquement
This commit is contained in:
@@ -8,6 +8,7 @@ import DialogActions from '@mui/material/DialogActions'
|
||||
import DialogContent from '@mui/material/DialogContent'
|
||||
import DialogContentText from '@mui/material/DialogContentText'
|
||||
import DialogTitle from '@mui/material/DialogTitle'
|
||||
import RichTextEditor from '../rich-text-editor/index.js'
|
||||
import SessionExpired from '../session/session-expired.js'
|
||||
import ListItems from './create/list-items.js'
|
||||
|
||||
@@ -24,7 +25,8 @@ export default function FormHandler({
|
||||
handleFormSubmit,
|
||||
countdownRef,
|
||||
setSelectValue,
|
||||
contenu
|
||||
contenu,
|
||||
collection
|
||||
}) {
|
||||
const handleClose = () => {
|
||||
setIsOpen(false)
|
||||
@@ -52,18 +54,28 @@ export default function FormHandler({
|
||||
setSelectValue={setSelectValue}
|
||||
/>
|
||||
)}
|
||||
{hasMultiline && collection === 'articles' ? (
|
||||
<RichTextEditor
|
||||
isRequired
|
||||
label={label}
|
||||
name='content'
|
||||
placeholder={`Rédigez ${label.toLowerCase()}...`}
|
||||
value={contenu || ''}
|
||||
/>
|
||||
) : (
|
||||
<TextField
|
||||
autoFocus
|
||||
required
|
||||
fullWidth
|
||||
defaultValue={contenu}
|
||||
multiline={Boolean(hasMultiline)}
|
||||
rows={hasMultiline ? 4 : 1}
|
||||
mt={2}
|
||||
rows={4}
|
||||
id='content'
|
||||
name='content'
|
||||
label={label}
|
||||
/>
|
||||
)}
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button variant='contained' color='error' onClick={handleClose}>Annuler</Button>
|
||||
@@ -88,5 +100,6 @@ FormHandler.propTypes = {
|
||||
label: PropTypes.string.isRequired,
|
||||
hasMultiline: PropTypes.bool,
|
||||
listItems: PropTypes.array.isRequired,
|
||||
contenu: PropTypes.string
|
||||
contenu: PropTypes.string,
|
||||
collection: PropTypes.string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user