mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
fix: #288 Fixed Snippet tabs overwriting other tabs when closed
This commit is contained in:
@@ -201,6 +201,7 @@ export default class CodeEditor extends React.Component {
|
|||||||
this.editor.setValue(this.props.value)
|
this.editor.setValue(this.props.value)
|
||||||
this.editor.clearHistory()
|
this.editor.clearHistory()
|
||||||
this.editor.on('change', this.changeHandler)
|
this.editor.on('change', this.changeHandler)
|
||||||
|
this.editor.refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
setValue (value) {
|
setValue (value) {
|
||||||
|
|||||||
@@ -250,17 +250,21 @@ class SnippetNoteDetail extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteSnippetByIndex (index) {
|
deleteSnippetByIndex (index) {
|
||||||
let snippets = this.state.note.snippets.slice()
|
this.setState(() => {
|
||||||
snippets.splice(index, 1)
|
let snippets = this.state.note.snippets.slice()
|
||||||
this.state.note.snippets = snippets
|
snippets.splice(index, 1)
|
||||||
let snippetIndex = this.state.snippetIndex >= snippets.length
|
let note = Object.assign({}, this.state.note, {snippets})
|
||||||
? snippets.length - 1
|
let snippetIndex = this.state.snippetIndex >= snippets.length
|
||||||
: this.state.snippetIndex
|
? snippets.length - 1
|
||||||
this.setState({
|
: this.state.snippetIndex
|
||||||
note: this.state.note,
|
|
||||||
snippetIndex
|
return {
|
||||||
|
note,
|
||||||
|
snippetIndex
|
||||||
|
}
|
||||||
}, () => {
|
}, () => {
|
||||||
this.save()
|
this.save()
|
||||||
|
this.refs['code-' + this.state.snippetIndex].reload()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user