|
|
var $=require('jquery');
|
|
|
require("../util/jquery-ui.min");
|
|
|
(function () {
|
|
|
|
|
|
var utils = UM.utils,
|
...
|
...
|
@@ -108,6 +109,11 @@ var $=require('jquery'); |
|
|
$(".edui-image-upload2", $w).before($item).show();
|
|
|
}
|
|
|
|
|
|
// 支持拖拽调整顺序
|
|
|
$( ".edui-image-content" ).sortable({
|
|
|
items: ".edui-image-item.edui-image-upload-item"
|
|
|
});
|
|
|
|
|
|
$img.on("load", function () {
|
|
|
Base.scale(this, 120);
|
|
|
Base.close($(this));
|
...
|
...
|
@@ -137,7 +143,7 @@ var $=require('jquery'); |
|
|
'<div class="edui-image-upload%%">' +
|
|
|
'<span class="edui-image-icon"></span>' +
|
|
|
'<form class="edui-image-form" method="post" enctype="multipart/form-data" target="up">' +
|
|
|
'<input style=\"filter: alpha(opacity=0);\" class="edui-image-file" type="file" hidefocus name="upfile" accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"/>' +
|
|
|
'<input style=\"filter: alpha(opacity=0);\" class="edui-image-file" type="file" multiple hidefocus name="upfile" accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp"/>' +
|
|
|
'</form>' +
|
|
|
|
|
|
'</div>',
|
...
|
...
|
@@ -182,9 +188,13 @@ var $=require('jquery'); |
|
|
uploadComplete: function(r){
|
|
|
var me = this;
|
|
|
try{
|
|
|
r=r.match(/\{.*\}/g)[0];
|
|
|
r=r.match(/\[.*\]/g)[0];
|
|
|
var json = eval('('+r+')');
|
|
|
Base.callback(me.editor, me.dialog, json.url, json.state);
|
|
|
|
|
|
for (var i = 0; i < json.length; i++) {
|
|
|
Base.callback(me.editor, me.dialog, json[i].url, json[i].state);
|
|
|
}
|
|
|
|
|
|
}catch (e){
|
|
|
var lang = me.editor.getLang('image');
|
|
|
Base.callback(me.editor, me.dialog, '', (lang && lang.uploadError) || 'Error!');
|
...
|
...
|
@@ -193,7 +203,7 @@ var $=require('jquery'); |
|
|
submit: function (callback) {
|
|
|
|
|
|
var me = this,
|
|
|
input = $( '<input style="filter: alpha(opacity=0);" class="edui-image-file" type="file" hidefocus="" name="upfile" accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp">'),
|
|
|
input = $( '<input style="filter: alpha(opacity=0);" class="edui-image-file" type="file" multiple hidefocus="" name="upfile" accept="image/gif,image/jpeg,image/png,image/jpg,image/bmp">'),
|
|
|
input = input[0];
|
|
|
|
|
|
$(me.dialog).delegate( ".edui-image-file", "change", function ( e ) {
|
...
|
...
|
@@ -392,6 +402,11 @@ var $=require('jquery'); |
|
|
|
|
|
$(".edui-image-product .edui-product-content", me.dialog).append($item);
|
|
|
|
|
|
// 支持拖拽调整顺序
|
|
|
$(".edui-image-product .edui-product-content", me.dialog).sortable({
|
|
|
items: "div"
|
|
|
});
|
|
|
|
|
|
Base.scale(this, 120);
|
|
|
|
|
|
$item.width(120);
|
...
|
...
|
@@ -405,8 +420,14 @@ var $=require('jquery'); |
|
|
}
|
|
|
});
|
|
|
$(document).on("click",".edui-image-product .edui-product-content .edui-image-pic",function(){
|
|
|
$(".edui-image-product .edui-product-content .edui-image-pic").removeClass("active-product");
|
|
|
$(this).addClass("active-product");
|
|
|
//$(".edui-image-product .edui-product-content .edui-image-pic").removeClass("active-product");
|
|
|
if ($(this).parent().hasClass("active-product")) {
|
|
|
$(this).parent().removeClass("active-product");
|
|
|
}
|
|
|
else {
|
|
|
$(this).parent().addClass("active-product");
|
|
|
}
|
|
|
|
|
|
});
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -459,6 +480,8 @@ var $=require('jquery'); |
|
|
|
|
|
this.root().html(html);
|
|
|
|
|
|
// 禁止滚动
|
|
|
$(document.body).css("overflow", "hidden");
|
|
|
},
|
|
|
initEvent: function (editor, $w) {
|
|
|
$tab = $.eduitab({selector: ".edui-image-wrapper"})
|
...
|
...
|
@@ -475,6 +498,9 @@ var $=require('jquery'); |
|
|
buttons: {
|
|
|
'ok': {
|
|
|
exec: function (editor, $w) {
|
|
|
// 允许滚动
|
|
|
$(document.body).css("overflow", "scroll");
|
|
|
|
|
|
var sel = "",
|
|
|
index = $tab.activate();
|
|
|
|
...
|
...
|
@@ -483,7 +509,7 @@ var $=require('jquery'); |
|
|
} else if (index == 1) {
|
|
|
sel = ".edui-image-searchRes .edui-image-pic";
|
|
|
}else{
|
|
|
sel = ".edui-product-content .edui-image-pic.active-product";
|
|
|
sel = ".edui-product-content .edui-image-item.active-product .edui-image-pic ";
|
|
|
}
|
|
|
|
|
|
var list = Base.getAllPic(sel, $w, editor);
|
...
|
...
|
@@ -493,7 +519,15 @@ var $=require('jquery'); |
|
|
}
|
|
|
}
|
|
|
},
|
|
|
'cancel': {}
|
|
|
'cancel': {
|
|
|
exec: function() {
|
|
|
// 允许滚动
|
|
|
$(document.body).css("overflow", "scroll");
|
|
|
|
|
|
$(document).off("click",".edui-image-product .edui-product-content .edui-image-pic");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
width: 700,
|
|
|
height: 408
|
...
|
...
|
|