This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
k18-ntcs-web-ntc/src/main/webapp/online-help/editHelp.html
wangwenrui ea13a037e8 新增编辑在帮助文档功能
(cherry picked from commit 1d5905fe47)
2019-01-28 20:12:11 +08:00

74 lines
3.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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\">&times;</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\">&times;</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\">&times;</button>save faild</div>");
}
});
}
</script>
</head>
<body>
<div id="editormd-help">
<textarea style="display:none;" id="edit_help_textarea"></textarea>
</div>
</body>
</html>