educoder/app/views/common/_file.html.erb

32 lines
1.5 KiB
Plaintext

<%= javascript_include_tag "/codemirror/lib/codemirror", "/codemirror/mode/javascript/javascript", "/codemirror/addon/hint/show-hint", "/codemirror/addon/hint/javascript-hint", "/codemirror/addon/selection/active-line", "/codemirror/addon/lint/javascript-lint", "/codemirror/addon/lint/css-lint", "/codemirror/addon/lint/lint", "/codemirror/addon/lint/json-lint", "/editormd/lib/codemirror/addon/lint/css-lint" %>
<%= stylesheet_link_tag "/codemirror/lib/codemirror" %>
<style type="text/css">
.CodeMirror{line-height: 1.2; font-size: 14px}
.cm-s-railscasts span.cm-error{background:none;color: #d4cfc9;}
</style>
<div class="autoscroll_new">
<table class="filecontent syntaxhl mt5" style="width:100%">
<tbody>
<li class="clearfix" xmlns="http://www.w3.org/1999/html" id="edit_code_contents">
<textarea class="" id="content_shixun_show" name="content"><%= Redmine::CodesetUtil.replace_invalid_utf8(content) %></textarea>
</li>
</tbody>
</table>
</div>
<script>
var shixun_show_CodeMirror = CodeMirror.fromTextArea(document.getElementById("content_shixun_show"), {
lineNumbers: true,
theme: "railscasts",
// extraKeys: {"Ctrl-Q": "autocomplete"}, // 快捷键
indentUnit: 4, //代码缩进为一个tab的距离
matchBrackets: true,
autoRefresh: true,
smartIndent: true,//智能换行
styleActiveLine: true,
lint: true,
readOnly: "nocursor"
});
$(function(){
shixun_show_CodeMirror.setSize("auto","auto");
});
</script>