Linkify urls in playlist comments
This commit is contained in:
@@ -33,7 +33,7 @@ import {
|
|||||||
import config from '../config'
|
import config from '../config'
|
||||||
import { intersperse } from '../utils'
|
import { intersperse } from '../utils'
|
||||||
import AlbumExternalLinks from './AlbumExternalLinks'
|
import AlbumExternalLinks from './AlbumExternalLinks'
|
||||||
import AnchorMe from '../common/AnchorMe'
|
import AnchorMe from '../common/Linkify'
|
||||||
|
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
(theme) => ({
|
(theme) => ({
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const useStyles = makeStyles(
|
|||||||
{ name: 'RaLink' }
|
{ name: 'RaLink' }
|
||||||
)
|
)
|
||||||
|
|
||||||
const AnchorMe = ({ text, ...rest }) => {
|
const Linkify = ({ text, ...rest }) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
const linkify = useCallback((text) => {
|
const linkify = useCallback((text) => {
|
||||||
const urlRegex =
|
const urlRegex =
|
||||||
@@ -66,8 +66,8 @@ const AnchorMe = ({ text, ...rest }) => {
|
|||||||
return <>{parsedText}</>
|
return <>{parsedText}</>
|
||||||
}
|
}
|
||||||
|
|
||||||
AnchorMe.propTypes = {
|
Linkify.propTypes = {
|
||||||
text: PropTypes.string,
|
text: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export default React.memo(AnchorMe)
|
export default React.memo(Linkify)
|
||||||
@@ -3,6 +3,7 @@ import { Card, CardContent, Typography } from '@material-ui/core'
|
|||||||
import { makeStyles } from '@material-ui/core/styles'
|
import { makeStyles } from '@material-ui/core/styles'
|
||||||
import { useTranslate } from 'react-admin'
|
import { useTranslate } from 'react-admin'
|
||||||
import { DurationField, SizeField } from '../common'
|
import { DurationField, SizeField } from '../common'
|
||||||
|
import Linkify from '../common/Linkify'
|
||||||
|
|
||||||
const useStyles = makeStyles(
|
const useStyles = makeStyles(
|
||||||
(theme) => ({
|
(theme) => ({
|
||||||
@@ -51,7 +52,9 @@ const PlaylistDetails = (props) => {
|
|||||||
<Typography variant="h5" className={classes.title}>
|
<Typography variant="h5" className={classes.title}>
|
||||||
{record.name || translate('ra.page.loading')}
|
{record.name || translate('ra.page.loading')}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography component="h6">{record.comment}</Typography>
|
<Typography component="h6">
|
||||||
|
<Linkify text={record.comment} />
|
||||||
|
</Typography>
|
||||||
<Typography component="p">
|
<Typography component="p">
|
||||||
{record.songCount ? (
|
{record.songCount ? (
|
||||||
<span>
|
<span>
|
||||||
|
|||||||
Reference in New Issue
Block a user