mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
remove unnecesarry state
This commit is contained in:
@@ -9,24 +9,14 @@ import CSSModules from 'browser/lib/CSSModules'
|
||||
class MarkdownSplitEditor extends React.Component {
|
||||
constructor (props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
value: props.value
|
||||
}
|
||||
this.value = props.value
|
||||
this.focus = () => this.refs.code.focus()
|
||||
this.reload = () => this.refs.code.reload()
|
||||
}
|
||||
|
||||
componentWillReceiveProps (props) {
|
||||
this.setState({ value: props.value })
|
||||
}
|
||||
|
||||
handleOnChange () {
|
||||
const value = this.refs.code.value
|
||||
this.setState({ value }, () => {
|
||||
this.value = value
|
||||
this.props.onChange()
|
||||
})
|
||||
this.value = this.refs.code.value
|
||||
this.props.onChange()
|
||||
}
|
||||
|
||||
handleCheckboxClick (e) {
|
||||
@@ -53,8 +43,7 @@ class MarkdownSplitEditor extends React.Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
const { config, storageKey } = this.props
|
||||
const { value } = this.state
|
||||
const { config, value, storageKey } = this.props
|
||||
const storage = findStorage(storageKey)
|
||||
const previewStyle = {}
|
||||
if (this.props.ignorePreviewPointerEvents) previewStyle.pointerEvents = 'none'
|
||||
|
||||
Reference in New Issue
Block a user