Clearer document events handlers binding

Event handlers are called with the element as `this`.

Binding this way, we must figure out the editor instance somehow. See below for how this was done.