1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 01:36:22 +00:00

[eslint] react/no-direct-mutation-state

This commit is contained in:
asmsuechan
2017-08-14 12:03:14 +09:00
parent 1ca968201d
commit 6bc3e7fcf1
3 changed files with 5 additions and 6 deletions

View File

@@ -10,7 +10,6 @@
"react/prop-types": 0, "react/prop-types": 0,
"react/no-string-refs": 0, "react/no-string-refs": 0,
"react/no-find-dom-node": "warn", "react/no-find-dom-node": "warn",
"react/no-direct-mutation-state": "warn",
"react/no-render-return-value": "warn", "react/no-render-return-value": "warn",
"react/no-deprecated": "warn" "react/no-deprecated": "warn"
} }

View File

@@ -271,7 +271,7 @@ class SnippetNoteDetail extends React.Component {
let syntax = CodeMirror.findModeByFileName(name.trim()) let syntax = CodeMirror.findModeByFileName(name.trim())
let mode = syntax != null ? syntax.name : null let mode = syntax != null ? syntax.name : null
if (mode != null) snippets[index].mode = mode if (mode != null) snippets[index].mode = mode
this.state.note.snippets = snippets this.setState({note: Object.assign(this.state.note, {snippets: snippets})})
this.setState({ this.setState({
note: this.state.note note: this.state.note
@@ -284,7 +284,7 @@ class SnippetNoteDetail extends React.Component {
return (e) => { return (e) => {
let snippets = this.state.note.snippets.slice() let snippets = this.state.note.snippets.slice()
snippets[index].mode = name snippets[index].mode = name
this.state.note.snippets = snippets this.setState({note: Object.assign(this.state.note, {snippets: snippets})})
this.setState({ this.setState({
note: this.state.note note: this.state.note
@@ -298,7 +298,7 @@ class SnippetNoteDetail extends React.Component {
return (e) => { return (e) => {
let snippets = this.state.note.snippets.slice() let snippets = this.state.note.snippets.slice()
snippets[index].content = this.refs['code-' + index].value snippets[index].content = this.refs['code-' + index].value
this.state.note.snippets = snippets this.setState({note: Object.assign(this.state.note, {snippets: snippets})})
this.setState({ this.setState({
note: this.state.note note: this.state.note
}, () => { }, () => {

View File

@@ -172,8 +172,8 @@ class Main extends React.Component {
} }
hideLeftLists (noteDetail, noteList, mainBody) { hideLeftLists (noteDetail, noteList, mainBody) {
this.state.noteDetailWidth = noteDetail.style.left this.setState({noteDetail: noteDetail.style.left})
this.state.mainBodyWidth = mainBody.style.left this.setState({mainBody: mainBody.style.left})
noteDetail.style.left = '0px' noteDetail.style.left = '0px'
mainBody.style.left = '0px' mainBody.style.left = '0px'
noteList.style.display = 'none' noteList.style.display = 'none'