diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2a9f5e6e2..48f1ca88f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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++" diff --git a/app/views/challenges/_form.html.erb b/app/views/challenges/_form.html.erb index ad9b4983a..4d1137e7c 100644 --- a/app/views/challenges/_form.html.erb +++ b/app/views/challenges/_form.html.erb @@ -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, diff --git a/app/views/challenges/show.html.erb b/app/views/challenges/show.html.erb index 232f74ef8..579ebb8c1 100644 --- a/app/views/challenges/show.html.erb +++ b/app/views/challenges/show.html.erb @@ -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, diff --git a/app/views/games/_desc_full_show.html.erb b/app/views/games/_desc_full_show.html.erb index e02b8cf87..cabef0388 100644 --- a/app/views/games/_desc_full_show.html.erb +++ b/app/views/games/_desc_full_show.html.erb @@ -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, diff --git a/app/views/games/_extend_file_edit_form.html.erb b/app/views/games/_extend_file_edit_form.html.erb index 16fc5626f..0bedab597 100644 --- a/app/views/games/_extend_file_edit_form.html.erb +++ b/app/views/games/_extend_file_edit_form.html.erb @@ -13,7 +13,7 @@ \ No newline at end of file diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 2fc8574f0..5c3a9d750 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -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,