点击图片编辑器默认出现的工具

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

我的做法是在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更改图片默认编辑工具的更多相关文章

  1. asp.net 百度编辑器 UEditor 上传图片 图片上传配置 编辑器配置 网络连接错误,请检查配置后重试

    1.配置ueditor/editor_config.js文件,将 //图片上传配置区 ,imageUrl:URL+"net/imageUp.ashx" //图片上传提交地址 ,im ...

  2. 百度编辑器ueditor的图片地址修正

    我用的百度编辑器为1.4.2的,相对于现在这个时间来说是比较新的.之前去的1.3版的,后来更新到1.4之后出现路径问题.因为今天晚上出现特别奇怪的问题,所以特地又整了一遍,发现这玩意还是得自己弄通了好 ...

  3. 百度编辑器ueditor 字符限制

    百度编辑器ueditor 字符限制 默认只能输入10000个字符 修改 ueditor.config.js // ,wordCount:true //是否开启字数统计 // ,maximumWords ...

  4. 工具,如何去掉百度编辑器 ueditor 元素路径、字数统计等

    去掉如下截图: 在百度编辑器 ueditor 根目录下: ueditor.config.js 文件中 搜索并将参数elementPathEnabled设置成false即可 常用功能开关如下: ,ele ...

  5. 解决:百度编辑器UEditor,怎么将图片保存到图片服务器,或者上传到ftp服务器的问题(如果你正在用UE,这篇文章值得你看下)

    在使用百度编辑器ueditor的时候,怎么将图片保存到另一个服务器,或者上传到ftp服务器?这个问题,估计很多使用UE的人会遇到.而且我百度过,没有找到这个问题的解决方案.那么:本篇文章就很适合你了. ...

  6. 【百度编辑器ueditor】工具,如何去掉百度编辑器 ueditor 元素路径、字数统计等

    去掉如下截图: 在百度编辑器 ueditor 根目录下: ueditor.config.js 文件中 搜索并将参数elementPathEnabled设置成false即可 常用功能开关如下: ,ele ...

  7. FLASH图片上传功能—从百度编辑器UEditor里面提取出来

    为了记录工作中碰到的各种问题,以及学习资料整理,今天开始,将以往的文章进行了一个整理,以后也开始认真的记录学习过程中的各种问题 在HTML里面的文件上传功能一直是个问题,为了实现上传文件大小限制,怎样 ...

  8. [转载]百度编辑器-Ueditor使用

    前段时间发表过一篇关于“KindEditor在JSP中使用”的博文.这几天在沈阳东软进行JavaWeb方面的实习工作,在一个CMS系统的后台和博客板块中又要用到文本编辑器,突然发现了这个——百度编辑器 ...

  9. 百度编辑器 ueditor .net开发

    ueditor1.4.3 下载地址:http://pan.baidu.com/s/1bnCQVtd   <!--editor--> <script type="text/j ...

随机推荐

  1. python3安装tensorflow遇到的问题

    1. 使用命令:sudo pip3 install --upgrade \ https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow ...

  2. 1-22-shell脚本基本应用-实验手册

    脚本应用思路 1. 确定命令操作(设计并执行任务) 2. 编写Shell脚本(组织任务过程) 3. 设置计划任务(控制时间,调用任务脚本) ------------------------------ ...

  3. sqlserver数据库标注为可疑的解决办法

    前几天客户那边的服务器死机了,然后客户强制关机,重新启动服务器后,系统就没法正常使用,连接不上服务器,我远程操作后,看到数据库标注为可疑,由于客户之前没备份数据库,看来只能是修复了: 1:停止数据库服 ...

  4. Linux 策略路由配置

    策略路由配置 #编辑rt_tables echo "192 net_192 " >> /etc/iproute2/rt_tables echo "196 ne ...

  5. C++多线程1.createthread

    C++ 多线程知识1.多线程入门 CreateThread 20131021 1.介绍WinAPI中的CreateThread 函数原型: HANDLE WINAPI CreateThread( LP ...

  6. C++复习8.异常处理和RTTI

    C++异常处理和RTTI技术 20130930 1.异常处理的基本知识 C语言中是没有内置运行时错误处理机制,对于错误发生的时候使用的几种处理机制: 函数返回彼此协商后统一定义的状态编码来表示操作成功 ...

  7. 使用游标、存储过程、pivot 三种方法导入数据

    --使用游标循环 if (exists (select * from sys.objects where name = 'Base_RecordTend_Test')) drop proc Base_ ...

  8. HP数组转JSON函数json_encode和JSON转数组json_decode函数的使用方法

    这两个函数比较简单,我这里直接写例子,但是有一点一定要注意,json数据只支持utf-8格式,GBK格式的数据转换为json会报错! json_encode()用法: <?php$data =a ...

  9. PHP 中使用explode()函数切割字符串为数组

    explode()函数的作用:使用一个字符串分割另一个字符串,打散为数组. 例如: 字符串 $pizza = "第1 第2 第3 第4 第5 第6"; 根据空格分割后:$piece ...

  10. Code Cache相关知识总结

    codecache代码缓存区,主要存放JIT所编译的代码,同时还有Java所使用的本地方法代码也会存储在codecache中.不同的jvm.不同的启动方式codecache的默认值大小也不尽相同. J ...