Metrics
0
Watch 8 Star 12 Fork 1

netnr / netnrmdJavaScriptMIT

Sign up for free
Explore and code with more than 2 million developers,Free private repositories !:)
Sign up
NetnrMD编辑器(jQuery + Monaco Editor 编辑器 + Marked 解析 + DOMPurify 清洗 + highlight 代码高亮) spread retract

https://md.netnr.com

Clone or download
index.html 2.78 KB
Copy Edit Web IDE Raw Blame History
netnr authored 2019-08-22 09:02 . 2.2.2
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<title>NetnrMD编辑器</title>
<meta name="keywords" content="netnr,NET牛人,markdown,NetnrMD编辑器" />
<meta name="description" content="NetnrMD编辑器(jQuery + Monaco Editor 编辑器 + Marked 解析 + DOMPurify 清洗 + highlight 代码高亮)" />
</head>
<body>
<div>
<div id="editor"></div>
</div>
<script src="https://lib.baomitu.com/jquery/3.3.1/jquery.min.js"></script>
<link href="src/netnrmd.css?2.2.2" rel="stylesheet" />
<script src="/src/netnrmd.bundle.min.js?2.2.2"></script>
<script src="/src/netnrmd.extend.js?2.2.2"></script>
<script src="https://code.bdstatic.com/npm/monaco-editor@0.17.0/min/vs/loader.js"></script>
<script>
require.config({
paths: { vs: "https://code.bdstatic.com/npm/monaco-editor@0.17.0/min/vs" },
'vs/nls': { availableLanguages: { '*': 'zh-cn' } }
});
require(['vs/editor/editor.main'], function () {
window.nmd = new netnrmd('#editor', {
//加载扩展功能
//渲染前回调
viewbefore: function () {
this.items.splice(14, 0, netnrmd.extend.upload.button);
this.items.splice(15, 0, netnrmd.extend.import.button);
this.items.splice(17, 0, netnrmd.extend.about.button);
this.items.splice(0, 0, netnrmd.extend.emoji.button);
},
//命令回调
cmdcallback: function (cmd) {
switch (cmd) {
case "about":
case "emoji":
case "upload":
case "import":
netnrmd.extend[cmd].action(this)
break;
}
}
});
//加载默认值
var lsmd = localStorage.getItem("netnrmd_markdown");
if (!(lsmd && lsmd.trim() != "")) {
fetch('https://md.netnr.com/README.md').then(function (res) {
if (res.status == 200) {
res.text().then(function (md) {
nmd.setmd(md);
})
}
})
}
//高度沉底
$(window).on('load resize', function () {
var vh = $(window).height() - nmd.obj.container.offset().top - 15;
nmd.height(Math.max(100, vh));
})
});
</script>
</body>
</html>

Comment ( 0 )

You need to Sign in for post a comment

JavaScript
1
https://gitee.com/netnr/netnrmd.git
git@gitee.com:netnr/netnrmd.git

Help Search