✨ feat: 更新问题页面和提交页面,集成Vditor适配器,优化Markdown渲染
This commit is contained in:
@@ -1,48 +1,25 @@
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="../kindeditor/themes/default/default.css" />
|
||||
<link rel="stylesheet" href="../kindeditor/plugins/code/prettify.css" />
|
||||
<script charset="utf-8" src="../kindeditor/kindeditor.js"></script>
|
||||
<script charset="utf-8" src="../kindeditor/lang/zh_CN.js"></script>
|
||||
<script charset="utf-8" src="../kindeditor/plugins/code/prettify.js"></script>
|
||||
<script src="../include/vditor-adapter.js"></script>
|
||||
<script>
|
||||
$(document).ready(window.setTimeout(function (){
|
||||
KindEditor.ready(function(K) {
|
||||
let editor1 = K.create('textarea[class="kindeditor"]', {
|
||||
width : '100%',
|
||||
cssPath : '../kindeditor/plugins/code/prettify.css',
|
||||
uploadJson : '../kindeditor/php/upload_json.php',
|
||||
fileManagerJson : '../kindeditor/php/file_manager_json.php',
|
||||
allowFileManager : false,
|
||||
filterMode:false,
|
||||
cssData: 'body { font-family:"Consolas";font-size: 18px;line-height:150% } ',
|
||||
// <?php if(isset($OJ_MARKDOWN)&&$OJ_MARKDOWN)
|
||||
// echo "designMode:false,";
|
||||
// ?>
|
||||
|
||||
afterCreate : function() {
|
||||
var self = this;
|
||||
K.ctrl(document, 13, function() {
|
||||
self.sync();
|
||||
});
|
||||
K.ctrl(self.edit.doc, 13, function() {
|
||||
self.sync();
|
||||
});
|
||||
$(document).ready(function () {
|
||||
HustOJVditor.initTextareaVditors({
|
||||
selector: 'textarea.kindeditor',
|
||||
uploadUrl: '../kindeditor/php/upload_json.php',
|
||||
accept: '*/*',
|
||||
mode: 'sv',
|
||||
preview: {
|
||||
mode: 'both',
|
||||
delay: 0,
|
||||
actions: [],
|
||||
markdown: {
|
||||
sanitize: false,
|
||||
autoSpace: false,
|
||||
fixTermTypo: false
|
||||
}
|
||||
,
|
||||
afterBlur: function() {
|
||||
var self = this;
|
||||
self.sync();
|
||||
}
|
||||
|
||||
,
|
||||
afterChange: function() {
|
||||
var self = this;
|
||||
self.sync();
|
||||
if( typeof sync === "function") sync();
|
||||
}
|
||||
});
|
||||
// prettyPrint();
|
||||
}
|
||||
}).catch(function (error) {
|
||||
console.error('Failed to initialize Vditor.', error);
|
||||
});
|
||||
}),100);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user