百度编辑器ueditor更改图片默认编辑工具
点击图片编辑器默认出现的工具

需求是点击图片不出现默认样式,而是在编辑器外出现图片属性编辑框,需求效果如下

我的做法是在css里面将默认出现的工具隐藏,然后直接在ueditor.all.js里面修改Scale对象的show方法。原代码如下:
show: function (targetObj) {
var me = this;
me.resizer.style.display = 'block';
if(targetObj) me.attachTo(targetObj);
domUtils.on(this.resizer, 'mousedown', me.proxy(me._eventHandler, me));
domUtils.on(me.doc, 'mouseup', me.proxy(me._eventHandler, me));
me.showCover();
me.editor.fireEvent('afterscaleshow', me);
me.editor.fireEvent('saveScene');
},
更改后代码如下:
show: function(targetObj) {
var me = this;
me.resizer.style.display = 'block';
if (targetObj) me.attachTo(targetObj);
domUtils.on(this.resizer, 'mousedown', me.proxy(me._eventHandler, me));
domUtils.on(me.doc, 'mouseup', me.proxy(me._eventHandler, me));
me.showCover();
me.editor.fireEvent('afterscaleshow', me);
me.editor.fireEvent('saveScene');
//下面是增加部分
if (me.target.localName == "img" || me.target.localName == "IMG") {
cmedit.EditSystem.imgClickEvent(targetObj); //图片属性
}
},
另在js里写上图片点击方法:
imgClickEvent: function(img) {
$(".cont_right>div").not(".messagetabs").hide();
var ue = UE.getEditor("editer_");
var thisImg = $(img),
description = thisImg.attr("description"),
address = thisImg.attr("src"),
name = thisImg.attr("alt"),
originalWidth = thisImg.width(),
originalHeight = thisImg.height();
var imagePreview = '<img src="' + address + '" alt="' + name + '" style="width: 100%; height: 100%;">';
$('#imgAddress').val(address);
$('#imgName').val(name);
$('#imgDescribe').val("");
if (description) {
$('#imgDescribe').val(description);
}
thisImg.attr("title", name);
//判断图片来源
if (typeof(thisImg.attr("cfbresourceid")) != "undefined") {
$("#image_original").html("本地资源");
} else if (typeof(thisImg.attr("fileid")) != "undefined") {
$("#image_original").html("<span style='color:#C93111;' >媒资系统(CRE)</span>");
}
$('#image_preview').html(imagePreview);
$('#back_to_original').off("click").on("click", function() {
$('#img_width').val(originalWidth);
$('#img_height').val(originalHeight);
thisImg.width(originalWidth);
thisImg.height(originalHeight);
});
$('#back_to_original').trigger("click");
// 设置尺寸
var ratio = $('#img_width').val() / $('#img_height').val();
$('#image_size_lock').off("click").on("click", function() {
$(this).children().toggleClass("icon-suo icon-jiesuo");
ratio = $('#img_width').val() / $('#img_height').val();
if ($(this).children().hasClass("icon-suo")) {
$('#lock_explain').html("已锁定比例");
} else {
$('#lock_explain').html("已解锁比例");
}
});
$('#img_width').off("input").on("input", function() {
var imgSize = $(this).val();
thisImg.width(imgSize);
if ($('#image_size_lock').children().hasClass("icon-suo")) {
var newSize = parseInt(imgSize / ratio);
$('#img_height').val(newSize);
thisImg.height(newSize);
}
});
$('#img_height').off("input").on("input", function() {
var imgSize = $(this).val();
thisImg.height(imgSize);
if ($('#image_size_lock').children().hasClass("icon-suo")) {
var newSize = parseInt(imgSize * ratio)
$('#img_width').val(newSize);
thisImg.width(newSize);
}
});
// 描述
$('#imgDescribe').off("change").on("change", function() {
var context = $(this).val();
thisImg.attr("description", context);
});
//设置浮动
$('#float_none').on("click", function() {
ue.execCommand('imagefloat', 'none');
});
$('#float_left').on("click", function() {
ue.execCommand('imagefloat', 'left');
});
$('#float_right').on("click", function() {
ue.execCommand('imagefloat', 'right');
});
$('#float_middle').on("click", function() {
ue.execCommand('imagefloat', 'center');
});
//设置缩略图
$('#set_thumbnail_btn').on("click", function() {
thisContext.uploadLitimg(address);
});
//编辑图片
$('#edit_image_btn').on("click", function() {
ue.execCommand("waterimage", address);
});
$('#imageProperty').show();
},
百度编辑器ueditor更改图片默认编辑工具的更多相关文章
- asp.net 百度编辑器 UEditor 上传图片 图片上传配置 编辑器配置 网络连接错误,请检查配置后重试
1.配置ueditor/editor_config.js文件,将 //图片上传配置区 ,imageUrl:URL+"net/imageUp.ashx" //图片上传提交地址 ,im ...
- 百度编辑器ueditor的图片地址修正
我用的百度编辑器为1.4.2的,相对于现在这个时间来说是比较新的.之前去的1.3版的,后来更新到1.4之后出现路径问题.因为今天晚上出现特别奇怪的问题,所以特地又整了一遍,发现这玩意还是得自己弄通了好 ...
- 百度编辑器ueditor 字符限制
百度编辑器ueditor 字符限制 默认只能输入10000个字符 修改 ueditor.config.js // ,wordCount:true //是否开启字数统计 // ,maximumWords ...
- 工具,如何去掉百度编辑器 ueditor 元素路径、字数统计等
去掉如下截图: 在百度编辑器 ueditor 根目录下: ueditor.config.js 文件中 搜索并将参数elementPathEnabled设置成false即可 常用功能开关如下: ,ele ...
- 解决:百度编辑器UEditor,怎么将图片保存到图片服务器,或者上传到ftp服务器的问题(如果你正在用UE,这篇文章值得你看下)
在使用百度编辑器ueditor的时候,怎么将图片保存到另一个服务器,或者上传到ftp服务器?这个问题,估计很多使用UE的人会遇到.而且我百度过,没有找到这个问题的解决方案.那么:本篇文章就很适合你了. ...
- 【百度编辑器ueditor】工具,如何去掉百度编辑器 ueditor 元素路径、字数统计等
去掉如下截图: 在百度编辑器 ueditor 根目录下: ueditor.config.js 文件中 搜索并将参数elementPathEnabled设置成false即可 常用功能开关如下: ,ele ...
- FLASH图片上传功能—从百度编辑器UEditor里面提取出来
为了记录工作中碰到的各种问题,以及学习资料整理,今天开始,将以往的文章进行了一个整理,以后也开始认真的记录学习过程中的各种问题 在HTML里面的文件上传功能一直是个问题,为了实现上传文件大小限制,怎样 ...
- [转载]百度编辑器-Ueditor使用
前段时间发表过一篇关于“KindEditor在JSP中使用”的博文.这几天在沈阳东软进行JavaWeb方面的实习工作,在一个CMS系统的后台和博客板块中又要用到文本编辑器,突然发现了这个——百度编辑器 ...
- 百度编辑器 ueditor .net开发
ueditor1.4.3 下载地址:http://pan.baidu.com/s/1bnCQVtd <!--editor--> <script type="text/j ...
随机推荐
- Java循环结构 - for, while 及 do...while
Java循环结构 - for, while 及 do...while 顺序结构的程序语句只能被执行一次.如果您想要同样的操作执行多次,,就需要使用循环结构. Java中有三种主要的循环结构: whil ...
- HQL查询中取个别几个字段
数据表:
- linux中压缩、解压缩命令详解
tar -c: 建立压缩档案-x:解压-t:查看内容-r:向压缩归档文件末尾追加文件-u:更新原压缩包中的文件 这五个是独立的命令,压缩解压都要用到其中一个,可以和别的命令连用但只能用其中一个.下面的 ...
- settings.xml配置文件详解
简单值 一半顶层settings元素是简单值,它们表示的一系列值可以配置Maven的核心行为:settings.xml中的简单顶层元素 < settings xmlns="http:/ ...
- angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法
angular2 post以“application/x-www-form-urlencoded”形式传参的解决办法 http://blog.csdn.net/tianjun2012/article/ ...
- Java 进阶7 并发优化 5 并发控制板方法
Java 进阶7 并发优化 5 并发控制板方法 20131114 前言: Java 中多线程并发程序中存在线程安全的问题,之前学习 Java的同步机制,掌握的同步方法只有一种就是使用 ...
- *SCM-MANAGERtomcat寄宿使用
采用的部署方式 TomCat 一个端口下部署多个 Application供不同部门使用 初始部署详参见 SCM-MANAGER 博文 日常使用添加部门操作步骤 从“D:\tomcat\webapps” ...
- socket的几个配置函数
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- Mysql双机热备--预备知识
1.双机热备 对于双机热备这一概念,我搜索了很多资料,最后,还是按照大多数资料所讲分成广义与狭义两种意义来说. 从广义上讲,就是对于重要的服务,使用两台服务器,互相备份,共同执行同一服务.当一台服务器 ...
- css移动元素的几种方法
一.当然是元素设定为postion: absolute, 然后控制 left, top 位置 二.元素增加overflow属性,然后设置元素的scrollLeft, scrollRight当做滚动条来 ...