Add Esc handler for editing regions mode
You could already press Esc when adding a region, now it’s also
supported when editing a region, both before and after selecting the
region to edit.
Note: I thought about extracting the “is this key event an Esc key” part
into a helper function, but realized that that’s not possible: for
removeEventListener, the function needs to have a fixed identity, you
can’t have a helper function returning a dynamically generated listener
that skips non-Esc events.