onUndo: PropTypes.func.isRequired,
onDescriptionChange: PropTypes.func.isRequired,
onOpenFocalPoint: PropTypes.func.isRequired,
+ onSubmit: PropTypes.func.isRequired,
};
state = {
dirtyDescription: null,
};
+ handleKeyDown = (e) => {
+ if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
+ this.handleSubmit();
+ }
+ }
+
+ handleSubmit = () => {
+ this.handleInputBlur();
+ this.props.onSubmit();
+ }
+
handleUndoClick = () => {
this.props.onUndo(this.props.media.get('id'));
}
onFocus={this.handleInputFocus}
onChange={this.handleInputChange}
onBlur={this.handleInputBlur}
+ onKeyDown={this.handleKeyDown}
/>
</label>
</div>
import Upload from '../components/upload';
import { undoUploadCompose, changeUploadCompose } from '../../../actions/compose';
import { openModal } from '../../../actions/modal';
+import { submitCompose } from '../../../actions/compose';
const mapStateToProps = (state, { id }) => ({
media: state.getIn(['compose', 'media_attachments']).find(item => item.get('id') === id),
dispatch(openModal('FOCAL_POINT', { id }));
},
+ onSubmit () {
+ dispatch(submitCompose());
+ },
+
});
export default connect(mapStateToProps, mapDispatchToProps)(Upload);