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)
|
text = text.replace(new RegExp(escapeRegExp(emoji.colons), 'g'), emoji.native)
|
||||||
})
|
})
|
||||||
if (opts.emoticons) {
|
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 key = emojiIndex.emoticons[emoticon]
|
||||||
const emoji = emojiIndex.emojis[key]
|
const emoji = emojiIndex.emojis[key]
|
||||||
text = text.replace(new RegExp(escapeRegExp(emoticon), 'g'), emoji.native)
|
text = text.replace(new RegExp(escapeRegExp(emoticon), 'g'), emoji.native)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { PropTypes, Component } from 'react'
|
import React, { PropTypes, Component } from 'react'
|
||||||
import { Picker } from 'emoji-mart'
|
import { Emoji, Picker } from 'emoji-mart'
|
||||||
import Util from '../../Metamaps/Util'
|
import Util from '../../Metamaps/Util'
|
||||||
|
|
||||||
class NewMessage extends Component {
|
class NewMessage extends Component {
|
||||||
|
@ -26,6 +26,7 @@ class NewMessage extends Component {
|
||||||
}})
|
}})
|
||||||
|
|
||||||
this.setState({ showEmojiPicker: false })
|
this.setState({ showEmojiPicker: false })
|
||||||
|
this.props.focusMessageInput()
|
||||||
}
|
}
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
|
@ -41,7 +42,7 @@ class NewMessage extends Component {
|
||||||
title="Emoji"
|
title="Emoji"
|
||||||
/>
|
/>
|
||||||
<div className="extra-message-options">
|
<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>
|
</div>
|
||||||
<textarea value={this.textAreaValue()}
|
<textarea value={this.textAreaValue()}
|
||||||
onChange={this.props.handleChange}
|
onChange={this.props.handleChange}
|
||||||
|
@ -55,6 +56,7 @@ class NewMessage extends Component {
|
||||||
NewMessage.propTypes = {
|
NewMessage.propTypes = {
|
||||||
messageText: PropTypes.string,
|
messageText: PropTypes.string,
|
||||||
handleChange: PropTypes.func,
|
handleChange: PropTypes.func,
|
||||||
|
focusMessageInput: PropTypes.func,
|
||||||
textAreaProps: PropTypes.shape({
|
textAreaProps: PropTypes.shape({
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
ref: PropTypes.func,
|
ref: PropTypes.func,
|
||||||
|
|
|
@ -102,6 +102,11 @@ class MapChat extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focusMessageInput = () => {
|
||||||
|
if (!this.messageInput) return
|
||||||
|
this.messageInput.focus()
|
||||||
|
}
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
const rightOffset = this.state.open ? '0' : '-300px'
|
const rightOffset = this.state.open ? '0' : '-300px'
|
||||||
const { conversationLive, isParticipating, participants, messages, inviteACall, inviteToJoin } = this.props
|
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 }}>
|
<div className="chat-messages" ref={div => { this.messagesDiv = div }}>
|
||||||
{makeList(messages)}
|
{makeList(messages)}
|
||||||
</div>
|
</div>
|
||||||
<NewMessage textAreaProps={{
|
<NewMessage messageText={this.state.messageText}
|
||||||
|
focusMessageInput={this.focusMessageInput}
|
||||||
|
handleChange={this.handleChange('messageText')}
|
||||||
|
textAreaProps={{
|
||||||
className: 'chat-input',
|
className: 'chat-input',
|
||||||
ref: textarea => { this.messageInput = textarea },
|
ref: textarea => { this.messageInput = textarea },
|
||||||
placeholder: 'Send a message...',
|
placeholder: 'Send a message...',
|
||||||
|
@ -153,8 +161,6 @@ class MapChat extends Component {
|
||||||
onFocus: this.props.inputFocus,
|
onFocus: this.props.inputFocus,
|
||||||
onBlur: this.props.inputBlur
|
onBlur: this.props.inputBlur
|
||||||
}}
|
}}
|
||||||
handleChange={this.handleChange('messageText')}
|
|
||||||
messageText={this.state.messageText}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue