Files
mattermost/webapp/components/create_post.jsx

546 lines
20 KiB
React
Raw Normal View History

// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
2015-06-14 23:53:32 -08:00
// See License.txt for license information.
2016-03-14 08:50:46 -04:00
import ReactDOM from 'react-dom';
import MsgTyping from './msg_typing.jsx';
import Textbox from './textbox.jsx';
import FileUpload from './file_upload.jsx';
import FilePreview from './file_preview.jsx';
import PostDeletedModal from './post_deleted_modal.jsx';
import TutorialTip from './tutorial/tutorial_tip.jsx';
2015-10-30 11:35:16 -04:00
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import * as GlobalActions from 'actions/global_actions.jsx';
PLT-2057 User as a first class object (#2648) * Adding TeamMember to system * Fixing all unit tests on the backend * Fixing merge conflicts * Fixing merge conflict * Adding javascript unit tests * Adding TeamMember to system * Fixing all unit tests on the backend * Fixing merge conflicts * Fixing merge conflict * Adding javascript unit tests * Adding client side unit test * Cleaning up the clint side tests * Fixing msg * Adding more client side unit tests * Adding more using tests * Adding last bit of client side unit tests and adding make cmd * Fixing bad merge * Fixing libraries * Updating to new client side API * Fixing borken unit test * Fixing unit tests * ugg...trying to beat gofmt * ugg...trying to beat gofmt * Cleaning up remainder of the server side routes * Adding inital load api * Increased coverage of webhook unit tests (#2660) * Adding loading ... to root html * Fixing bad merge * Removing explicit content type so superagent will guess corectly (#2685) * Fixing merge and unit tests * Adding create team UI * Fixing signup flows * Adding LDAP unit tests and enterprise unit test helper (#2702) * Add the ability to reset MFA from the commandline (#2706) * Fixing compliance unit tests * Fixing client side tests * Adding open server to system console * Moving websocket connection * Fixing unit test * Fixing unit tests * Fixing unit tests * Adding nickname and more LDAP unit tests (#2717) * Adding join open teams * Cleaning up all TODOs in the code * Fixing web sockets * Removing unused webockets file * PLT-2533 Add the ability to reset a user's MFA from the system console (#2715) * Add the ability to reset a user's MFA from the system console * Add client side unit test for adminResetMfa * Reorganizing authentication to fix LDAP error message (#2723) * Fixing failing unit test * Initial upgrade db code * Adding upgrade script * Fixing upgrade script after running on core * Update OAuth and Claim routes to work with user model changes (#2739) * Fixing perminant deletion. Adding ability to delete all user and the entire database (#2740) * Fixing team invite ldap login call (#2741) * Fixing bluebar and some img stuff * Fix all the different file upload web utils (#2743) * Fixing invalid session redirect (#2744) * Redirect on bad channel name (#2746) * Fixing a bunch of issue and removing dead code * Patch to fix error message on leave channel (#2747) * Setting EnableOpenServer to false by default * Fixing config * Fixing upgrade * Fixing reported bugs * Bug fixes for PLT-2057 * PLT-2563 Redo password recovery to use a database table (#2745) * Redo password recovery to use a database table * Update reset password audits * Split out admin and user reset password APIs to be separate * Delete password recovery when user is permanently deleted * Consolidate password resetting into a single function * Removed private channels as an option for outgoing webhooks (#2752) * PLT-2577/PLT-2552 Fixes for backstage (#2753) * Added URL to incoming webhook list * Fixed client functions for adding/removing integrations * Disallowed slash commands without trigger words * Fixed clientside handling of errors on AddCommand page * Minor auth cleanup (#2758) * Changed EditPostModal to just close if you save without making any changes (#2759) * Renamed client -> Client in async_client.jsx and fixed eslint warnings (#2756) * Fixed url in channel info modal (#2755) * Fixing reported issues * Moving to version 3 of the apis * Fixing command unit tests (#2760) * Adding team admins * Fixing DM issue * Fixing eslint error * Properly set EditPostModal's originalText state in all cases (#2762) * Update client config check to assume features is defined if server is licensed (#2772) * Fixing url link * Fixing issue with websocket crashing when sending messages to different teams
2016-04-21 22:37:01 -07:00
import Client from 'utils/web_client.jsx';
2016-03-14 08:50:46 -04:00
import * as Utils from 'utils/utils.jsx';
import * as ChannelActions from 'actions/channel_actions.jsx';
2015-10-30 11:35:16 -04:00
2016-03-14 08:50:46 -04:00
import ChannelStore from 'stores/channel_store.jsx';
import PostStore from 'stores/post_store.jsx';
import UserStore from 'stores/user_store.jsx';
import PreferenceStore from 'stores/preference_store.jsx';
2016-03-14 08:50:46 -04:00
import Constants from 'utils/constants.jsx';
2016-03-14 08:50:46 -04:00
import {intlShape, injectIntl, defineMessages, FormattedHTMLMessage} from 'react-intl';
import {browserHistory} from 'react-router';
2015-10-30 11:35:16 -04:00
const Preferences = Constants.Preferences;
const TutorialSteps = Constants.TutorialSteps;
const ActionTypes = Constants.ActionTypes;
const KeyCodes = Constants.KeyCodes;
const holders = defineMessages({
comment: {
id: 'create_post.comment',
defaultMessage: 'Comment'
},
post: {
id: 'create_post.post',
defaultMessage: 'Post'
},
write: {
id: 'create_post.write',
defaultMessage: 'Write a message...'
}
});
2016-03-14 08:50:46 -04:00
import React from 'react';
class CreatePost extends React.Component {
constructor(props) {
super(props);
this.lastTime = 0;
2015-09-22 16:00:44 -07:00
this.getCurrentDraft = this.getCurrentDraft.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.postMsgKeyPress = this.postMsgKeyPress.bind(this);
this.handleUserInput = this.handleUserInput.bind(this);
2016-02-04 11:05:59 -05:00
this.handleUploadClick = this.handleUploadClick.bind(this);
this.handleUploadStart = this.handleUploadStart.bind(this);
this.handleFileUploadComplete = this.handleFileUploadComplete.bind(this);
this.handleUploadError = this.handleUploadError.bind(this);
this.removePreview = this.removePreview.bind(this);
this.onChange = this.onChange.bind(this);
2015-10-30 11:35:16 -04:00
this.onPreferenceChange = this.onPreferenceChange.bind(this);
this.getFileCount = this.getFileCount.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);
this.sendMessage = this.sendMessage.bind(this);
this.focusTextbox = this.focusTextbox.bind(this);
this.showPostDeletedModal = this.showPostDeletedModal.bind(this);
this.hidePostDeletedModal = this.hidePostDeletedModal.bind(this);
this.showShortcuts = this.showShortcuts.bind(this);
PostStore.clearDraftUploads();
2015-09-22 16:00:44 -07:00
const draft = this.getCurrentDraft();
this.state = {
channelId: ChannelStore.getCurrentId(),
2015-09-22 16:00:44 -07:00
messageText: draft.messageText,
lastMessage: '',
2015-09-22 16:00:44 -07:00
uploadsInProgress: draft.uploadsInProgress,
previews: draft.previews,
submitting: false,
initialText: draft.messageText,
ctrlSend: false,
centerTextbox: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_CENTERED,
showTutorialTip: false,
showPostDeletedModal: false
};
}
2015-09-22 16:00:44 -07:00
getCurrentDraft() {
const draft = PostStore.getCurrentDraft();
const safeDraft = {previews: [], messageText: '', uploadsInProgress: []};
if (draft) {
if (draft.message) {
safeDraft.messageText = draft.message;
}
if (draft.previews) {
safeDraft.previews = draft.previews;
}
if (draft.uploadsInProgress) {
safeDraft.uploadsInProgress = draft.uploadsInProgress;
}
}
return safeDraft;
}
handleSubmit(e) {
2015-06-14 23:53:32 -08:00
e.preventDefault();
if (this.state.uploadsInProgress.length > 0 || this.state.submitting) {
return;
}
2015-06-14 23:53:32 -08:00
const post = {};
2015-06-14 23:53:32 -08:00
post.filenames = [];
post.message = this.state.messageText;
2015-06-18 17:39:12 -04:00
if (post.message.trim().length === 0 && this.state.previews.length === 0) {
2015-06-14 23:53:32 -08:00
return;
}
if (post.message.length > Constants.CHARACTER_LIMIT) {
this.setState({postError: `Post length must be less than ${Constants.CHARACTER_LIMIT} characters.`});
2015-06-14 23:53:32 -08:00
return;
}
this.setState({submitting: true, serverError: null});
this.setState({lastMessage: this.state.messageText});
if (post.message.indexOf('/') === 0) {
ChannelActions.executeCommand(
this.state.channelId,
2015-06-14 23:53:32 -08:00
post.message,
false,
(data) => {
PostStore.storeDraft(this.state.channelId, null);
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
2015-06-14 23:53:32 -08:00
2016-01-08 12:41:26 -06:00
if (data.goto_location && data.goto_location.length > 0) {
browserHistory.push(data.goto_location);
2015-06-14 23:53:32 -08:00
}
},
(err) => {
if (err.sendMessage) {
this.sendMessage(post);
2015-07-23 09:39:29 -04:00
} else {
const state = {};
state.serverError = err.message;
state.submitting = false;
this.setState(state);
2015-07-23 09:39:29 -04:00
}
}
2015-06-14 23:53:32 -08:00
);
} else {
this.sendMessage(post);
2015-06-14 23:53:32 -08:00
}
}
sendMessage(post) {
post.channel_id = this.state.channelId;
post.filenames = this.state.previews;
const time = Utils.getTimestamp();
const userId = UserStore.getCurrentId();
post.pending_post_id = `${userId}:${time}`;
post.user_id = userId;
post.create_at = time;
post.parent_id = this.state.parentId;
2016-02-08 07:26:10 -05:00
GlobalActions.emitUserPostedEvent(post);
this.setState({messageText: '', submitting: false, postError: null, previews: [], serverError: null});
PLT-2057 User as a first class object (#2648) * Adding TeamMember to system * Fixing all unit tests on the backend * Fixing merge conflicts * Fixing merge conflict * Adding javascript unit tests * Adding TeamMember to system * Fixing all unit tests on the backend * Fixing merge conflicts * Fixing merge conflict * Adding javascript unit tests * Adding client side unit test * Cleaning up the clint side tests * Fixing msg * Adding more client side unit tests * Adding more using tests * Adding last bit of client side unit tests and adding make cmd * Fixing bad merge * Fixing libraries * Updating to new client side API * Fixing borken unit test * Fixing unit tests * ugg...trying to beat gofmt * ugg...trying to beat gofmt * Cleaning up remainder of the server side routes * Adding inital load api * Increased coverage of webhook unit tests (#2660) * Adding loading ... to root html * Fixing bad merge * Removing explicit content type so superagent will guess corectly (#2685) * Fixing merge and unit tests * Adding create team UI * Fixing signup flows * Adding LDAP unit tests and enterprise unit test helper (#2702) * Add the ability to reset MFA from the commandline (#2706) * Fixing compliance unit tests * Fixing client side tests * Adding open server to system console * Moving websocket connection * Fixing unit test * Fixing unit tests * Fixing unit tests * Adding nickname and more LDAP unit tests (#2717) * Adding join open teams * Cleaning up all TODOs in the code * Fixing web sockets * Removing unused webockets file * PLT-2533 Add the ability to reset a user's MFA from the system console (#2715) * Add the ability to reset a user's MFA from the system console * Add client side unit test for adminResetMfa * Reorganizing authentication to fix LDAP error message (#2723) * Fixing failing unit test * Initial upgrade db code * Adding upgrade script * Fixing upgrade script after running on core * Update OAuth and Claim routes to work with user model changes (#2739) * Fixing perminant deletion. Adding ability to delete all user and the entire database (#2740) * Fixing team invite ldap login call (#2741) * Fixing bluebar and some img stuff * Fix all the different file upload web utils (#2743) * Fixing invalid session redirect (#2744) * Redirect on bad channel name (#2746) * Fixing a bunch of issue and removing dead code * Patch to fix error message on leave channel (#2747) * Setting EnableOpenServer to false by default * Fixing config * Fixing upgrade * Fixing reported bugs * Bug fixes for PLT-2057 * PLT-2563 Redo password recovery to use a database table (#2745) * Redo password recovery to use a database table * Update reset password audits * Split out admin and user reset password APIs to be separate * Delete password recovery when user is permanently deleted * Consolidate password resetting into a single function * Removed private channels as an option for outgoing webhooks (#2752) * PLT-2577/PLT-2552 Fixes for backstage (#2753) * Added URL to incoming webhook list * Fixed client functions for adding/removing integrations * Disallowed slash commands without trigger words * Fixed clientside handling of errors on AddCommand page * Minor auth cleanup (#2758) * Changed EditPostModal to just close if you save without making any changes (#2759) * Renamed client -> Client in async_client.jsx and fixed eslint warnings (#2756) * Fixed url in channel info modal (#2755) * Fixing reported issues * Moving to version 3 of the apis * Fixing command unit tests (#2760) * Adding team admins * Fixing DM issue * Fixing eslint error * Properly set EditPostModal's originalText state in all cases (#2762) * Update client config check to assume features is defined if server is licensed (#2772) * Fixing url link * Fixing issue with websocket crashing when sending messages to different teams
2016-04-21 22:37:01 -07:00
Client.createPost(post,
2016-05-04 10:10:19 -04:00
() => {
// DO nothing. Websockets will handle this.
},
(err) => {
if (err.id === 'api.post.create_post.root_id.app_error') {
// this should never actually happen since you can't reply from this textbox
this.showPostDeletedModal();
PostStore.removePendingPost(post.pending_post_id);
} else {
post.state = Constants.POST_FAILED;
PostStore.updatePendingPost(post);
}
this.setState({
submitting: false
});
}
);
}
focusTextbox() {
if (!Utils.isMobile()) {
this.refs.textbox.focus();
}
}
postMsgKeyPress(e) {
if (this.state.ctrlSend && e.ctrlKey || !this.state.ctrlSend) {
if (e.which === KeyCodes.ENTER && !e.shiftKey && !e.altKey) {
e.preventDefault();
ReactDOM.findDOMNode(this.refs.textbox).blur();
this.handleSubmit(e);
}
2015-06-14 23:53:32 -08:00
}
GlobalActions.emitLocalUserTypingEvent(this.state.channelId, '');
}
handleUserInput(messageText) {
this.setState({messageText});
const draft = PostStore.getCurrentDraft();
draft.message = messageText;
2015-06-14 23:53:32 -08:00
PostStore.storeCurrentDraft(draft);
}
2016-02-04 11:05:59 -05:00
handleUploadClick() {
this.focusTextbox();
}
handleUploadStart(clientIds, channelId) {
const draft = PostStore.getDraft(channelId);
2015-06-14 23:53:32 -08:00
draft.uploadsInProgress = draft.uploadsInProgress.concat(clientIds);
PostStore.storeDraft(channelId, draft);
2015-06-14 23:53:32 -08:00
this.setState({uploadsInProgress: draft.uploadsInProgress});
// this is a bit redundant with the code that sets focus when the file input is clicked,
// but this also resets the focus after a drag and drop
this.focusTextbox();
}
handleFileUploadComplete(filenames, clientIds, channelId) {
const draft = PostStore.getDraft(channelId);
2015-06-14 23:53:32 -08:00
// remove each finished file from uploads
for (let i = 0; i < clientIds.length; i++) {
const index = draft.uploadsInProgress.indexOf(clientIds[i]);
if (index !== -1) {
draft.uploadsInProgress.splice(index, 1);
}
2015-06-14 23:53:32 -08:00
}
draft.previews = draft.previews.concat(filenames);
PostStore.storeDraft(channelId, draft);
if (channelId === this.state.channelId) {
this.setState({uploadsInProgress: draft.uploadsInProgress, previews: draft.previews});
}
}
handleUploadError(err, clientId, channelId) {
let message = err;
if (message && typeof message !== 'string') {
// err is an AppError from the server
message = err.message;
}
if (clientId !== -1) {
const draft = PostStore.getDraft(channelId);
const index = draft.uploadsInProgress.indexOf(clientId);
if (index !== -1) {
draft.uploadsInProgress.splice(index, 1);
}
PostStore.storeDraft(channelId, draft);
if (channelId === this.state.channelId) {
this.setState({uploadsInProgress: draft.uploadsInProgress});
}
}
this.setState({serverError: message});
}
removePreview(id) {
const previews = Object.assign([], this.state.previews);
const uploadsInProgress = this.state.uploadsInProgress;
// id can either be the path of an uploaded file or the client id of an in progress upload
let index = previews.indexOf(id);
if (index === -1) {
index = uploadsInProgress.indexOf(id);
if (index !== -1) {
uploadsInProgress.splice(index, 1);
this.refs.fileUpload.getWrappedInstance().cancelUpload(id);
2015-06-14 23:53:32 -08:00
}
} else {
previews.splice(index, 1);
2015-06-14 23:53:32 -08:00
}
const draft = PostStore.getCurrentDraft();
draft.previews = previews;
draft.uploadsInProgress = uploadsInProgress;
2015-06-14 23:53:32 -08:00
PostStore.storeCurrentDraft(draft);
this.setState({previews, uploadsInProgress});
}
componentWillMount() {
const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999);
// wait to load these since they may have changed since the component was constructed (particularly in the case of skipping the tutorial)
this.setState({
ctrlSend: PreferenceStore.getBool(Preferences.CATEGORY_ADVANCED_SETTINGS, 'send_on_ctrl_enter'),
centerTextbox: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_CENTERED,
showTutorialTip: tutorialStep === TutorialSteps.POST_POPOVER
});
}
componentDidMount() {
ChannelStore.addChangeListener(this.onChange);
2015-10-30 11:35:16 -04:00
PreferenceStore.addChangeListener(this.onPreferenceChange);
this.focusTextbox();
document.addEventListener('keydown', this.showShortcuts);
2016-02-04 11:05:59 -05:00
}
componentDidUpdate(prevProps, prevState) {
if (prevState.channelId !== this.state.channelId) {
this.focusTextbox();
2016-02-04 11:05:59 -05:00
}
}
componentWillUnmount() {
ChannelStore.removeChangeListener(this.onChange);
2015-10-30 11:35:16 -04:00
PreferenceStore.removeChangeListener(this.onPreferenceChange);
document.removeEventListener('keydown', this.showShortcuts);
}
showShortcuts(e) {
if ((e.ctrlKey || e.metaKey) && e.keyCode === Constants.KeyCodes.FORWARD_SLASH) {
e.preventDefault();
ChannelActions.executeCommand(
this.state.channelId,
'/shortcuts ',
false,
null,
(err) => {
this.setState({
serverError: err.message,
submitting: false
});
}
);
}
}
onChange() {
const channelId = ChannelStore.getCurrentId();
if (this.state.channelId !== channelId) {
2015-09-22 16:00:44 -07:00
const draft = this.getCurrentDraft();
2015-07-23 12:45:08 -04:00
this.setState({channelId, messageText: draft.messageText, initialText: draft.messageText, submitting: false, serverError: null, postError: null, previews: draft.previews, uploadsInProgress: draft.uploadsInProgress});
2015-06-14 23:53:32 -08:00
}
}
2015-10-30 11:35:16 -04:00
onPreferenceChange() {
const tutorialStep = PreferenceStore.getInt(Preferences.TUTORIAL_STEP, UserStore.getCurrentId(), 999);
2015-10-30 11:35:16 -04:00
this.setState({
showTutorialTip: tutorialStep === TutorialSteps.POST_POPOVER,
ctrlSend: PreferenceStore.getBool(Preferences.CATEGORY_ADVANCED_SETTINGS, 'send_on_ctrl_enter'),
centerTextbox: PreferenceStore.get(Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.CHANNEL_DISPLAY_MODE, Preferences.CHANNEL_DISPLAY_MODE_DEFAULT) === Preferences.CHANNEL_DISPLAY_MODE_CENTERED
2015-10-30 11:35:16 -04:00
});
}
getFileCount(channelId) {
if (channelId === this.state.channelId) {
return this.state.previews.length + this.state.uploadsInProgress.length;
2015-06-14 23:53:32 -08:00
}
const draft = PostStore.getDraft(channelId);
return draft.previews.length + draft.uploadsInProgress.length;
}
handleKeyDown(e) {
if (this.state.ctrlSend && e.keyCode === KeyCodes.ENTER && e.ctrlKey === true) {
this.postMsgKeyPress(e);
return;
}
if (!e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && e.keyCode === KeyCodes.UP && this.state.messageText === '') {
e.preventDefault();
const channelId = ChannelStore.getCurrentId();
const lastPost = PostStore.getCurrentUsersLatestPost(channelId);
if (!lastPost) {
return;
}
const {formatMessage} = this.props.intl;
var type = (lastPost.root_id && lastPost.root_id.length > 0) ? formatMessage(holders.comment) : formatMessage(holders.post);
AppDispatcher.handleViewAction({
2016-02-08 10:33:59 -05:00
type: ActionTypes.RECEIVED_EDIT_POST,
refocusId: '#post_textbox',
title: type,
message: lastPost.message,
postId: lastPost.id,
channelId: lastPost.channel_id,
comments: PostStore.getCommentCount(lastPost)
});
}
if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && e.keyCode === KeyCodes.UP) {
const channelId = ChannelStore.getCurrentId();
const lastPost = PostStore.getCurrentUsersLatestPost(channelId);
if (!lastPost || this.state.messageText !== '') {
return;
}
e.preventDefault();
let message = lastPost.message;
if (this.state.lastMessage !== '') {
message = this.state.lastMessage;
}
this.setState({messageText: message});
}
}
showPostDeletedModal() {
this.setState({
showPostDeletedModal: true
});
}
hidePostDeletedModal() {
this.setState({
showPostDeletedModal: false
});
}
2015-10-30 11:35:16 -04:00
createTutorialTip() {
const screens = [];
screens.push(
<div>
<FormattedHTMLMessage
id='create_post.tutorialTip'
defaultMessage='<h4>Sending Messages</h4><p>Type here to write a message and press <strong>Enter</strong> to post it.</p><p>Click the <strong>Attachment</strong> button to upload an image or a file.</p>'
/>
2015-10-30 11:35:16 -04:00
</div>
);
return (
<TutorialTip
placement='top'
screens={screens}
overlayClass='tip-overlay--chat'
2015-10-30 11:35:16 -04:00
/>
);
}
render() {
let serverError = null;
if (this.state.serverError) {
serverError = (
<div className='has-error'>
<label className='control-label'>{this.state.serverError}</label>
</div>
);
}
2015-06-14 23:53:32 -08:00
let postError = null;
if (this.state.postError) {
postError = <label className='control-label'>{this.state.postError}</label>;
}
let preview = null;
if (this.state.previews.length > 0 || this.state.uploadsInProgress.length > 0) {
2015-06-14 23:53:32 -08:00
preview = (
<FilePreview
files={this.state.previews}
onRemove={this.removePreview}
uploadsInProgress={this.state.uploadsInProgress}
/>
2015-06-14 23:53:32 -08:00
);
}
let postFooterClassName = 'post-create-footer';
if (postError) {
postFooterClassName += ' has-error';
}
2015-10-30 11:35:16 -04:00
let tutorialTip = null;
if (this.state.showTutorialTip) {
tutorialTip = this.createTutorialTip();
}
let centerClass = '';
if (this.state.centerTextbox) {
centerClass = 'center';
}
2015-06-14 23:53:32 -08:00
return (
<form
id='create_post'
ref='topDiv'
role='form'
className={centerClass}
onSubmit={this.handleSubmit}
>
<div className='post-create'>
<div className='post-create-body'>
<div className='post-body__cell'>
<Textbox
onUserInput={this.handleUserInput}
onKeyPress={this.postMsgKeyPress}
onKeyDown={this.handleKeyDown}
messageText={this.state.messageText}
createMessage={this.props.intl.formatMessage(holders.write)}
channelId={this.state.channelId}
id='post_textbox'
ref='textbox'
/>
<FileUpload
ref='fileUpload'
getFileCount={this.getFileCount}
2016-02-04 11:05:59 -05:00
onClick={this.handleUploadClick}
onUploadStart={this.handleUploadStart}
onFileUpload={this.handleFileUploadComplete}
onUploadError={this.handleUploadError}
postType='post'
channelId=''
/>
</div>
<a
className='send-button theme'
onClick={this.handleSubmit}
>
2016-02-22 08:31:10 -05:00
<i className='fa fa-paper-plane'/>
</a>
2015-10-30 11:35:16 -04:00
{tutorialTip}
2015-06-14 23:53:32 -08:00
</div>
<div className={postFooterClassName}>
<MsgTyping
channelId={this.state.channelId}
parentId=''
/>
2015-12-08 22:42:59 +05:00
{preview}
{postError}
{serverError}
2015-06-14 23:53:32 -08:00
</div>
</div>
<PostDeletedModal
show={this.state.showPostDeletedModal}
onHide={this.hidePostDeletedModal}
/>
2015-06-14 23:53:32 -08:00
</form>
);
}
}
CreatePost.propTypes = {
intl: intlShape.isRequired
};
export default injectIntl(CreatePost);