Fix key bindings for the diff viewer.

Key bindings didn't always work, due to where they were registered.
They're now registered on the document instead of the element, as they
used to be before the rewrite.

On top of that, the key binding code now filters out any keys pressed on
input or textarea elements.