mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 10:16:26 +00:00
better formatting
This commit is contained in:
@@ -250,19 +250,13 @@ class SnippetNoteDetail extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteSnippetByIndex (index) {
|
deleteSnippetByIndex (index) {
|
||||||
this.setState(() => {
|
const snippets = this.state.note.snippets.slice()
|
||||||
const snippets = this.state.note.snippets.slice()
|
snippets.splice(index, 1)
|
||||||
snippets.splice(index, 1)
|
const note = Object.assign({}, this.state.note, {snippets})
|
||||||
const note = Object.assign({}, this.state.note, {snippets})
|
const snippetIndex = this.state.snippetIndex >= snippets.length
|
||||||
const snippetIndex = this.state.snippetIndex >= snippets.length
|
? snippets.length - 1
|
||||||
? snippets.length - 1
|
: this.state.snippetIndex
|
||||||
: this.state.snippetIndex
|
this.setState({ note, snippetIndex }, () => {
|
||||||
|
|
||||||
return {
|
|
||||||
note,
|
|
||||||
snippetIndex
|
|
||||||
}
|
|
||||||
}, () => {
|
|
||||||
this.save()
|
this.save()
|
||||||
this.refs['code-' + this.state.snippetIndex].reload()
|
this.refs['code-' + this.state.snippetIndex].reload()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user