Linkify URLs

This commit is contained in:
David Baker 2015-07-09 15:41:19 +01:00
parent 0daab63b4a
commit a00510c1ca
5 changed files with 14 additions and 3 deletions

View file

@ -26,7 +26,8 @@
"matrix-js-sdk": "0.1.1", "matrix-js-sdk": "0.1.1",
"q": "^1.4.1", "q": "^1.4.1",
"react": "^0.13.0", "react": "^0.13.0",
"react-loader": "^1.4.0" "react-loader": "^1.4.0",
"linkifyjs": "^2.0.0-beta.4"
}, },
"devDependencies": { "devDependencies": {
"catw": "^1.0.1", "catw": "^1.0.1",

View file

@ -27,7 +27,7 @@ module.exports = React.createClass({
render: function() { render: function() {
var content = this.props.mxEvent.getContent(); var content = this.props.mxEvent.getContent();
return ( return (
<span className="mx_MNoticeTile mx_messageTileType"> <span ref="content" className="mx_MNoticeTile mx_messageTileType">
{content.body} {content.body}
</span> </span>
); );

View file

@ -27,7 +27,7 @@ module.exports = React.createClass({
render: function() { render: function() {
var content = this.props.mxEvent.getContent(); var content = this.props.mxEvent.getContent();
return ( return (
<span className="mx_MTextTile mx_messageTileType"> <span ref="content" className="mx_MTextTile mx_messageTileType">
{content.body} {content.body}
</span> </span>
); );

View file

@ -16,5 +16,10 @@ limitations under the License.
'use strict'; 'use strict';
var linkifyElement = require('linkifyjs/element');
module.exports = { module.exports = {
componentDidMount: function() {
linkifyElement(this.refs.content.getDOMNode());
}
}; };

View file

@ -16,6 +16,11 @@ limitations under the License.
'use strict'; 'use strict';
var linkifyElement = require('linkifyjs/element');
module.exports = { module.exports = {
componentDidMount: function() {
linkifyElement(this.refs.content.getDOMNode());
}
}; };