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