|
|
@ -41,14 +41,11 @@ const saveButtonOptions = {
|
|
|
|
class Editor extends React.Component {
|
|
|
|
class Editor extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
constructor(props) {
|
|
|
|
super(props)
|
|
|
|
super(props)
|
|
|
|
this.state = Object.assign(
|
|
|
|
this.state = {
|
|
|
|
{
|
|
|
|
...DEFAULT_SETTINGS,
|
|
|
|
...DEFAULT_SETTINGS,
|
|
|
|
uploading: false,
|
|
|
|
uploading: false,
|
|
|
|
code: props.content
|
|
|
|
code: props.content
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
this.props.initialState
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.save = this.save.bind(this)
|
|
|
|
this.save = this.save.bind(this)
|
|
|
|
this.upload = this.upload.bind(this)
|
|
|
|
this.upload = this.upload.bind(this)
|
|
|
@ -65,13 +62,11 @@ class Editor extends React.Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
componentDidMount() {
|
|
|
|
// Load from localStorage instead of query params
|
|
|
|
// Load from localStorage and then URL params
|
|
|
|
if (!this.props.initialState) {
|
|
|
|
this.setState({
|
|
|
|
const state = getState(localStorage)
|
|
|
|
...getState(localStorage),
|
|
|
|
if (state) {
|
|
|
|
...this.props.initialState
|
|
|
|
this.setState(state)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate() {
|
|
|
|
componentDidUpdate() {
|
|
|
|