codemirror / CodeMirror-v1

An editable-iframe based code editor in JavaScript. See https://github.com/marijnh/CodeMirror for the currently maintained version
http://codemirror.net/
Other
362 stars 63 forks source link

added setUserKeyHandler #32

Closed razie closed 13 years ago

razie commented 13 years ago

Hi - i've done this long time ago and was thinking to sync my old branch - is this something you're willing to pull into the main branch?

i needed this to add content assist and other functionality - see it running at http://tryscala.org

let me know please, Razie

marijnh commented 13 years ago

Hi Razie,

Couldn't this behaviour also be created by just adding a key handler that always stops even propagation, and then unregistering it again when done?

Best, Marijn

razie commented 13 years ago

sorry - I've done this so long ago I don't remember how event processing is done in CM :) Is this described somewhere - I'm not sure how your suggestion would work...

marijnh commented 13 years ago

The idea is that you use your event-handler-registration of choice (every JS framework defines one) to add keydown and keypress events to instance.win.document , and do what you need to do in those.