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