123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231 |
- <!DOCTYPE html>
- <html lang="zh">
- <head>
- <meta charset="utf-8" />
- <title>Full example - Editor.md examples</title>
- <link rel="stylesheet" href="css/style.css" />
- <link rel="stylesheet" href="../css/editormd.css" />
- <link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
- <style>
-
- </style>
- </head>
- <body>
- <div id="layout">
- <header>
- <h1>完整示例</h1>
- <p>Full example</p>
- <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>
- <li>Enable [TOCM], Search Replace, Code fold</li>
- </ul>
- </header>
- <div class="btns">
- <button id="goto-line-btn">Goto line 90</button>
- <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>
- <button id="preview-btn">Preview HTML (Press Shift + ESC cancel)</button>
- <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>
- <button id="toc-menu-btn">ToC Dropdown menu</button>
- <button id="toc-default-btn">ToC default</button>
- </div>
- <div id="test-editormd"></div>
- </div>
- <script src="js/jquery.min.js"></script>
- <script src="../editormd.js"></script>
- <script type="text/javascript">
- var testEditor;
-
- $(function() {
-
- $.get('test.md', function(md){
- testEditor = editormd("test-editormd", {
- width: "90%",
- height: 740,
- path : '../lib/',
- theme : "dark",
- previewTheme : "dark",
- editorTheme : "pastel-on-dark",
- markdown : md,
- codeFold : true,
-
- saveHTMLToTextarea : true,
- searchReplace : true,
-
- htmlDecode : "style,script,iframe|on*",
-
-
- emoji : true,
- taskList : true,
- tocm : true,
- tex : true,
- flowChart : true,
- sequenceDiagram : true,
-
-
-
-
-
- imageUpload : true,
- imageFormats : ["jpg", "jpeg", "gif", "png", "bmp", "webp"],
- imageUploadURL : "./php/upload.php",
- onload : function() {
- console.log('onload', this);
-
-
-
-
-
-
-
- }
- });
- });
-
- $("#goto-line-btn").bind("click", function(){
- testEditor.gotoLine(90);
- });
-
- $("#show-btn").bind('click', function(){
- testEditor.show();
- });
-
- $("#hide-btn").bind('click', function(){
- testEditor.hide();
- });
-
- $("#get-md-btn").bind('click', function(){
- alert(testEditor.getMarkdown());
- });
-
- $("#get-html-btn").bind('click', function() {
- alert(testEditor.getHTML());
- });
-
- $("#watch-btn").bind('click', function() {
- testEditor.watch();
- });
-
- $("#unwatch-btn").bind('click', function() {
- testEditor.unwatch();
- });
-
- $("#preview-btn").bind('click', function() {
- testEditor.previewing();
- });
-
- $("#fullscreen-btn").bind('click', function() {
- testEditor.fullscreen();
- });
-
- $("#show-toolbar-btn").bind('click', function() {
- testEditor.showToolbar();
- });
-
- $("#close-toolbar-btn").bind('click', function() {
- testEditor.hideToolbar();
- });
-
- $("#toc-menu-btn").click(function(){
- testEditor.config({
- tocDropdown : true,
- tocTitle : "目录 Table of Contents",
- });
- });
-
- $("#toc-default-btn").click(function() {
- testEditor.config("tocDropdown", false);
- });
- });
- </script>
- </body>
- </html>
|