1.0.4 • Published 7 years ago
plus-editor.md v1.0.4
plus-editor.md
Usage
<!-- iconfont -->
<link href="https://cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
<!-- css -->
<link rel="stylesheet" href="./dist/pluseditor.css">
<!-- node -->
<textarea id="editor" style="display: none"></textarea>
<!-- js -->
<script src='./dist/pluseditor.js'></script>
var options = {
element: document.querySelector('#editor'),
/**
* 自定义 MD 解析, FilesPatch
* @type {String}
*/
fileApiPath: "http://localhost/api/v2/files/",
/**
* 自定义文件上传
* @param {Object} file
* @param {Function} cb
*/
uploadFile: function(file, cb){
console.log(file);
cb(ID);
}
}
var editor = new PlusEditor(options);
语法高亮需要添加
editor.gui.sideBySide.classList.add('markdown-body');
Get/set the content
editor.value();
editor.value("This text will appear in the editor");