目錄
一、文檔
1、Editor.md官網
1、Editor.md官網:http://editor.md.ipandao.com/examples/index.html
【Basic,自定義 Customs,Markdown Extras,Image Upload,事件處理 Events handle】 這些功能的Demo都在這個頁面。
2、常用Demo
1、簡單示例 Simple example http://editor.md.ipandao.com/examples/simple.html
2、完整示例 Full example http://editor.md.ipandao.com/examples/full.html
3、變化監聽處理 Onchange event(一般用於給隱藏框賦值,然後把數據(html/markdown)提交到後臺)
4、Demo查看
1、選擇需要查看的示例,點擊進去。
2、鼠標右鍵 -> 查看頁面源代碼。<script>裏就有使用方法。
二、使用
1、實例化
1、引入css
<link rel="stylesheet" href=".../editormd/css/editormd.css" />
2、引入js(需要先引入jquery)
<script src=".../lib/jquery.js"></script>
<script src=".../editormd/editormd.min.js"></script>
3、定義html接收容器
<div id="markdown-editor">
<textarea style="display:none;"></textarea>
</div>
4、實例化 Editor.md 對象。
mkEditorObject = editormd("markdown-editor", {
width : "100%",
height : "530px",
path : ".../editormd/lib/", //擴展的加載路徑
});
2、常用方法,更多方法可查看 完整示例 Full example http://editor.md.ipandao.com/examples/full.html
mkEditorObject.getHTML() //獲取 html數據
mkEditorObject.getMarkdown()//獲取 markdown數據
mkEditorObject.hide() //隱藏Markdown富文本:
mkEditorObject.show() //顯示Markdown富文本: