//引入文件,記得目錄改成你自己的
<script type="text/javascript" charset="utf-8" src="../js/utf8-php/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/utf8-php/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="../js/utf8-php/lang/zh-cn/zh-cn.js"></script>
<style type="text/css">
.form-cont{
width:100%;
}
</style>
//找到需要插入的位置
//插入以下代碼
<div class="form-cont">
<script id="editor" type="text/plain" style="width:1024px;height:500px;"></script></div>
//下面的是我自己為了方便編輯加的一個dom,你們可以忽略
<textarea name="DH[content]" id="content" rows="12" cols="80"
style="width: 700px; height: 400px;display:none"><?php echo $DH[content]; ?></textarea>
//實例化編輯器
var ue = UE.getEditor('editor');
//到此即可完成
//以下供我自己參考使用
var content_text=$("#content").val(); //得到要渲染的文本
//設(shè)置渲染內(nèi)容的方法
function setContent(isAppendTo) {
var arr = [];
UE.getEditor('editor').setContent(content_text, isAppendTo);//設(shè)置內(nèi)容
}
//文檔加載完畢開始執(zhí)行
$(document).ready(function(){
ue.ready( function( editor ) {
setContent()
} );
})
//獲取文檔的內(nèi)容
function getContent() {
var arr = [];
var content_text_new= UE.getEditor('editor').getContent()
return content_text_new;
}
//得到內(nèi)容并賦值給content元素
var text_1=getContent();
$("#content").val(text_1);
//config.json 配置文件上傳的路徑
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者