mirror of
https://github.com/element-hq/element-web
synced 2024-11-26 19:26:04 +03:00
click on nicks to insert them into the MessageComposer
This commit is contained in:
parent
a13513935b
commit
c7ffb59374
2 changed files with 20 additions and 4 deletions
|
@ -268,10 +268,17 @@ module.exports = React.createClass({
|
|||
this.readAvatarNode = ReactDom.findDOMNode(node);
|
||||
},
|
||||
|
||||
onMemberAvatarClicked: function(sender) {
|
||||
onMemberAvatarClick: function(event) {
|
||||
dispatcher.dispatch({
|
||||
action: 'view_user',
|
||||
member: sender
|
||||
member: this.props.mxEvent.sender,
|
||||
});
|
||||
},
|
||||
|
||||
onSenderProfileClick: function(event) {
|
||||
dispatcher.dispatch({
|
||||
action: 'insert_displayname',
|
||||
displayname: this.props.mxEvent.sender.name,
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -318,12 +325,12 @@ module.exports = React.createClass({
|
|||
avatar = (
|
||||
<div className="mx_EventTile_avatar">
|
||||
<MemberAvatar member={this.props.mxEvent.sender} width={24} height={24}
|
||||
onClick={ this.onMemberAvatarClicked.bind(this, this.props.mxEvent.sender) } />
|
||||
onClick={ this.onMemberAvatarClick } />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (EventTileType.needsSenderProfile()) {
|
||||
sender = <SenderProfile mxEvent={this.props.mxEvent} aux={aux} />;
|
||||
sender = <SenderProfile onClick={ this.onSenderProfileClick } mxEvent={this.props.mxEvent} aux={aux} />;
|
||||
}
|
||||
}
|
||||
return (
|
||||
|
|
|
@ -196,6 +196,15 @@ module.exports = React.createClass({
|
|||
case 'focus_composer':
|
||||
this.refs.textarea.focus();
|
||||
break;
|
||||
case 'insert_displayname':
|
||||
if (this.refs.textarea.value) {
|
||||
this.refs.textarea.value =
|
||||
this.refs.textarea.value.replace(/( ?)$/, " " + payload.displayname);
|
||||
}
|
||||
else {
|
||||
this.refs.textarea.value = payload.displayname + ": ";
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue