there are multiple ways to get change notifications
editor.on("input", function() {}) // fires async similar to textarea input event
editor.on("change", function() {}) or editor.session.on("change" // fires synchronously during change event, there can be multiple change events for one keypress
editor.textInput.getElement() // the focused textarea
or editor.container.addEventListent("keypress", fn, true)