| 56 | } |
| 57 | |
| 58 | function inputEventHandler(evt) { |
| 59 | const v = evt.target.value; |
| 60 | // console.log(evt, 'v:', v); |
| 61 | const { suggest, textlineEl, validator } = this; |
| 62 | const { cell } = this; |
| 63 | if (cell !== null) { |
| 64 | if (('editable' in cell && cell.editable === true) || (cell.editable === undefined)) { |
| 65 | this.inputText = v; |
| 66 | if (validator) { |
| 67 | if (validator.type === 'list') { |
| 68 | suggest.search(v); |
| 69 | } else { |
| 70 | suggest.hide(); |
| 71 | } |
| 72 | } else { |
| 73 | const start = v.lastIndexOf('='); |
| 74 | if (start !== -1) { |
| 75 | suggest.search(v.substring(start + 1)); |
| 76 | } else { |
| 77 | suggest.hide(); |
| 78 | } |
| 79 | } |
| 80 | textlineEl.html(v); |
| 81 | resetTextareaSize.call(this); |
| 82 | this.change('input', v); |
| 83 | } else { |
| 84 | evt.target.value = ''; |
| 85 | } |
| 86 | } else { |
| 87 | this.inputText = v; |
| 88 | if (validator) { |
| 89 | if (validator.type === 'list') { |
| 90 | suggest.search(v); |
| 91 | } else { |
| 92 | suggest.hide(); |
| 93 | } |
| 94 | } else { |
| 95 | const start = v.lastIndexOf('='); |
| 96 | if (start !== -1) { |
| 97 | suggest.search(v.substring(start + 1)); |
| 98 | } else { |
| 99 | suggest.hide(); |
| 100 | } |
| 101 | } |
| 102 | textlineEl.html(v); |
| 103 | resetTextareaSize.call(this); |
| 104 | this.change('input', v); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | function setTextareaRange(position) { |
| 109 | const { el } = this.textEl; |