Skip to content
This repository has been archived by the owner on May 5, 2020. It is now read-only.

Commit

Permalink
replaced react-codemirror with react-codemirror2
Browse files Browse the repository at this point in the history
  • Loading branch information
JoJordens committed Mar 2, 2018
1 parent 071add2 commit 422bbf9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 28 deletions.
23 changes: 4 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"watchify": "^3.9.0"
},
"dependencies": {
"codemirror": "^5.23.0",
"codemirror": "^5.35.0",
"react": "^15.4.2",
"react-autosuggest": "^9.0.1",
"react-codemirror": "^0.3.0",
"react-codemirror2": "^4.0.1",
"react-color": "^2.11.1",
"react-dom": "^15.4.2",
"react-inspector": "^1.1.2",
Expand Down
13 changes: 6 additions & 7 deletions src/app/js/components/column/messageSender/MessageSenderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { Component } from 'react'
import CodeMirror from 'react-codemirror'
import { Controlled as CodeMirror } from 'react-codemirror2'
import 'codemirror/mode/javascript/javascript'
import Autosuggest from 'react-autosuggest'

Expand All @@ -27,7 +27,7 @@ class MessageSender extends Component {

this.handleMessageSend = this.handleMessageSend.bind(this)
this.handleEventNameChange = this.handleEventNameChange.bind(this)
this.handleMessageChange = this.handleMessageChange.bind(this)
this.handleMessageBeforeChange = this.handleMessageBeforeChange.bind(this)
this.handleClearClick = this.handleClearClick.bind(this)
this.onSuggestionsFetchRequested = this.onSuggestionsFetchRequested.bind(this)
this.onSuggestionsClearRequested = this.onSuggestionsClearRequested.bind(this)
Expand Down Expand Up @@ -63,14 +63,13 @@ class MessageSender extends Component {
})
}

handleMessageChange (newValue) {
handleMessageBeforeChange (editor, data, value) {
const state = this.state
const messageCollection = state.messageCollection.slice()
messageCollection[state.messageInEditor] = newValue
messageCollection[state.messageInEditor] = value
this.setState({
messageCollection,
// message: newValue,
messageIsJson: this.jsonOrText(newValue)
messageIsJson: this.jsonOrText(value)
})
}

Expand Down Expand Up @@ -271,7 +270,7 @@ class MessageSender extends Component {
<CodeMirror
className="column-editor"
value={state.messageCollection[state.messageInEditor]}
onChange={this.handleMessageChange}
onBeforeChange={this.handleMessageBeforeChange}
options={{mode: {name: 'javascript', json: true}}}
/>

Expand Down

0 comments on commit 422bbf9

Please sign in to comment.