Bugfix: should use events leaving editor.