玛氪宕·梦魔(Markdown Memo),使用Markdown的云端备忘录,百度IFE的RIA启航班的不合格的作业,才……才没有什么阴谋呢! 源gitee链接https://gitee.com/arathi/MarkdownMemo?_from=gitee_search
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
8.0 KiB

10 years ago
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="utf-8" />
10 years ago
<title>Using require.js - Editor.md examples</title>
10 years ago
<link rel="stylesheet" href="css/style.css" />
10 years ago
<link rel="stylesheet" href="../lib/codemirror/codemirror.min.css" />
10 years ago
<!-- <link rel="stylesheet" href="../lib/codemirror/addon/fold/foldgutter.css" /> -->
<link rel="stylesheet" href="../css/editormd.min.css" />
<link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
10 years ago
</head>
<body>
<div id="layout">
<header>
10 years ago
<h1>Using require.js</h1>
10 years ago
<ul style="margin: 10px 0 0 18px;">
<li>Enable HTML tags decode</li>
<li>Enable TeX, Flowchart, Sequence Diagram, Emoji, FontAwesome, Task lists</li>
<li>Enable Image upload</li>
10 years ago
<li>Enable [TOCM], Search Replace, Code fold</li>
10 years ago
</ul>
10 years ago
</header>
<div class="btns">
10 years ago
<button id="show-btn">Show editor</button>
<button id="hide-btn">Hide editor</button>
<button id="get-md-btn">Get Markdown</button>
<button id="get-html-btn">Get HTML</button>
<button id="watch-btn">Watch</button>
<button id="unwatch-btn">Unwatch</button>
10 years ago
<button id="preview-btn">Preview HTML (Press Shift + ESC cancel)</button>
10 years ago
<button id="fullscreen-btn">Fullscreen (Press ESC cancel)</button>
<button id="show-toolbar-btn">Show toolbar</button>
<button id="close-toolbar-btn">Hide toolbar</button>
10 years ago
<button id="toc-menu-btn">ToC Dropdown menu</button>
<button id="toc-default-btn">ToC default</button>
10 years ago
</div>
10 years ago
<div id="test-editormd"></div>
10 years ago
</div>
10 years ago
<script src="js/require.min.js"></script>
10 years ago
<script type="text/javascript">
10 years ago
requirejs.config({
baseUrl: "../lib/",
paths: {
10 years ago
jquery : "../examples/js/jquery.min",
marked : "marked.min",
prettify : "prettify.min",
raphael : "raphael.min",
underscore : "underscore.min",
flowchart : "flowchart.min",
jqueryflowchart : "jquery.flowchart.min",
sequenceDiagram : "sequence-diagram.min",
10 years ago
katex : "//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.1.1/katex.min",
10 years ago
editormd : "../editormd.amd" // Using Editor.md amd version for Require.js
10 years ago
},
waitSeconds: 30
});
10 years ago
var deps = [
"editormd",
"../languages/en",
"../plugins/link-dialog/link-dialog",
10 years ago
"../plugins/reference-link-dialog/reference-link-dialog",
10 years ago
"../plugins/image-dialog/image-dialog",
"../plugins/code-block-dialog/code-block-dialog",
"../plugins/table-dialog/table-dialog",
"../plugins/emoji-dialog/emoji-dialog",
10 years ago
"../plugins/goto-line-dialog/goto-line-dialog",
10 years ago
"../plugins/help-dialog/help-dialog",
"../plugins/html-entities-dialog/html-entities-dialog",
"../plugins/preformatted-text-dialog/preformatted-text-dialog"
];
var testEditor;
10 years ago
10 years ago
require(deps, function(editormd) {
// if enable codeFold
// or <link rel="stylesheet" href="../lib/codemirror/addon/fold/foldgutter.css" />
editormd.loadCSS("../lib/codemirror/addon/fold/foldgutter");
$.get('test.md', function(md) {
testEditor = editormd("test-editormd", {
width: "90%",
height: 640,
path : '../lib/',
markdown : md,
codeFold : true,
searchReplace : true,
10 years ago
saveHTMLToTextarea : true, // 保存HTML到Textarea
10 years ago
htmlDecode : "style,script,iframe|on*", // 开启HTML标签解析,为了安全性,默认不开启
10 years ago
emoji : true,
taskList : true,
tex : true,
10 years ago
tocm : true, // Using [TOCM]
10 years ago
autoLoadModules : false,
previewCodeHighlight : true,
flowChart : true,
sequenceDiagram : true,
//dialogLockScreen : false, // 设置弹出层对话框不锁屏,全局通用,默认为true
//dialogShowMask : false, // 设置弹出层对话框显示透明遮罩层,全局通用,默认为true
//dialogDraggable : false, // 设置弹出层对话框不可拖动,全局通用,默认为true
//dialogMaskOpacity : 0.4, // 设置透明遮罩层的透明度,全局通用,默认值为0.1
//dialogMaskBgColor : "#000", // 设置透明遮罩层的背景颜色,全局通用,默认为#fff
imageUpload : true,
imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
imageUploadURL : "./php/upload.php",
onload : function() {
console.log('onload', this);
//this.fullscreen();
//this.unwatch();
//this.watch().fullscreen();
10 years ago
10 years ago
//this.setMarkdown("#PHP");
//this.width("100%");
//this.height(480);
//this.resize("100%", 640);
}
10 years ago
});
});
10 years ago
10 years ago
$("#show-btn").bind('click', function(){
testEditor.show();
});
10 years ago
10 years ago
$("#hide-btn").bind('click', function(){
testEditor.hide();
});
10 years ago
10 years ago
$("#get-md-btn").bind('click', function(){
alert(testEditor.getMarkdown());
});
10 years ago
10 years ago
$("#get-html-btn").bind('click', function() {
alert(testEditor.getHTML());
});
10 years ago
10 years ago
$("#watch-btn").bind('click', function() {
testEditor.watch();
});
10 years ago
10 years ago
$("#unwatch-btn").bind('click', function() {
testEditor.unwatch();
});
10 years ago
10 years ago
$("#preview-btn").bind('click', function() {
testEditor.previewing();
});
10 years ago
10 years ago
$("#fullscreen-btn").bind('click', function() {
testEditor.fullscreen();
});
10 years ago
10 years ago
$("#show-toolbar-btn").bind('click', function() {
testEditor.showToolbar();
});
10 years ago
10 years ago
$("#close-toolbar-btn").bind('click', function() {
testEditor.hideToolbar();
});
10 years ago
$("#toc-menu-btn").click(function(){
testEditor.config({
tocDropdown : true,
tocTitle : "目录 Table of Contents",
});
});
$("#toc-default-btn").click(function() {
testEditor.config("tocDropdown", false);
});
10 years ago
});
</script>
</body>
</html>