h5 富文本編輯器


第一種:wangEditor(地址:https://www.kancloud.cn/wangfupeng/wangeditor3/332599

首先需要引入js

<script type="text/javascript" src="https://unpkg.com/wangeditor@3.1.1/release/wangEditor.min.js"></script>
 
其次在頁面中定義
<div id="editor"> </div>
 
然后在js中
<script type="text/javascript">
    var E = window.wangEditor
    var editor = new E('#editor')
    // 或者 var editor = new E( document.getElementById('editor') )
    editor.create()
 
    console.log(editor.txt.text())//獲取富文本編輯器的值
</script>
 
第二種:ueditor (最新版地址: http://ueditor.baidu.com/website/download.html#ueditor)
百度網盤中有
 
第一步:引入文件
<script type="text/javascript" charset="gbk" src="ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="gbk" src="ueditor/ueditor.all.min.js"></script>
 
第二步:html文件
<script id="editor" type="text/plain" style="width:400px;height:300px;"></script>
 
第三步:js
<script type="text/javascript">
        //實例化編輯器
        var ue = UE.getEditor('editor', {
            initialFrameWidth: 800,
            initialFrameHeight: 400,
            autoFloatEnabled: false,
            autoHeightEnabled: false,
            elementPathEnabled: false,
            enableAutoSave: false
        });
</script>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM