百度編輯器UEditor常用設置函數大全
在線文檔對UEditor說明不夠全面,收集了一些常用的方法和基本設置,以供參考。
1、創建編輯器
UE.getEditor('editor', { initialFrameWidth:"100%" //初始化選項 })
精簡版
UE.getEditor('editor')
2、刪除編輯器
UE.getEditor('editor').destroy();
3、設置焦點
UE.getEditor('editor').focus();
4、獲取編輯器內容
UE.getEditor('editor').getContent()
5、編輯器是否有內容
UE.getEditor('editor').hasContents()
6、獲取編輯器內容純文本格式
UE.getEditor('editor').getContentTxt()
7、獲取帶格式的純文本
UE.getEditor('editor').getPlainTxt()
8、啓用編輯器
UE.getEditor('editor').setEnabled();
9、禁止編輯
UE.getEditor('editor').setDisabled('fullscreen');
10、獲取整個html內容
UE.getEditor('editor').getAllHtml()
11、常用設置
imageUrl:UEDITOR_HOME_URL + "../yunserver/yunImageUp.php", //圖片上傳接口 imagePath:"http://", scrawlUrl:UEDITOR_HOME_URL + "../yunserver/yunScrawlUp.php",//塗鴉接口 scrawlPath:"http://", fileUrl:UEDITOR_HOME_URL + "../yunserver/yunFileUp.php",//文件上傳接口 filePath:"http://", catcherUrl:UEDITOR_HOME_URL + "php/getRemoteImage.php",//獲取遠程圖片接口 catcherPath:UEDITOR_HOME_URL + "php/", imageManagerUrl:UEDITOR_HOME_URL + "../yunserver/yunImgManage.php",//圖片管理接口 imageManagerPath:"http://", snapscreenHost:'ueditor.baidu.com', snapscreenServerUrl:UEDITOR_HOME_URL + "../yunserver/yunSnapImgUp.php",//截圖接口 snapscreenPath:"http://", wordImageUrl:UEDITOR_HOME_URL + "../yunserver/yunImageUp.php",//word圖片轉存接口 wordImagePath:"http://", // getMovieUrl:UEDITOR_HOME_URL + "../yunserver/getMovie.php",//獲取視頻接口 lang:/^zh/.test(navigator.language || navigator.browserLanguage || navigator.userLanguage) ? 'zh-cn' : 'en', langPath:UEDITOR_HOME_URL + "lang/", webAppKey:"9HrmGf2ul4mlyK8ktO2Ziayd", initialFrameWidth:860, //初始化寬度 initialFrameHeight:420, //初始化高度 focus:true //是否焦點