wangEditor 富文本编辑器
<!--富文本框--><script type="text/javascript" src="_SKIN_/wangEditor/index.js"></script>
<script>
const E = window.wangEditor
const LANG = location.href.indexOf('lang=en') > 0 ? 'en' : 'zh-CN'
E.i18nChangeLanguage(LANG)
window.editor = E.createEditor({
selector: '#editor-text-area',
html: '<p><br></p>',
config: {
placeholder: '文章内容...',
MENU_CONF: {
uploadImage: {
server: '/admin/controller/upload/image',
fieldName: 'file',
base64LimitSize: 10 * 1024 * 1024,// 10M 以下插入 base64
// 最多可上传几个文件,默认为 100
maxNumberOfFiles: 10,
// 单个文件的最大体积限制,默认为 2M
maxFileSize: 1024 * 1024, // 1M
// 选择文件时的类型限制,默认为 ['image/*'] 。如不想限制,则设置为 []
allowedFileTypes: ['image/*'],
}
},
onChange(editor) {
const html = editor.getHtml()
// document.getElementById('editor-content-view').innerHTML = html
document.getElementById('editor-content-textarea').value = html
}
}
})
window.toolbar = E.createToolbar({
editor,
selector: '#editor-toolbar',
config: {}
})
</script>
<script type="text/javascript">varE=window.wangEditorvareditor=newE('#editor')//或者vareditor=newE(document.getElementById('editor'))editor.create()</script><div style="border: 1px solid #ccc;">
<div id="editor-toolbar" style="border-bottom: 1px solid #ccc;"></div>
<div id="editor-text-area" style="height: 350px"></div>
</div>
<input type="hidden" id="editor-content-textarea" name="content">
<!-- 富文本内容转换html和txt内容 -->
<!-- <div style="margin-top: 20px;">-->
<!-- <textarea id="editor-content-textarea" style="width: 100%; height: 100px; outline: none;" readonly></textarea>-->
<!-- </div>-->
<!-- <div id="editor-content-view" class="editor-content-view"></div>-->
页:
[1]