Merge pull request #73 from matrix-org/rav/on_highlight_click
Expose onHighlightClick on the event tiles
This commit is contained in:
commit
722c7033bc
3 changed files with 32 additions and 3 deletions
|
@ -47,6 +47,7 @@ module.exports = React.createClass({
|
||||||
TileType = tileTypes[msgtype];
|
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} />;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,7 +49,8 @@ module.exports = React.createClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
var mxEvent = this.props.mxEvent;
|
var mxEvent = this.props.mxEvent;
|
||||||
var content = mxEvent.getContent();
|
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) {
|
switch (content.msgtype) {
|
||||||
case "m.emote":
|
case "m.emote":
|
||||||
|
|
|
@ -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() {
|
getInitialState: function() {
|
||||||
return {menu: false, allReadAvatars: false};
|
return {menu: false, allReadAvatars: false};
|
||||||
},
|
},
|
||||||
|
@ -280,7 +306,8 @@ module.exports = React.createClass({
|
||||||
{ avatar }
|
{ avatar }
|
||||||
{ sender }
|
{ sender }
|
||||||
<div className="mx_EventTile_line">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue