|
@@ -8,6 +8,7 @@ import { isMobileBrowser } from '../../../base/environment/utils';
|
8
|
8
|
import { translate } from '../../../base/i18n';
|
9
|
9
|
import { Icon, IconPlane, IconSmile } from '../../../base/icons';
|
10
|
10
|
import { connect } from '../../../base/redux';
|
|
11
|
+import { areSmileysDisabled } from '../../functions';
|
11
|
12
|
|
12
|
13
|
import SmileysPanel from './SmileysPanel';
|
13
|
14
|
|
|
@@ -35,7 +36,13 @@ type Props = {
|
35
|
36
|
/**
|
36
|
37
|
* Invoked to obtain translated strings.
|
37
|
38
|
*/
|
38
|
|
- t: Function
|
|
39
|
+ t: Function,
|
|
40
|
+
|
|
41
|
+ /**
|
|
42
|
+ * Whether chat emoticons are disabled.
|
|
43
|
+ */
|
|
44
|
+ _areSmileysDisabled: boolean
|
|
45
|
+
|
39
|
46
|
};
|
40
|
47
|
|
41
|
48
|
/**
|
|
@@ -115,28 +122,31 @@ class ChatInput extends Component<Props, State> {
|
115
|
122
|
return (
|
116
|
123
|
<div className = { `chat-input-container${this.state.message.trim().length ? ' populated' : ''}` }>
|
117
|
124
|
<div id = 'chat-input' >
|
118
|
|
- <div className = 'smiley-input'>
|
119
|
|
- <div id = 'smileysarea'>
|
120
|
|
- <div id = 'smileys'>
|
121
|
|
- <div
|
122
|
|
- aria-expanded = { this.state.showSmileysPanel }
|
123
|
|
- aria-haspopup = 'smileysContainer'
|
124
|
|
- aria-label = { this.props.t('chat.smileysPanel') }
|
125
|
|
- className = 'smiley-button'
|
126
|
|
- onClick = { this._onToggleSmileysPanel }
|
127
|
|
- onKeyDown = { this._onEscHandler }
|
128
|
|
- onKeyPress = { this._onToggleSmileysPanelKeyPress }
|
129
|
|
- role = 'button'
|
130
|
|
- tabIndex = { 0 }>
|
131
|
|
- <Icon src = { IconSmile } />
|
|
125
|
+ { this.props._areSmileysDisabled ? null : (
|
|
126
|
+ <div className = 'smiley-input'>
|
|
127
|
+ <div id = 'smileysarea'>
|
|
128
|
+ <div id = 'smileys'>
|
|
129
|
+ <div
|
|
130
|
+ aria-expanded = { this.state.showSmileysPanel }
|
|
131
|
+ aria-haspopup = 'smileysContainer'
|
|
132
|
+ aria-label = { this.props.t('chat.smileysPanel') }
|
|
133
|
+ className = 'smiley-button'
|
|
134
|
+ onClick = { this._onToggleSmileysPanel }
|
|
135
|
+ onKeyDown = { this._onEscHandler }
|
|
136
|
+ onKeyPress = { this._onToggleSmileysPanelKeyPress }
|
|
137
|
+ role = 'button'
|
|
138
|
+ tabIndex = { 0 }>
|
|
139
|
+ <Icon src = { IconSmile } />
|
|
140
|
+ </div>
|
132
|
141
|
</div>
|
133
|
142
|
</div>
|
|
143
|
+ <div
|
|
144
|
+ className = { smileysPanelClassName } >
|
|
145
|
+ <SmileysPanel
|
|
146
|
+ onSmileySelect = { this._onSmileySelect } />
|
|
147
|
+ </div>
|
134
|
148
|
</div>
|
135
|
|
- <div className = { smileysPanelClassName }>
|
136
|
|
- <SmileysPanel
|
137
|
|
- onSmileySelect = { this._onSmileySelect } />
|
138
|
|
- </div>
|
139
|
|
- </div>
|
|
149
|
+ ) }
|
140
|
150
|
<div className = 'usrmsg-form'>
|
141
|
151
|
<TextareaAutosize
|
142
|
152
|
autoComplete = 'off'
|
|
@@ -336,4 +346,19 @@ class ChatInput extends Component<Props, State> {
|
336
|
346
|
}
|
337
|
347
|
}
|
338
|
348
|
|
339
|
|
-export default translate(connect()(ChatInput));
|
|
349
|
+/**
|
|
350
|
+ * Function that maps parts of Redux state tree into component props.
|
|
351
|
+ *
|
|
352
|
+ * @param {Object} state - Redux state.
|
|
353
|
+ * @private
|
|
354
|
+ * @returns {{
|
|
355
|
+ * _areSmileysDisabled: boolean
|
|
356
|
+ * }}
|
|
357
|
+ */
|
|
358
|
+const mapStateToProps = state => {
|
|
359
|
+ return {
|
|
360
|
+ _areSmileysDisabled: areSmileysDisabled(state)
|
|
361
|
+ };
|
|
362
|
+};
|
|
363
|
+
|
|
364
|
+export default translate(connect(mapStateToProps)(ChatInput));
|