|
|
@ -32,7 +32,7 @@ import {
|
|
|
|
DEFAULT_LANGUAGE
|
|
|
|
DEFAULT_LANGUAGE
|
|
|
|
} from '../lib/constants'
|
|
|
|
} from '../lib/constants'
|
|
|
|
import { serializeState, getQueryStringState } from '../lib/routing'
|
|
|
|
import { serializeState, getQueryStringState } from '../lib/routing'
|
|
|
|
import { getState, escapeHtml } from '../lib/util'
|
|
|
|
import { getState, escapeHtml, unescapeHtml } from '../lib/util'
|
|
|
|
|
|
|
|
|
|
|
|
const saveButtonOptions = {
|
|
|
|
const saveButtonOptions = {
|
|
|
|
button: true,
|
|
|
|
button: true,
|
|
|
@ -89,13 +89,19 @@ class Editor extends React.Component {
|
|
|
|
console.log(e)
|
|
|
|
console.log(e)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Load from localStorage and then URL params
|
|
|
|
const newState = {
|
|
|
|
this.setState({
|
|
|
|
// Load from localStorage
|
|
|
|
...getState(localStorage),
|
|
|
|
...getState(localStorage),
|
|
|
|
|
|
|
|
// and then URL params
|
|
|
|
...initialState,
|
|
|
|
...initialState,
|
|
|
|
loading: false,
|
|
|
|
loading: false,
|
|
|
|
online: Boolean(window && window.navigator && window.navigator.onLine)
|
|
|
|
online: Boolean(window && window.navigator && window.navigator.onLine)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Makes sure the slash in encoded in application/X is decoded
|
|
|
|
|
|
|
|
newState.language = unescapeHtml(newState.language)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState(newState)
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('offline', this.setOffline)
|
|
|
|
window.addEventListener('offline', this.setOffline)
|
|
|
|
window.addEventListener('online', this.setOnline)
|
|
|
|
window.addEventListener('online', this.setOnline)
|
|
|
|