Skip to content

Commit

Permalink
Fix #19
Browse files Browse the repository at this point in the history
  • Loading branch information
yishn committed Dec 11, 2017
1 parent 53c6ae8 commit adeeeff
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/components/Properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,19 @@ export default class Properties extends Component {
let edgeEdit = 13 // Enter
let edgeDelete = [46, 8] // Delete, Backspace

document.addEventListener('keyup', evt => {
document.addEventListener('keydown', evt => {
if (!this.props.show || this.state.edit) return

if (edgeControl[evt.keyCode] != null) {
evt.preventDefault()

this.handleButtonClick(edgeControl[evt.keyCode])()
} else if (edgeDelete.includes(evt.keyCode)) {
// Delete
evt.preventDefault()

let {onRemoveClick = () => {}} = this.props
onRemoveClick(evt)
}
})

document.addEventListener('keydown', evt => {
if (evt.keyCode == edgeEdit) {
// Prevents submitting the form directly afterward
} else if (evt.keyCode == edgeEdit) {
evt.preventDefault()

this.handleEditButtonClick()
Expand Down

0 comments on commit adeeeff

Please sign in to comment.