Click emote sender -> insert display name into composer
Also, fix the imports TextualBody.
This commit is contained in:
parent
880a48494b
commit
6c09a08a7d
1 changed files with 30 additions and 12 deletions
|
@ -16,17 +16,18 @@ limitations under the License.
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var React = require('react');
|
import React from 'react';
|
||||||
var ReactDOM = require('react-dom');
|
import ReactDOM from 'react-dom';
|
||||||
var highlight = require('highlight.js');
|
import highlight from 'highlight.js';
|
||||||
var HtmlUtils = require('../../../HtmlUtils');
|
import * as HtmlUtils from '../../../HtmlUtils';
|
||||||
var linkify = require('linkifyjs');
|
import * as linkify from 'linkifyjs';
|
||||||
var linkifyElement = require('linkifyjs/element');
|
import linkifyElement from 'linkifyjs/element';
|
||||||
var linkifyMatrix = require('../../../linkify-matrix');
|
import linkifyMatrix from '../../../linkify-matrix';
|
||||||
var sdk = require('../../../index');
|
import sdk from '../../../index';
|
||||||
var ScalarAuthClient = require("../../../ScalarAuthClient");
|
import ScalarAuthClient from '../../../ScalarAuthClient';
|
||||||
var Modal = require("../../../Modal");
|
import Modal from '../../../Modal';
|
||||||
var SdkConfig = require('../../../SdkConfig');
|
import SdkConfig from '../../../SdkConfig';
|
||||||
|
import dis from '../../../dispatcher';
|
||||||
|
|
||||||
linkifyMatrix(linkify);
|
linkifyMatrix(linkify);
|
||||||
|
|
||||||
|
@ -187,6 +188,15 @@ module.exports = React.createClass({
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onEmoteSenderClick: function(event) {
|
||||||
|
const mxEvent = this.props.mxEvent;
|
||||||
|
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
||||||
|
dis.dispatch({
|
||||||
|
action: 'insert_displayname',
|
||||||
|
displayname: name.replace(' (IRC)', ''),
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
getEventTileOps: function() {
|
getEventTileOps: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
return {
|
return {
|
||||||
|
@ -273,7 +283,15 @@ module.exports = React.createClass({
|
||||||
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
const name = mxEvent.sender ? mxEvent.sender.name : mxEvent.getSender();
|
||||||
return (
|
return (
|
||||||
<span ref="content" className="mx_MEmoteBody mx_EventTile_content">
|
<span ref="content" className="mx_MEmoteBody mx_EventTile_content">
|
||||||
* <EmojiText>{name}</EmojiText> { body }
|
*
|
||||||
|
<EmojiText
|
||||||
|
className="mx_MEmoteBody_sender"
|
||||||
|
onClick={this.onEmoteSenderClick}
|
||||||
|
>
|
||||||
|
{name}
|
||||||
|
</EmojiText>
|
||||||
|
|
||||||
|
{ body }
|
||||||
{ widgets }
|
{ widgets }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue