summaryrefslogtreecommitdiffstats
path: root/webapp/components/create_post.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/create_post.jsx')
-rw-r--r--webapp/components/create_post.jsx21
1 files changed, 18 insertions, 3 deletions
diff --git a/webapp/components/create_post.jsx b/webapp/components/create_post.jsx
index d173fe42b..75c75f09d 100644
--- a/webapp/components/create_post.jsx
+++ b/webapp/components/create_post.jsx
@@ -10,7 +10,7 @@ import PostDeletedModal from './post_deleted_modal.jsx';
import TutorialTip from './tutorial/tutorial_tip.jsx';
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
-import * as GlobalActions from 'action_creators/global_actions.jsx';
+import * as GlobalActions from 'actions/global_actions.jsx';
import Client from 'utils/web_client.jsx';
import * as Utils from 'utils/utils.jsx';
@@ -77,6 +77,7 @@ class CreatePost extends React.Component {
this.state = {
channelId: ChannelStore.getCurrentId(),
messageText: draft.messageText,
+ lastMessage: '',
uploadsInProgress: draft.uploadsInProgress,
previews: draft.previews,
submitting: false,
@@ -126,7 +127,7 @@ class CreatePost extends React.Component {
}
this.setState({submitting: true, serverError: null});
-
+ this.setState({lastMessage: this.state.messageText});
if (post.message.indexOf('/') === 0) {
Client.executeCommand(
this.state.channelId,
@@ -350,7 +351,7 @@ class CreatePost extends React.Component {
return;
}
- if (e.keyCode === KeyCodes.UP && this.state.messageText === '') {
+ if (!e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && e.keyCode === KeyCodes.UP && this.state.messageText === '') {
e.preventDefault();
const channelId = ChannelStore.getCurrentId();
@@ -371,6 +372,20 @@ class CreatePost extends React.Component {
comments: PostStore.getCommentCount(lastPost)
});
}
+
+ if ((e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey && e.keyCode === KeyCodes.UP) {
+ e.preventDefault();
+ const channelId = ChannelStore.getCurrentId();
+ const lastPost = PostStore.getCurrentUsersLatestPost(channelId);
+ if (!lastPost) {
+ return;
+ }
+ let message = lastPost.message;
+ if (this.state.lastMessage !== '') {
+ message = this.state.lastMessage;
+ }
+ this.setState({messageText: message});
+ }
}
showPostDeletedModal() {
this.setState({