7 Star 14 Fork 3

小弟调调 / MDEditor

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Without author's permission, this code is only for learning and cannot be used for other purposes.
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

简易Markdownd编辑器

使用

预览MDEditor

  • 添加 MDEditor.min.css 样式
  • 添加 MDEditor.min.js 并不是 lib/MDEditor.js
  • 添加编辑器初始节点
  • 如果预加载长篇markdown文本必须嵌套 <textarea> 标签
<link rel="stylesheet" type="text/css" href="../themes/default/css/MDEditor.min.css">
<script type="text/javascript" src="../build/MDEditor.min.js"></script>
<div id="mdeditor">
<textarea># 这里放markdown初始值
- id: 节点id
- minheight: 初始化编辑器高度
- maxheight: 编辑器随着输入内容增多而变高,这个值是它的最大值
- value: 默认编辑器中显示markdown内容
</textarea>
</div>
<script type="text/javascript">
var mde = new MDEditor({
    id:"#mdeditor",
    minheight:300,
    maxheight:600,
    value:"#多多少少的"
}).load().input(function(evn,opts){
    console.log("evn:",evn)
    console.log("opts:",opts)
})
</script>

MDEditor初始化

  • id: 节点id
  • minheight: 初始化编辑器高度
  • maxheight: 编辑器随着输入内容增多而变高,这个值是它的最大值
  • value: 默认编辑器中显示markdown内容

load

加载编辑器

mde.load()  

preview

默认展示预览界面

mde.preview()  

input

输入事件,在编辑器里面输入内容就会执行input方法

mde.input(function(evn,opts){
    console.log("evn:",evn)
    console.log("opts:",opts)
})  

getMD

获取markdown的字符串

mde.getMD()  //=>返回markdown字符串

setMD

设置markdown的字符串

mde.setMD(val)  

getHTML

获取生成的HTML

mde.getHTML()  //=>返回HTML字符串

setHTML

设置预览的HTML

mde.setHTML(val)  

Repository Comments ( 2 )

Sign in to post a comment

About

简单的markdown编辑器 expand collapse
JavaScript and 4 more languages
Cancel

Releases

No release

MDEditor

Contributors

All

Activities

Load More
can not load any more
JavaScript
1
https://git.oschina.net/jaywcjlove/MDEditor.git
git@git.oschina.net:jaywcjlove/MDEditor.git
jaywcjlove
MDEditor
MDEditor
master

Search

161121 f78d6d6f 1850385 154831 86f8c370 1850385