File tree Expand file tree Collapse file tree 1 file changed +13
-12
lines changed
src/uLearn.Web/Views/Course Expand file tree Collapse file tree 1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change 56
56
cm .showHint ({ hint: CodeMirror .hint .csharp });
57
57
}
58
58
59
- function codeMirrorClass (c , theme ) {
59
+ function codeMirrorClass (c , editable ) {
60
60
var codes = document .getElementsByClassName (c);
61
61
for (var i = 0 ; i < codes .length ; i++ )
62
62
CodeMirror .fromTextArea (codes[i],
63
- {
64
- mode: " text/x-csharp" ,
65
- lineNumbers: true ,
66
- theme: theme,
67
- indentWithTabs: true ,
68
- tabSize: 4 ,
69
- indentUnit: 4 ,
70
- extraKeys: { " Ctrl-Space" : " autocomplete" },
71
- });
63
+ {
64
+ mode: " text/x-csharp" ,
65
+ lineNumbers: true ,
66
+ theme: editable ? " cobalt" : " default" ,
67
+ indentWithTabs: true ,
68
+ tabSize: 4 ,
69
+ indentUnit: 4 ,
70
+ extraKeys: { " Ctrl-Space" : " autocomplete" },
71
+ readOnly: editable ? false : " nocursor" ,
72
+ });
72
73
}
73
74
74
- codeMirrorClass (" code-exercise" , " cobalt " );
75
- codeMirrorClass (" code-sample" , " default " );
75
+ codeMirrorClass (" code-exercise" , true );
76
+ codeMirrorClass (" code-sample" , false );
76
77
</script >
77
78
}
You can’t perform that action at this time.
0 commit comments