diff --git a/src/components/presenter.js b/src/components/presenter.js index 6ef724ab9..5d20310f5 100644 --- a/src/components/presenter.js +++ b/src/components/presenter.js @@ -16,9 +16,33 @@ const startTime = function startTime(date) { @Radium export default class Presenter extends Component { - constructor() { + static childContextTypes = { + updateNotes: PropTypes.func + }; + + getChildContext() { + return { + updateNotes: this.updateNotes.bind(this) + }; + } + + getCurrentSlide() { + return this.context.store.getState().route.slide; + } + + updateNotes(newNotes) { + var notes = Object.assign({}, this.state.notes); + notes[this.getCurrentSlide()] = newNotes; + + this.setState({ + notes: notes + }); + } + + constructor(props) { super(); this.state = { + notes: {}, time: startTime(new Date()) }; } @@ -80,12 +104,22 @@ export default class Presenter extends Component { }) :