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

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

我的做法是在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. 最简js深浅拷贝说明

    1.浅拷贝 浅拷贝是拷贝引用,拷贝后的引用都是指向同一个对象的实例,彼此之间的操作会互相影响.  浅拷贝分两种情况: 1.直接拷贝源对象的引用 2. 源对象拷贝实例,但其属性对象(类型为Object, ...

  2. SpringSecurity——基于Spring、SpringMVC和MyBatis自定义SpringSecurity权限认证规则

    本文转自:https://www.cnblogs.com/weilu2/p/springsecurity_custom_decision_metadata.html 本文在SpringMVC和MyBa ...

  3. python UI自动化测试

    为了减小维护成本: 1.UI自动化测试需要有较为稳定的环境 2.代码设计合理,那么我们就需要面向对象的设计一个框架,将重复的代码模块化 一.首先总结一下 UI自动化大概要哪些模块 1.config(配 ...

  4. 重新学习MySQL数据库8:MySQL的事务隔离级别实战

    重新学习Mysql数据库8:MySQL的事务隔离级别实战 在Mysql中,事务主要有四种隔离级别,今天我们主要是通过示例来比较下,四种隔离级别实际在应用中,会出现什么样的对应现象. Read unco ...

  5. 普通用户启动redis

    重庆231 Redis 服务器 redis用户启动 复制 /etc/init.d/redis 启动脚本到 /redisdata/redis3.2下面,修改内容 [root@localhost ~]# ...

  6. SqlServer 转 Oracle 的几点注意

    (转自:http://www.2cto.com/database/201208/146740.html) 1.字符型的字段相加需要用“||”,如果用“+”的话,会报“无效的数字”的错误.   2.类似 ...

  7. jmeter测试MySQL数据库

    前提:安装好MySQL数据库,并且下载了jmeter安装包 1.打开jmeter 2.下载mysql-connector-java.jar,将jar包默认复制到jmeter的bin目录下面,因为默认打 ...

  8. input 取消自动填充

    增加属性:  name="clear" 

  9. vue和react

    1. 数据渲染 vue是使用template模板进行渲染,react使用的是jsx语法,对组件进行渲染 vue模板中使用{{ this.data }} 双括号包着变量,代表变量表示的值.外面那层表示需 ...

  10. 我也说说Emacs吧(6) - Lisp速成

    前面我们学习了基本操作,也走马观花地看了不少emacs lisp的代码.这一章我们做一个lisp的速成讲座. Lisp的含义是表处理语言.它的代码组成结构都是用括号组成的表来表示的.Lisp中的功能, ...