This won't deregister anything – you have to tell it what function to deregister.  Which means you have to save that closure from line 42.  It might be easier to make that a top-level function, and then see if you can extract the `editor` object from the event (instead of using the closure to save the editor instance).