Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions browser/components/CodeEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export default class CodeEditor extends React.Component {
this.editor.setValue(this.props.value)
this.editor.clearHistory()
this.editor.on('change', this.changeHandler)
this.editor.refresh()
}

setValue (value) {
Expand Down
12 changes: 5 additions & 7 deletions browser/main/Detail/SnippetNoteDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,17 +250,15 @@ class SnippetNoteDetail extends React.Component {
}

deleteSnippetByIndex (index) {
let snippets = this.state.note.snippets.slice()
const snippets = this.state.note.snippets.slice()
snippets.splice(index, 1)
this.state.note.snippets = snippets
let snippetIndex = this.state.snippetIndex >= snippets.length
const note = Object.assign({}, this.state.note, {snippets})
const snippetIndex = this.state.snippetIndex >= snippets.length
? snippets.length - 1
: this.state.snippetIndex
this.setState({
note: this.state.note,
snippetIndex
}, () => {
this.setState({ note, snippetIndex }, () => {
this.save()
this.refs['code-' + this.state.snippetIndex].reload()
})
}

Expand Down