74 lines
3.7 KiB
HTML
74 lines
3.7 KiB
HTML
|
|
<!DOCTYPE html>
|
|||
|
|
<html>
|
|||
|
|
<head>
|
|||
|
|
<title>markdown test</title>
|
|||
|
|
<meta charset="utf-8" />
|
|||
|
|
<script type="text/javascript" src="../../static/global/plugins/jquery.min.js"></script>
|
|||
|
|
<link rel="stylesheet" href="../../static/global/plugins/editor.md-master/css/editormd.css" />
|
|||
|
|
<script type="text/javascript" src="../../static/global/plugins/editor.md-master/editormd.js"></script>
|
|||
|
|
<script type="text/javascript">
|
|||
|
|
//初始化编辑器
|
|||
|
|
var testEditor;
|
|||
|
|
$(function () {
|
|||
|
|
testEditor = editormd("editormd-help", {
|
|||
|
|
width: "100%",
|
|||
|
|
height: 740,
|
|||
|
|
path: '../../static/global/plugins/editor.md-master/lib/',
|
|||
|
|
toolbarIcons:function(){
|
|||
|
|
return ["undo","redo","|","bold","del","italic","quote","ucwords","uppercase","lowercase","|","h1","h2","h3","h4","h5","h6","|","list-ul","list-ol","hr","link","reference-link","|","code-block","table","|","watch","clear","|","save"];
|
|||
|
|
},
|
|||
|
|
// 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标
|
|||
|
|
toolbarCustomIcons : {
|
|||
|
|
save : "<button type=\"button\" class=\"btn btn-primary\" onclick=\"javascript:saveHelpInfo()\">save</button>",
|
|||
|
|
},
|
|||
|
|
markdown: "",
|
|||
|
|
codeFold: true,
|
|||
|
|
syncScrolling : true, //编辑区和预览区同步滚动
|
|||
|
|
// //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。
|
|||
|
|
saveHTMLToTextarea: true, // 保存 HTML 到 Textarea
|
|||
|
|
searchReplace: true,
|
|||
|
|
watch : false, // 关闭实时预览
|
|||
|
|
htmlDecode: "style,script,iframe|on*", // 开启 HTML 标签解析,为了安全性,默认不开启
|
|||
|
|
emoji: true,
|
|||
|
|
taskList: true,
|
|||
|
|
tocm: true, // Using [TOCM]
|
|||
|
|
tex: true, // 开启科学公式TeX语言支持,默认关闭
|
|||
|
|
flowChart: true, // 开启流程图支持,默认关闭
|
|||
|
|
sequenceDiagram: true // 开启时序/序列图支持,默认关闭
|
|||
|
|
|
|||
|
|
});
|
|||
|
|
$("#edit_help_textarea").text(helpInfo);
|
|||
|
|
});
|
|||
|
|
function saveHelpInfo(){
|
|||
|
|
var helpInfoval=$("#edit_help_textarea").text();
|
|||
|
|
var alertObj=$(".alert");
|
|||
|
|
if(alertObj!=null&&alertObj!=undefined){
|
|||
|
|
alertObj.remove();
|
|||
|
|
}
|
|||
|
|
$.ajax({
|
|||
|
|
type: "POST",
|
|||
|
|
url: "/gwall/nis/sys/saveHelp",
|
|||
|
|
dataType:"json",
|
|||
|
|
data: "editedHelpInfo="+encodeURIComponent(encodeURIComponent(helpInfoval))+"&helpHrefVal="+encodeURIComponent(helpHrefVal),
|
|||
|
|
success: function(data){
|
|||
|
|
if(data){
|
|||
|
|
|
|||
|
|
$(".help").prepend("<div class=\"alert alert-success alert-dismissable\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"aria-hidden=\"true\">×</button>save successs</div>");
|
|||
|
|
}else{
|
|||
|
|
$(".help").prepend("<div class=\"alert alert-danger alert-dismissable\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"aria-hidden=\"true\">×</button>save faild</div>");
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
error:function(msg){
|
|||
|
|
$(".help").prepend("<div class=\"alert alert-danger alert-dismissable\"><button type=\"button\" class=\"close\" data-dismiss=\"alert\"aria-hidden=\"true\">×</button>save faild</div>");
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
</script>
|
|||
|
|
</head>
|
|||
|
|
<body>
|
|||
|
|
<div id="editormd-help">
|
|||
|
|
<textarea style="display:none;" id="edit_help_textarea"></textarea>
|
|||
|
|
</div>
|
|||
|
|
</body>
|
|||
|
|
</html>
|