From b0adb1945fdc5d2ab4aecc165c8e022064c7f2ba Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 24 Dec 2015 00:12:37 +0000 Subject: [PATCH] Expose onHighlightClick on the event tiles --- src/components/views/messages/MessageEvent.js | 3 +- src/components/views/messages/TextualBody.js | 3 +- src/components/views/rooms/EventTile.js | 29 ++++++++++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/components/views/messages/MessageEvent.js b/src/components/views/messages/MessageEvent.js index 164bf11930..63e77e9652 100644 --- a/src/components/views/messages/MessageEvent.js +++ b/src/components/views/messages/MessageEvent.js @@ -47,6 +47,7 @@ module.exports = React.createClass({ TileType = tileTypes[msgtype]; } - return ; + return ; }, }); diff --git a/src/components/views/messages/TextualBody.js b/src/components/views/messages/TextualBody.js index 7134d5faf4..ac9fcd2e5e 100644 --- a/src/components/views/messages/TextualBody.js +++ b/src/components/views/messages/TextualBody.js @@ -49,7 +49,8 @@ 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": diff --git a/src/components/views/rooms/EventTile.js b/src/components/views/rooms/EventTile.js index 0b26000207..94a144ef55 100644 --- a/src/components/views/rooms/EventTile.js +++ b/src/components/views/rooms/EventTile.js @@ -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}; }, @@ -280,7 +306,8 @@ module.exports = React.createClass({ { avatar } { sender }
- +
);