Pass editor as first parameter to event handlers. Add test