Escape key handling

If the user clicks Escape while editing, the edit is cancelled and the
target text is reverted back to its previous state.