From a00510c1cad351ef19be67a5bd9d0927616410c8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Thu, 9 Jul 2015 15:41:19 +0100 Subject: [PATCH] Linkify URLs --- package.json | 3 ++- skins/base/views/molecules/MNoticeTile.js | 2 +- skins/base/views/molecules/MTextTile.js | 2 +- src/controllers/molecules/MNoticeTile.js | 5 +++++ src/controllers/molecules/MTextTile.js | 5 +++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e5143b0b..ea7d2bf9 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "matrix-js-sdk": "0.1.1", "q": "^1.4.1", "react": "^0.13.0", - "react-loader": "^1.4.0" + "react-loader": "^1.4.0", + "linkifyjs": "^2.0.0-beta.4" }, "devDependencies": { "catw": "^1.0.1", diff --git a/skins/base/views/molecules/MNoticeTile.js b/skins/base/views/molecules/MNoticeTile.js index 1ea72a8d..337b99fd 100644 --- a/skins/base/views/molecules/MNoticeTile.js +++ b/skins/base/views/molecules/MNoticeTile.js @@ -27,7 +27,7 @@ module.exports = React.createClass({ render: function() { var content = this.props.mxEvent.getContent(); return ( - + {content.body} ); diff --git a/skins/base/views/molecules/MTextTile.js b/skins/base/views/molecules/MTextTile.js index 8b36f7bb..eb8f2a73 100644 --- a/skins/base/views/molecules/MTextTile.js +++ b/skins/base/views/molecules/MTextTile.js @@ -27,7 +27,7 @@ module.exports = React.createClass({ render: function() { var content = this.props.mxEvent.getContent(); return ( - + {content.body} ); diff --git a/src/controllers/molecules/MNoticeTile.js b/src/controllers/molecules/MNoticeTile.js index d0977e00..99bd511a 100644 --- a/src/controllers/molecules/MNoticeTile.js +++ b/src/controllers/molecules/MNoticeTile.js @@ -16,5 +16,10 @@ limitations under the License. 'use strict'; +var linkifyElement = require('linkifyjs/element'); + module.exports = { + componentDidMount: function() { + linkifyElement(this.refs.content.getDOMNode()); + } }; diff --git a/src/controllers/molecules/MTextTile.js b/src/controllers/molecules/MTextTile.js index 8aa688b2..3ecc2c82 100644 --- a/src/controllers/molecules/MTextTile.js +++ b/src/controllers/molecules/MTextTile.js @@ -16,6 +16,11 @@ limitations under the License. 'use strict'; +var linkifyElement = require('linkifyjs/element'); + module.exports = { + componentDidMount: function() { + linkifyElement(this.refs.content.getDOMNode()); + } };