We are using CodeMirror for the INGInious automated code grader. I am currently looking at a solution to provide context code to the students and let them fill in the holes.
For example, a function signature could be provided. This example works quite well thanks to text marks made read-only (see https://jsfiddle.net/31z582dk/1).
I am however stumbling on how to make text read-only except for a single line expression to be filled in. For example if they have to fill the condition of an if statement.
Is there a way to prevent insertion of line breaks in a non-readOnly section ?
I will also need a way to extract the answer code between the provided code. I guess I could iterate over the marks and collect the n-1 (mark[n].end, mark[n+1].start) intervals.
Do you know of any similar uses of CodeMirror ?