Linkify URLs in messages

This commit is contained in:
khlieng 2015-02-17 01:27:02 +01:00
parent b06cfafe94
commit 9e301843d2
4 changed files with 9 additions and 6 deletions

View File

@ -88,9 +88,9 @@ gulp.task('gzip:watch', function() {
});
gulp.task('watch', ['default'], function() {
gulp.watch('./dist/*.{html,css,js}', ['gzip:watch'])
gulp.watch('./dist/**/*.{html,css,js}', ['gzip:watch'])
gulp.watch('./src/*.html', ['html']);
gulp.watch('./src/*.css', ['css']);
gulp.watch('./src/css/*.css', ['css']);
return js(true);
});

View File

@ -24,6 +24,7 @@
"reflux": "0.2.5",
"react-router": "0.12.0",
"react": "0.12.2",
"react-infinite": "0.2.3"
"react-infinite": "0.2.3",
"autolinker": "~0.15.2"
}
}

View File

@ -216,7 +216,7 @@ i[class^="icon-"]:before, i[class*=" icon-"]:before {
.messagebox > div {
padding: 10px 15px;
overflow: auto !important;
overflow-y: auto !important;
}
.message {
@ -266,6 +266,7 @@ i[class^="icon-"]:before, i[class*=" icon-"]:before {
}
.userlist > div {
overflow-y: auto !important;
padding: 10px 0px;
}

View File

@ -2,6 +2,7 @@ var React = require('react');
var Reflux = require('reflux');
var _ = require('lodash');
var Infinite = require('react-infinite');
var Autolinker = require('autolinker');
var util = require('../util');
var messageLineStore = require('../stores/messageLine');
@ -84,7 +85,7 @@ var MessageBox = React.createClass({
}
var lines = _.map(this.state.lines, function(line) {
return <p className="message">{line}</p>;
return <p className="message" dangerouslySetInnerHTML={{ __html: Autolinker.link(line) }}></p>;
});
if (lines.length !== 1) {