jsdit富文本编辑器的踩坑之路
总体来说这个富文本编辑器还挺好使用的;但是中文文档不全,使用起来必须看
文档地址:传送门
一 如何使用
npm 安装
-
npm install jodit
-
CDN使用方法
-
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jodit/3.1.39/jodit.min.css">
-
<script src="//cdnjs.cloudflare.com/ajax/libs/jodit/3.1.39/jodit.min.js"></script>
-
Self-hosted · Download files
-
<link rel="stylesheet" href="build/jodit.min.css">
-
<script src="build/jodit.min.js"></script>
-
使用:
-
html:<textarea id="editor" name="editor"></textarea>或<div id="editor"></div>
-
js:
-
var editor = new Jodit('#editor');
-
jquery:
-
$('textarea').each(function () {
-
var editor = new Jodit(this);
-
editor.value = '<p>start</p>';
二 组件中使用
import 'jodit/build/jodit.min.css'
import {JoditVue } from 'jodit-vue'