示例: 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. centos6,python3,通过pip安装pycurl出现报错提示

    Centos6.7系统,python3.6.7,通过 pip 安装pycurl出现报错: __main__.ConfigurationError: Could not run curl-config: ...

  2. 入口文件 index.php 隐藏

    入口文件 index.php 隐藏 在PHP的web项目中,问了隐藏项目的开发语言,我们首先会选择把项目的入口文件index.php(如果做了特殊配置,特殊处理)在URL中隐藏掉. 当然部署中还需要隐 ...

  3. Spark_安装配置_运行模式

    一.Spark支持的安装模式: 1.伪分布式(一台机器即可) 2.全分布式(至少需要3台机器) 二.Spark的安装配置 1.准备工作 安装Linux和JDK1.8 配置Linux:关闭防火墙.主机名 ...

  4. centos install rabbitmq

    安装rabbitmq 需要环境上有erlang,没有安装的可以参照下面的内容进行安装: https://www.erlang-solutions.com/resources/download.html ...

  5. Grep/find查找文件

    1. 查找secret 函数所在的文件位置grep -rn secret * grep -rn "secret" * 2. find 查找当前目录下,比while2 时间新并且名字 ...

  6. 记springboot+mybatis+freemarker+bootstrap的使用(1)

    一..springboot的配置 1.安装并配置maven maven是项目管理工具,可以自动下载并管理jar包之间的依赖关系,可通过maven自动配置springboot 参照百度经验https:/ ...

  7. C#正则表达式提取HTML中IMG标签的SRC地址(转)

    一般来说一个 HTML 文档有很多标签,比如“<html>”.“<body>”.“<table>”等,想把文档中的 img 标签提取出来并不是一件容易的事.由于 i ...

  8. 成都Uber优步司机奖励政策(1月20日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  9. C#从Gif中提取图片

    C#从Gif中提取图片的代码片段 private void btn_extract_Click(object sender, EventArgs e) { Image imgGif = Image.F ...

  10. (转)Ruby On Rails 推荐 Gem 列表

    作者:尘缘,QQ:130775,来源:http://www.4wei.cn/archives/1002157 PHP的包管理Composer还在刚刚兴起的阶段,Ruby社区已经有很多成熟的Gem了,R ...