Merge branch 'develop' into rav/new_search_api

Conflicts:
	src/components/structures/RoomView.js
This commit is contained in:
Richard van der Hoff 2016-01-05 15:38:30 +00:00
commit 583d35e39f
16 changed files with 215 additions and 81 deletions

View file

@ -56,8 +56,9 @@ module.exports = React.createClass({
if (this.props.homeserver) {
if (curr_val == "") {
var self = this;
setTimeout(function() {
target.value = "#:" + this.props.homeserver;
target.value = "#:" + self.props.homeserver;
target.setSelectionRange(1, 1);
}, 0);
} else {

View file

@ -54,8 +54,8 @@ module.exports = React.createClass({
if (httpUrl) {
return (
<span className="mx_MFileTile">
<div className="mx_MImageTile_download">
<span className="mx_MFileBody">
<div className="mx_MImageBody_download">
<a href={cli.mxcUrlToHttp(content.url)} target="_blank">
<img src="img/download.png" width="10" height="12"/>
Download {text}
@ -65,7 +65,7 @@ module.exports = React.createClass({
);
} else {
var extra = text ? ': '+text : '';
return <span className="mx_MFileTile">
return <span className="mx_MFileBody">
Invalid file{extra}
</span>
}

View file

@ -109,14 +109,14 @@ module.exports = React.createClass({
var thumbUrl = this._getThumbUrl();
if (thumbUrl) {
return (
<span className="mx_MImageTile">
<span className="mx_MImageBody">
<a href={cli.mxcUrlToHttp(content.url)} onClick={ this.onClick }>
<img className="mx_MImageTile_thumbnail" src={thumbUrl}
<img className="mx_MImageBody_thumbnail" src={thumbUrl}
alt={content.body} style={imgStyle}
onMouseEnter={this.onImageEnter}
onMouseLeave={this.onImageLeave} />
</a>
<div className="mx_MImageTile_download">
<div className="mx_MImageBody_download">
<a href={cli.mxcUrlToHttp(content.url)} target="_blank">
<img src="img/download.png" width="10" height="12"/>
Download {content.body} ({ content.info && content.info.size ? filesize(content.info.size) : "Unknown size" })
@ -126,13 +126,13 @@ module.exports = React.createClass({
);
} else if (content.body) {
return (
<span className="mx_MImageTile">
<span className="mx_MImageBody">
Image '{content.body}' cannot be displayed.
</span>
);
} else {
return (
<span className="mx_MImageTile">
<span className="mx_MImageBody">
This image cannot be displayed.
</span>
);

View file

@ -70,8 +70,8 @@ module.exports = React.createClass({
}
return (
<span className="mx_MVideoTile">
<video className="mx_MVideoTile" src={cli.mxcUrlToHttp(content.url)} alt={content.body}
<span className="mx_MVideoBody">
<video className="mx_MVideoBody" src={cli.mxcUrlToHttp(content.url)} alt={content.body}
controls preload={preload} autoPlay="0"
height={height} width={width} poster={poster}>
</video>

View file

@ -47,6 +47,7 @@ module.exports = React.createClass({
TileType = tileTypes[msgtype];
}
return <TileType mxEvent={this.props.mxEvent} highlights={this.props.highlights} />;
return <TileType mxEvent={this.props.mxEvent} highlights={this.props.highlights}
onHighlightClick={this.props.onHighlightClick} />;
},
});

View file

@ -49,25 +49,26 @@ module.exports = React.createClass({
render: function() {
var mxEvent = this.props.mxEvent;
var content = mxEvent.getContent();
var body = HtmlUtils.bodyToHtml(content, this.props.highlights);
var body = HtmlUtils.bodyToHtml(content, this.props.highlights,
{onHighlightClick: this.props.onHighlightClick});
switch (content.msgtype) {
case "m.emote":
var name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
return (
<span ref="content" className="mx_MEmoteTile mx_MessageTile_content">
<span ref="content" className="mx_MEmoteBody mx_EventTile_content">
* { name } { body }
</span>
);
case "m.notice":
return (
<span ref="content" className="mx_MNoticeTile mx_MessageTile_content">
<span ref="content" className="mx_MNoticeBody mx_EventTile_content">
{ body }
</span>
);
default: // including "m.text"
return (
<span ref="content" className="mx_MTextTile mx_MessageTile_content">
<span ref="content" className="mx_MTextBody mx_EventTile_content">
{ body }
</span>
);

View file

@ -34,7 +34,7 @@ module.exports = React.createClass({
if (text == null || text.length == 0) return null;
return (
<div className="mx_EventAsTextTile">
<div className="mx_TextualEvent">
{TextForEvent.textForEvent(this.props.mxEvent)}
</div>
);

View file

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

View file

@ -74,6 +74,32 @@ module.exports = React.createClass({
}
},
propTypes: {
/* the MatrixEvent to show */
mxEvent: React.PropTypes.object.isRequired,
/* true if this is a continuation of the previous event (which has the
* effect of not showing another avatar/displayname
*/
continuation: React.PropTypes.bool,
/* true if this is the last event in the timeline (which has the effect
* of always showing the timestamp)
*/
last: React.PropTypes.bool,
/* true if this is search context (which has the effect of greying out
* the text
*/
contextual: React.PropTypes.bool,
/* a list of words to highlight */
highlights: React.PropTypes.array,
/* a function to be called when the highlight is clicked */
onHighlightClick: React.PropTypes.func,
},
getInitialState: function() {
return {menu: false, allReadAvatars: false};
},
@ -134,6 +160,9 @@ module.exports = React.createClass({
for (var i = 0; i < receipts.length; ++i) {
var member = room.getMember(receipts[i].userId);
if (!member) {
continue;
}
// Using react refs here would mean both getting Velociraptor to expose
// them and making them scoped to the whole RoomView. Not impossible, but
@ -280,7 +309,8 @@ module.exports = React.createClass({
{ avatar }
{ sender }
<div className="mx_EventTile_line">
<EventTileType mxEvent={this.props.mxEvent} highlights={this.props.highlights} />
<EventTileType mxEvent={this.props.mxEvent} highlights={this.props.highlights}
onHighlightClick={this.props.onHighlightClick} />
</div>
</div>
);

View file

@ -254,7 +254,7 @@ module.exports = React.createClass({
} else {
return (
<form onSubmit={this.onPopulateInvite}>
<input className="mx_MemberList_invite" ref="invite" placeholder="Invite another user"/>
<input className="mx_MemberList_invite" ref="invite" placeholder="Invite user (email)"/>
</form>
);
}