mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +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 {
|
class MarkdownSplitEditor extends React.Component {
|
||||||
constructor (props) {
|
constructor (props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
|
||||||
value: props.value
|
|
||||||
}
|
|
||||||
this.value = props.value
|
this.value = props.value
|
||||||
this.focus = () => this.refs.code.focus()
|
this.focus = () => this.refs.code.focus()
|
||||||
this.reload = () => this.refs.code.reload()
|
this.reload = () => this.refs.code.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps (props) {
|
|
||||||
this.setState({ value: props.value })
|
|
||||||
}
|
|
||||||
|
|
||||||
handleOnChange () {
|
handleOnChange () {
|
||||||
const value = this.refs.code.value
|
this.value = this.refs.code.value
|
||||||
this.setState({ value }, () => {
|
|
||||||
this.value = value
|
|
||||||
this.props.onChange()
|
this.props.onChange()
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCheckboxClick (e) {
|
handleCheckboxClick (e) {
|
||||||
@@ -53,8 +43,7 @@ class MarkdownSplitEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { config, storageKey } = this.props
|
const { config, value, storageKey } = this.props
|
||||||
const { value } = this.state
|
|
||||||
const storage = findStorage(storageKey)
|
const storage = findStorage(storageKey)
|
||||||
const previewStyle = {}
|
const previewStyle = {}
|
||||||
if (this.props.ignorePreviewPointerEvents) previewStyle.pointerEvents = 'none'
|
if (this.props.ignorePreviewPointerEvents) previewStyle.pointerEvents = 'none'
|
||||||
|
|||||||
Reference in New Issue
Block a user