1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-08 21:42:24 +03:00

rename searchTerms to highlights, and support highlighting multiple search terms

This commit is contained in:
Matthew Hodgson
2015-11-29 03:22:01 +00:00
parent 3cc1b1ad82
commit 0b483c4707
4 changed files with 74 additions and 31 deletions

View File

@@ -268,7 +268,7 @@ module.exports = React.createClass({
{ avatar }
{ sender }
<div className="mx_EventTile_line">
<EventTileType mxEvent={this.props.mxEvent} searchTerm={this.props.searchTerm} />
<EventTileType mxEvent={this.props.mxEvent} highlights={this.props.highlights} />
</div>
</div>
);

View File

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

View File

@@ -43,13 +43,13 @@ module.exports = React.createClass({
shouldComponentUpdate: function(nextProps) {
// exploit that events are immutable :)
return (nextProps.mxEvent.getId() !== this.props.mxEvent.getId() ||
nextProps.searchTerm !== this.props.searchTerm);
nextProps.highlights !== this.props.highlights);
},
render: function() {
var mxEvent = this.props.mxEvent;
var content = mxEvent.getContent();
var body = HtmlUtils.bodyToHtml(content, this.props.searchTerm);
var body = HtmlUtils.bodyToHtml(content, this.props.highlights);
switch (content.msgtype) {
case "m.emote":