Hi, I am working on a personal project using CodeMirror for a text commenting app. My idea is to add a custom gutter element through:
gutters: [“CodeMirror-linenumbers”, “my-gutter-elem”].
The custom gutter element (position: relative) has a child div (position: absolute) to show/edit the comments. When the gutter line number was clicked, the div is shown on top of the editor area. But I found that the mouse clicking and keyboard events are all captured by the editor instead of my div, even if I set my div a higher z-index. When double clicking my div the CodeMirror editor lines was highlighted, not my div, and I am not able to type in any keys. How can I make it work so my div can receive mouse/keyboard events?
Here is the relevant runtime html elements:
<div class="CodeMirror-gutter-wrapper" style="left: -51px; width: 51px;">
<div class="CodeMirror-linenumber CodeMirror-gutter-elt" style="left: 0px; width: 26px;">12</div>
<div class="CodeMirror-gutter-elt" style="left: 34px; width: 16px;">
<div class="mywrapper" style="left: 50px; position: absolute;">
<div class="dialog">
<div>
<textarea cols="80" rows="5">You can comment here</textarea>
<input type="button" value="Save">
<input type="button" value="Cancel">
</div>
</div>
</div>
</div>
</div>
Thanks a lot!