Recognize link in whitin a post
This commit is contained in:
@@ -6,6 +6,10 @@ import { push } from 'react-router-redux'
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { createAction as action } from 'redux-actions'
|
import { createAction as action } from 'redux-actions'
|
||||||
|
import Linkify from 'react-linkify'
|
||||||
|
|
||||||
|
|
||||||
|
// - Material UI
|
||||||
import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card'
|
import { Card, CardActions, CardHeader, CardMedia, CardTitle, CardText } from 'material-ui/Card'
|
||||||
import FloatingActionButton from 'material-ui/FloatingActionButton'
|
import FloatingActionButton from 'material-ui/FloatingActionButton'
|
||||||
import SvgShare from 'material-ui/svg-icons/social/share'
|
import SvgShare from 'material-ui/svg-icons/social/share'
|
||||||
@@ -370,21 +374,24 @@ static propTypes = {
|
|||||||
|
|
||||||
|
|
||||||
<CardText style={styles.postBody}>
|
<CardText style={styles.postBody}>
|
||||||
{reactStringReplace(body,/#(\w+)/g, (match, i) => (
|
<Linkify properties={{target: '_blank', style: {color: 'blue'}}}>
|
||||||
<NavLink
|
{reactStringReplace(body,/#(\w+)/g, (match, i) => (
|
||||||
style={{color:'green'}}
|
<NavLink
|
||||||
key={match + i}
|
style={{color:'green'}}
|
||||||
to={`/tag/${match}`}
|
key={match + i}
|
||||||
onClick ={evt => {
|
to={`/tag/${match}`}
|
||||||
evt.preventDefault()
|
onClick ={evt => {
|
||||||
goTo(`/tag/${match}`)
|
evt.preventDefault()
|
||||||
setHomeTitle(`#${match}`)
|
goTo(`/tag/${match}`)
|
||||||
}}
|
setHomeTitle(`#${match}`)
|
||||||
>
|
}}
|
||||||
#{match}
|
>
|
||||||
</NavLink>
|
#{match}
|
||||||
|
|
||||||
|
</NavLink>
|
||||||
|
|
||||||
))}
|
))}
|
||||||
|
</Linkify>
|
||||||
</CardText>
|
</CardText>
|
||||||
<CardActions>
|
<CardActions>
|
||||||
<div style={{ margin: "16px 8px", display: 'flex', justifyContent: 'space-between' }}>
|
<div style={{ margin: "16px 8px", display: 'flex', justifyContent: 'space-between' }}>
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
"react-avatar-editor": "^9.1.1",
|
"react-avatar-editor": "^9.1.1",
|
||||||
"react-dom": "^15.4.2",
|
"react-dom": "^15.4.2",
|
||||||
"react-event-listener": "^0.4.5",
|
"react-event-listener": "^0.4.5",
|
||||||
|
"react-linkify": "^0.2.1",
|
||||||
"react-parallax": "^1.4.1",
|
"react-parallax": "^1.4.1",
|
||||||
"react-redux": "^5.0.4",
|
"react-redux": "^5.0.4",
|
||||||
"react-router": "^4.1.1 ",
|
"react-router": "^4.1.1 ",
|
||||||
|
|||||||
Reference in New Issue
Block a user