1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-11-26 00:35:02 +03:00

Store presenter mode in querystring

This commit is contained in:
Brent Jackson 2018-08-02 21:54:49 -04:00
parent 36a5af82b7
commit 4ee0ef190b
3 changed files with 6 additions and 12 deletions

View File

@ -33,6 +33,7 @@
"pkg-conf": "^2.1.0",
"prop-types": "^15.6.2",
"puppeteer": "^1.6.1",
"querystring": "^0.2.0",
"react": "^16.4.1",
"react-dev-utils": "^5.0.1",
"remark-emoji": "^2.0.1",

View File

@ -16,16 +16,6 @@ export default withDeck(withSlide(class extends React.Component {
this.setNotes(this.props)
}
/* todo
componentWillUpdate (next) {
this.setNotes(next)
}
shouldComponentUpdate (next) {
return next.children !== this.props.children
}
*/
render () {
return false
}

View File

@ -135,8 +135,11 @@ export class SlideDeck extends React.Component {
this.isHashChange = false
return
}
const { index } = this.state
history.pushState(null, null, '#' + index)
const { index, mode } = this.state
let query = ''
if (mode === modes.presenter) query += 'presenter'
query = query ? '?' + query : ''
history.pushState(null, null, query + '#' + index)
localStorage.setItem('mdx-slide', index)
}