下載百度編輯器
把所有的文件放入項目中,并且引入
image.png
<!--百度編輯器-->
<script type="text/javascript" charset="utf-8" src="__TEMP__/{$style}/public/js/luntan/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__TEMP__/{$style}/public/js/luntan/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__TEMP__/{$style}/public/js/luntan/ueditor/lang/zh-cn/zh-cn.js"></script>
<!--!html頁面-->
<div style="width:90%;height:400px;margin:0 auto;">
<button style="display: none;" onClick="getContent()"></button>
<script id="editor" type="text/plain" style="width:100%;height:250px;margin-top:10px;"></script>
</div>
<script type="text/javascript">
//實例化編輯器
//建議使用工廠方法getEditor創建和引用編輯器實例,如果在某個閉包下引用該編輯器,直接調用UE.getEditor('editor')就能拿到相關的實例
var ue = UE.getEditor('editor');
function getContent() {
var arr = [];
arr.push("使用editor.getContent()方法可以獲得編輯器的內容");
arr.push("內容為:");
arr.push(UE.getEditor('editor').getContent());
alert(arr.join("\n"));
console.log(UE.getEditor('editor').getContent())
}
</script>
image.png