Bug fixed in javascript editor.

The capture mode switch function didn't remove the listener from
the key driver. It's fixed.