示例: http://ueditor.baidu.com/website/onlinedemo.html

引用代码: window.UMEDITOR_HOME_URL = $CONFIG['domain'] + "/res/local/js/ueditor/";  //注意就是这里!
    window.UEDITOR_CONFIG.imageUrl = $CONFIG['domain'] + '/goodspic?type=2';
    window.UEDITOR_CONFIG.savePath= ['upload'];
    window.UEDITOR_CONFIG.imagePath = $CONFIG['domain'] + '/res/local/uploads/';
    UE.getEditor('addArea')
    UE.getEditor('areaBottom')

示例代码

var domUtils = UE.dom.domUtils;
var ServerUrl = '/server/ueditor/';
var options = {
//图片上传配置区
serverUrl:ServerUrl+"controller.php"
,imageUrl:ServerUrl+"imageUp.php" //图片上传提交地址
,imagePath:ServerUrl //图片修正地址,引用了fixedImagePath,如有特殊需求,可自行配置 //涂鸦图片配置区
,scrawlUrl:ServerUrl+"scrawlUp.php" //涂鸦上传地址
,scrawlPath:ServerUrl+"" //图片修正地址,同imagePath //附件上传配置区
,fileUrl:ServerUrl+"fileUp.php" //附件上传提交地址
,filePath:ServerUrl //附件修正地址,同imagePath ,catchRemoteImageEnable: false
// ,catcherUrl:ServerUrl +"getRemoteImage.php" //处理远程图片抓取的地址
// ,catcherPath:ServerUrl //图片修正地址,同imagePath ,imageManagerUrl:ServerUrl + "imageManager.php" //图片在线管理的处理地址
,imageManagerPath:ServerUrl //图片修正地址,同imagePath ,snapscreenHost: location.hostname //屏幕截图的server端文件所在的网站地址或者ip,请不要加http://
,snapscreenServerUrl: ServerUrl +"imageUp.php" //屏幕截图的server端保存程序,UEditor的范例代码为“ServerUrl +"server/upload/snapImgUp.php"”
,snapscreenPath: ServerUrl
,snapscreenServerPort: location.port //屏幕截图的server端端口 ,wordImageUrl:ServerUrl + "imageUp.php" //word转存提交地址
,wordImagePath:ServerUrl // ,getMovieUrl:ServerUrl+"getMovie.php" //视频数据获取地址
,videoUrl:ServerUrl+"fileUp.php" //附件上传提交地址
,videoPath:ServerUrl, //附件修正地址,同imagePath lang:/^zh/.test(navigator.language || navigator.browserLanguage || navigator.userLanguage) ? 'zh-cn' : 'en',
langPath:UEDITOR_HOME_URL + "lang/", disabledTableInTable: false, webAppKey:"9HrmGf2ul4mlyK8ktO2Ziayd",
initialFrameWidth:860,
initialFrameHeight:400,
focus:true,
shortcutMenu:["fontfamily", "fontsize", "bold", "italic", "underline", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist"]
}; function setLanguage(obj) {
var value = obj.value,
opt = {
lang:value
};
UE.utils.extend(opt, options, true); UE.delEditor("editor"); //清空语言
if (!UE._bak_I18N) {
UE._bak_I18N = UE.I18N;
}
UE.I18N = {};
UE.I18N[opt.lang] = UE._bak_I18N[ opt.lang ]; UE.getEditor('editor', opt);
}
function isFocus(e){
alert(UE.getEditor('editor').isFocus());
UE.dom.domUtils.preventDefault(e)
}
function setblur(e){
UE.getEditor('editor').blur();
UE.dom.domUtils.preventDefault(e)
}
function insertHtml() {
var value = prompt('插入html代码', '');
UE.getEditor('editor').execCommand('insertHtml', value)
}
function createEditor() {
enableBtn();
UE.getEditor('editor', {
initialFrameWidth:"100%"
})
}
function getAllHtml() {
alert(UE.getEditor('editor').getAllHtml())
}
function getContent() {
var arr = [];
arr.push("使用editor.getContent()方法可以获得编辑器的内容");
arr.push("内容为:");
arr.push(UE.getEditor('editor').getContent());
alert(arr.join("\n"));
}
function getPlainTxt() {
var arr = [];
arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
arr.push("内容为:");
arr.push(UE.getEditor('editor').getPlainTxt());
alert(arr.join('\n'))
}
function setContent(isAppendTo) {
var arr = [];
arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
alert(arr.join("\n"));
}
function setDisabled() {
UE.getEditor('editor').setDisabled('fullscreen');
disableBtn("enable");
}
function setEnabled() {
UE.getEditor('editor').setEnabled();
enableBtn();
}
function getText() {
//当你点击按钮时编辑区域已经失去了焦点,如果直接用getText将不会得到内容,所以要在选回来,然后取得内容
var range = UE.getEditor('editor').selection.getRange();
range.select();
var txt = UE.getEditor('editor').selection.getText();
alert(txt)
}
function getContentTxt() {
var arr = [];
arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
arr.push("编辑器的纯文本内容为:");
arr.push(UE.getEditor('editor').getContentTxt());
alert(arr.join("\n"));
}
function hasContent() {
var arr = [];
arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
arr.push("判断结果为:");
arr.push(UE.getEditor('editor').hasContents());
alert(arr.join("\n"));
}
function setFocus() {
UE.getEditor('editor').focus();
}
function deleteEditor() {
disableBtn();
UE.getEditor('editor').destroy();
}
function disableBtn(str) {
var div = document.getElementById('btns');
var btns = domUtils.getElementsByTagName(div, "button");
for (var i = 0, btn; btn = btns[i++];) {
if (btn.id == str) {
domUtils.removeAttributes(btn, ["disabled"]);
} else {
btn.setAttribute("disabled", "true");
}
}
} function enableBtn() {
var div = document.getElementById('btns');
var btns = domUtils.getElementsByTagName(div, "button");
for (var i = 0, btn; btn = btns[i++];) {
domUtils.removeAttributes(btn, ["disabled"]);
}
} function getLocalData () {
alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
}
function clearLocalData () {
UE.getEditor('editor').execCommand( "clearlocaldata" );
alert("已清空草稿箱")
} window.onkeydown = function (e){
if (!ue.isFocus()) {
var keyCode = e.keyCode || e.which;
if (keyCode == 8) {
e.preventDefault();
}
}
};

ueditor百度编辑器的赋值方法的更多相关文章

  1. Ueditor百度编辑器中 setContent()方法的使用

    百度编辑器Ueditor所提供的setContent()方法作用是:设置或者改变编辑器里面的文字内容或html内容 函数说明:setContent(string,boolean); 参数string ...

  2. 织梦替换ueditor百度编辑器,支持图片水印 教程

    1下载ueditor百度编辑器 2 把下载的zip解压得到ueditor文件夹,把解压到的ueditor文件夹扔进你网站的include文件夹去 3 打开 /include/inc/inc_fun_f ...

  3. Ueditor百度编辑器中的 setContent()方法的使用

    百度编辑器Ueditor所提供的setContent()方法作用是:设置或者改变编辑器里面的文字内容或html内容 函数说明:setContent(string,boolean); 参数string ...

  4. DEDECMS:DEDE整合(UEditor)百度编辑器以后,栏目内容、单页无法保存内容的bug处理方法

    已经整合过百度编辑器的站长们或许会发现,在编辑单页文档和栏目内容的时候,百度编辑器不能够保存新增或已修改数据,经过排查后发现问题出现在catalog_edit.htm.catalog_add.htm这 ...

  5. UEditor百度编辑器,工具栏上自定义添加一个普通按钮

    添加一个名叫“hougelou”的普通按钮在工具栏上: 第一步:找到ueditor.config.js文件中的toolbars数组,增加一个“hougelou”字符串,然后找到labelMap数组,对 ...

  6. UEditor百度编辑器,工具栏自定义添加一个普通按钮

    根据网上前辈提供的,还真的不错,下面也整理一下 添加一个名叫“macros”的普通按钮在工具栏上: 第一步:找到ueditor.config.js文件中的toolbars数组,增加一个“macros” ...

  7. Ueditor百度编辑器插件的安装

    目录 插件下载地址: 1. 引入 2. 编辑器显示处 id="content" 3.底部 4.ueditor编辑器按钮配置方法 定制工具栏图标 修改配置项的方法: 插件下载地址: ...

  8. [UEditor]百度编辑器配置总结

    前端配置文件ueditor.config.js 前端有两个重要的配置属性: UEDITOR_HOME_URL: 配置百度编辑器的资源目录路径,你可以手动指定此路径,默认是有URL变量指定,而URL变量 ...

  9. ueditor 百度编辑器图片上传 接 node.js 及一些前端自定义

    百度编辑器 用node.js 做服务端 demo 大神已整理的 记录一下 以作参考 https://github.com/netpi/ueditor 1. 前端图片工具栏上传input file在这里 ...

随机推荐

  1. springboot-redis缓存

    Redis缓存使用 1.  引入依赖(可能已经引入了):spring-boot-starter-cache 2.  在application.yml配置文件中配置spring:redis:host/p ...

  2. 使用NPOI将数据导出Excel

    NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook(); NPOI.SS.UserModel.IS ...

  3. STM32(1)——使用Keil MDK以及标准外设库创建STM32工程

    转载来自:http://emouse.cnblogs.com 1.1 开发工具与开发环境 1. 软件版本 本节所使用Keil MDK 为目前的最新版V4.21.其他版本差别不大,读者可以根据自己使用的 ...

  4. python学习笔记:第18天 面向对象04-反射

    目录 issubclass和isinstance 区分函数和方法 反射 issubclass和isinstance issubclass:可以判断一个类是否另一个类的子类. # issubclass ...

  5. git小技巧之分支、关联远程仓库、回滚、解决.gitignore不生效等

    1.分支管理 新建并切换分支:git checkout -b <name>新建本地分支并关联到远程分支git checkout -b myRelease origin/Release合并某 ...

  6. 洛谷九月月赛T1 思考

    很迷的一道题目,刚开始直接枚举n个1,然后去mod m ,爆0,后来发现一个神奇性质:找到递推公式An=An-1*10+1,枚举n,不断mod m,每递推一次就1的个数加一.居然可行! 听说余数具有可 ...

  7. Java设计模式(6)——创建型模式之原型模式(Prototype)

    一.概述 概念 // 引用自<Java与模式> UML图 第二种:登记式 二.实践 先导知识 对象的拷贝: 直接赋值:此时只是相当于a1,a2指向同一个对象,无论哪一个操作的都是同一个对象 ...

  8. FpSpread基本句法

    1,   在调用的.aspx页面开头注册:     "FarPoint.Web.Spread"   Assembly="FarPoint.Web.SpreadJ,   V ...

  9. BZOJ2330_糖果_KEY

    题目传送门 看题目可知这是一道差分约束的题目. 根据每种关系建边如下: 对于每种情况建边,然后跑一边SPFA.(最长路) 因为可能会有自环或环的情况,都不可能存在. 跑SPFA时记录入队次数,超过N弹 ...

  10. Mac iTem2 自动登录服务器配置

    假设你要连接的服务器地址为123.123.123.123,端口号为8888,用户名为root,密码为mimamima 编写shell文件"login_server.sh",并放置于 ...