Fix keypress events in editor