(view, from, to, text)
| 571 | return this.getState(state) |
| 572 | }, |
| 573 | handleTextInput (view, from, to, text) { |
| 574 | if (text !== '[') return false |
| 575 | |
| 576 | const { state } = view |
| 577 | const charBefore = state.doc.textBetween(Math.max(from - 1, 0), from) |
| 578 | |
| 579 | if (charBefore !== '[') return false |
| 580 | |
| 581 | const tr = state.tr.insertText('[]]', from, to) |
| 582 | |
| 583 | tr.setSelection(state.selection.constructor.create(tr.doc, from + 1)) |
| 584 | |
| 585 | view.dispatch(tr) |
| 586 | |
| 587 | return true |
| 588 | } |
| 589 | } |
| 590 | }) |
| 591 | ] |