marijnh/CodeMirror2 — Issue #408: Mouse Events 
Author: zz85
Created: 2012-03-02 14:53:59+00:00
State: open

While trying to implement a slider value tool with CodeMirror, I found it difficult to detect whether a cursor activity (`onCursorActivity`) event was generated by the mouse or by the keyboard.

Live link: http://jabtunes.com/labs/graphics/glslslider

Is there a suggested way that this could be done cleanly from the API, or would it be better to add a onMouseEvent to the options?

I also noticed that after CodeMirror generates formated HTML elements, there's no way to map the DOM elements directly back to CodeMirror objects, rather the mouseCoordinates is passed to codeMirror to convert to the coordinates of where the DOM would be positioned. Is this understanding correct?

If the dom elements could point back to the code tokens, it might be easier to attach tools to the dom elements instead (eg. adding a tooltip when you mouseover certain keywords).

Other than that, its been a joy to be using CodeMirror so far! :)