(i, j, e)
| 401 | } |
| 402 | |
| 403 | onMouseDown (i, j, e) { |
| 404 | const isNowEditingSameCell = !isEmpty(this.state.editing) && this.state.editing.i === i && this.state.editing.j === j |
| 405 | let editing = (isEmpty(this.state.editing) || this.state.editing.i !== i || this.state.editing.j !== j) |
| 406 | ? {} : this.state.editing |
| 407 | |
| 408 | this._setState({ |
| 409 | selecting: !isNowEditingSameCell, |
| 410 | start: e.shiftKey ? this.state.start : {i, j}, |
| 411 | end: {i, j}, |
| 412 | editing: editing, |
| 413 | forceEdit: !!isNowEditingSameCell |
| 414 | }) |
| 415 | |
| 416 | var ua = window.navigator.userAgent |
| 417 | var isIE = /MSIE|Trident/.test(ua) |
| 418 | // Listen for Ctrl + V in case of IE |
| 419 | if (isIE) { |
| 420 | document.addEventListener('keydown', (e) => { |
| 421 | if ((e.keyCode === 86 || e.which === 86) && e.ctrlKey) { |
| 422 | this.handlePaste(e) |
| 423 | } |
| 424 | }) |
| 425 | } |
| 426 | |
| 427 | // Keep listening to mouse if user releases the mouse (dragging outside) |
| 428 | document.addEventListener('mouseup', this.onMouseUp) |
| 429 | // Listen for any outside mouse clicks |
| 430 | document.addEventListener('mousedown', this.pageClick) |
| 431 | |
| 432 | // Cut, copy and paste event handlers |
| 433 | document.addEventListener('cut', this.handleCut) |
| 434 | document.addEventListener('copy', this.handleCopy) |
| 435 | document.addEventListener('paste', this.handlePaste) |
| 436 | } |
| 437 | |
| 438 | onMouseOver (i, j) { |
| 439 | if (this.state.selecting && isEmpty(this.state.editing)) { |
no test coverage detected