实训codemirror加入语言
This commit is contained in:
parent
d3ca33f551
commit
1d60514d9f
|
@ -37,7 +37,7 @@ module ApplicationHelper
|
|||
def language_switch language
|
||||
case language
|
||||
when "Java"
|
||||
"text/c-java"
|
||||
"text/x-java"
|
||||
when "C"
|
||||
"text/x-csrc"
|
||||
when "C++"
|
||||
|
|
|
@ -272,7 +272,7 @@
|
|||
}
|
||||
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("challenge_answer"), {
|
||||
mode: {name: 'text/x-<%= @language %>',
|
||||
mode: {name: '<%= @language %>',
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
lineNumbers: true,
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
var tpmMirror = $("#tpm_answer_show")[0];
|
||||
var TpmCodeMirror = CodeMirror(tpmMirror, {
|
||||
value: $("#hidden_tpm_answer_show").text(),
|
||||
mode: "text/x-java",
|
||||
mode: "<%= @language %>",
|
||||
readOnly: "nocursor", //只读,并隐藏光标
|
||||
//cursorBlinkRate: -1, //隐藏光标
|
||||
autofocus: true,
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
var ExtendMirror = $("#extend_game_answer_show")[0];
|
||||
var ExtendCodeMirror = CodeMirror(ExtendMirror, {
|
||||
value: $("#hidden_extend_game_answer").text(),
|
||||
mode: "text/x-java",
|
||||
mode: "<%= @language %>",
|
||||
readOnly: "nocursor", //只读
|
||||
//cursorBlinkRate: -1, //隐藏光标
|
||||
autofocus: true,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("challenge-file-edit"), {
|
||||
mode: {name: 'text/x-ruby',
|
||||
mode: {name: '<%= @language %>',
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
lineNumbers: true,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
var editor_CodeMirror = CodeMirror.fromTextArea(document.getElementById("challenge-answer-edit-small"), {
|
||||
mode: {name: 'text/x-<%= @language %>',
|
||||
mode: {name: '<%= @language %>',
|
||||
version: 2,
|
||||
singleLineStringErrors: false},
|
||||
lineNumbers: true,
|
||||
|
@ -30,6 +30,6 @@
|
|||
$("#challenge-answer-edit-small" ).nextAll(".CodeMirror").css("line-height", 1.2);
|
||||
$(document).ready(function(){
|
||||
// 设置codemirror的高度/宽度自适应
|
||||
editor_CodeMirror.setSize("auto",residue_h+55+"px")
|
||||
editor_CodeMirror.setSize("auto",residue_h+50+"px")
|
||||
});
|
||||
</script>
|
|
@ -51,7 +51,7 @@
|
|||
var myMirror = $("#game_answer_show")[0];
|
||||
var myCodeMirror = CodeMirror(myMirror, {
|
||||
value: $("#hidden_game_answer").text(),
|
||||
mode: "text/x-<%= @language %>",
|
||||
mode: "<%= @language %>",
|
||||
readOnly: "nocursor", //只读
|
||||
//cursorBlinkRate: -1, //隐藏光标
|
||||
autofocus: true,
|
||||
|
|
Loading…
Reference in New Issue