本文采用Quill富文本编辑器
开始:
首先引入css和js
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
body内添加控件
<div id="editor-container"></div>
编写js代码
var quill = new Quill('#editor-container', {
modules: {
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline'],
['image', 'code-block']
]
},
placeholder: 'Compose an epic...',
theme: 'snow' // or 'bubble'
});
这样一个简单的编辑器就完成了,然后调整控件的高度就行了