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

better formatting

This commit is contained in:
Razvan Moraru
2017-03-23 21:01:49 +01:00
parent 966ba06bc4
commit 6540d2670c

View File

@@ -250,19 +250,13 @@ class SnippetNoteDetail extends React.Component {
}
deleteSnippetByIndex (index) {
this.setState(() => {
const snippets = this.state.note.snippets.slice()
snippets.splice(index, 1)
const note = Object.assign({}, this.state.note, {snippets})
const snippetIndex = this.state.snippetIndex >= snippets.length
? snippets.length - 1
: this.state.snippetIndex
return {
note,
snippetIndex
}
}, () => {
const snippets = this.state.note.snippets.slice()
snippets.splice(index, 1)
const note = Object.assign({}, this.state.note, {snippets})
const snippetIndex = this.state.snippetIndex >= snippets.length
? snippets.length - 1
: this.state.snippetIndex
this.setState({ note, snippetIndex }, () => {
this.save()
this.refs['code-' + this.state.snippetIndex].reload()
})