Compare commits
2 commits
develop
...
feature/em
Author | SHA1 | Date | |
---|---|---|---|
|
daab6ef78b | ||
|
492a41f19b |
3 changed files with 23 additions and 12 deletions
|
@ -174,7 +174,10 @@ const Util = {
|
|||
text = text.replace(new RegExp(escapeRegExp(emoji.colons), 'g'), emoji.native)
|
||||
})
|
||||
if (opts.emoticons) {
|
||||
Object.keys(emojiIndex.emoticons).forEach(emoticon => {
|
||||
const emoticons = Object.assign({}, emojiIndex.emoticons, {
|
||||
':D': ':grin:'
|
||||
})
|
||||
Object.keys(emoticons).forEach(emoticon => {
|
||||
const key = emojiIndex.emoticons[emoticon]
|
||||
const emoji = emojiIndex.emojis[key]
|
||||
text = text.replace(new RegExp(escapeRegExp(emoticon), 'g'), emoji.native)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React, { PropTypes, Component } from 'react'
|
||||
import { Picker } from 'emoji-mart'
|
||||
import { Emoji, Picker } from 'emoji-mart'
|
||||
import Util from '../../Metamaps/Util'
|
||||
|
||||
class NewMessage extends Component {
|
||||
|
@ -26,6 +26,7 @@ class NewMessage extends Component {
|
|||
}})
|
||||
|
||||
this.setState({ showEmojiPicker: false })
|
||||
this.props.focusMessageInput()
|
||||
}
|
||||
|
||||
render = () => {
|
||||
|
@ -41,7 +42,7 @@ class NewMessage extends Component {
|
|||
title="Emoji"
|
||||
/>
|
||||
<div className="extra-message-options">
|
||||
<span className="emoji-picker-button" onClick={this.toggleEmojiPicker}>🙃</span>
|
||||
<span className="emoji-picker-button" onClick={this.toggleEmojiPicker}><Emoji size={24} emoji="upside_down_face" /></span>
|
||||
</div>
|
||||
<textarea value={this.textAreaValue()}
|
||||
onChange={this.props.handleChange}
|
||||
|
@ -55,6 +56,7 @@ class NewMessage extends Component {
|
|||
NewMessage.propTypes = {
|
||||
messageText: PropTypes.string,
|
||||
handleChange: PropTypes.func,
|
||||
focusMessageInput: PropTypes.func,
|
||||
textAreaProps: PropTypes.shape({
|
||||
className: PropTypes.string,
|
||||
ref: PropTypes.func,
|
||||
|
|
|
@ -102,6 +102,11 @@ class MapChat extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
focusMessageInput = () => {
|
||||
if (!this.messageInput) return
|
||||
this.messageInput.focus()
|
||||
}
|
||||
|
||||
render = () => {
|
||||
const rightOffset = this.state.open ? '0' : '-300px'
|
||||
const { conversationLive, isParticipating, participants, messages, inviteACall, inviteToJoin } = this.props
|
||||
|
@ -145,7 +150,10 @@ class MapChat extends Component {
|
|||
<div className="chat-messages" ref={div => { this.messagesDiv = div }}>
|
||||
{makeList(messages)}
|
||||
</div>
|
||||
<NewMessage textAreaProps={{
|
||||
<NewMessage messageText={this.state.messageText}
|
||||
focusMessageInput={this.focusMessageInput}
|
||||
handleChange={this.handleChange('messageText')}
|
||||
textAreaProps={{
|
||||
className: 'chat-input',
|
||||
ref: textarea => { this.messageInput = textarea },
|
||||
placeholder: 'Send a message...',
|
||||
|
@ -153,8 +161,6 @@ class MapChat extends Component {
|
|||
onFocus: this.props.inputFocus,
|
||||
onBlur: this.props.inputBlur
|
||||
}}
|
||||
handleChange={this.handleChange('messageText')}
|
||||
messageText={this.state.messageText}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue