✨ feat: 更新问题页面和提交页面,集成Vditor适配器,优化Markdown渲染
This commit is contained in:
@@ -65,30 +65,25 @@
|
||||
<!-- Placed at the end of the document so the pages load faster -->
|
||||
<?php include("template/$OJ_TEMPLATE/js.php");?>
|
||||
|
||||
<script src="<?php echo $OJ_CDN_URL?>ace/ace.js"></script>
|
||||
<script src="<?php echo $OJ_CDN_URL?>ace/ext-language_tools.js"></script>
|
||||
<script src="include/vditor-adapter.js"></script>
|
||||
<script>
|
||||
$("#language").on("change",changeLanguage);
|
||||
//初始化对象
|
||||
editor = ace.edit("code");
|
||||
editor = HustOJVditor.createDeferredCodeEditor({
|
||||
container: "code",
|
||||
sourceField: "source",
|
||||
readOnly: <?php echo $readOnly ?>,
|
||||
theme: "ace/theme/clouds",
|
||||
fontSize: 18
|
||||
});
|
||||
|
||||
//设置风格和语言(更多风格和语言,请到github上相应目录查看)
|
||||
theme = "clouds"
|
||||
language = "c_cpp"
|
||||
editor.setTheme("ace/theme/" + theme);
|
||||
editor.session.setMode("ace/mode/" + language);
|
||||
|
||||
//字体大小
|
||||
editor.setFontSize(18);
|
||||
|
||||
//设置只读(true时只读,用于展示代码)
|
||||
editor.setReadOnly(<?php echo $readOnly ?>);
|
||||
|
||||
//自动换行,设置为off关闭
|
||||
editor.setOption("wrap", "free")
|
||||
|
||||
//启用提示菜单
|
||||
ace.require("ace/ext/language_tools");
|
||||
editor.setOptions({
|
||||
enableBasicAutocompletion: true,
|
||||
enableSnippets: true,
|
||||
|
||||
Reference in New Issue
Block a user