|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
// Generated by CoffeeScript 1.9.0
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
paste.js is an interface to read data ( text / image ) from clipboard in different browsers. It also contains several hacks.
|
|
|
|
|
https://github.com/layerssss/paste.js
|
|
|
|
|
paste.js is an interface to read data ( text / image ) from clipboard in different browsers. It also contains several hacks.
|
|
|
|
|
https://github.com/layerssss/paste.js
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
@ -352,3 +352,89 @@ function enablePasteImg(_editor) {
|
|
|
|
|
});
|
|
|
|
|
return;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//复制粘贴时把远程图片上传到服务器
|
|
|
|
|
function df(myself) {
|
|
|
|
|
// var img = $("#ke_paste").find("img");
|
|
|
|
|
var currele = document.activeElement;
|
|
|
|
|
var img = $(currele).contents().find("img");
|
|
|
|
|
var piccount = 0;
|
|
|
|
|
var sstr = "";
|
|
|
|
|
$(img).each(function (i) {
|
|
|
|
|
var that = $(this);
|
|
|
|
|
if(that.attr("src")) {
|
|
|
|
|
if (that.attr("src").indexOf("http://") >= 0 || that.attr("src").indexOf("https://") >= 0) {
|
|
|
|
|
piccount++;
|
|
|
|
|
if (i == $(img).length - 1)
|
|
|
|
|
sstr += that.attr("src");
|
|
|
|
|
else
|
|
|
|
|
sstr += that.attr("src") + "|";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
uploadpic(sstr,myself);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function keShadow(myself)
|
|
|
|
|
{
|
|
|
|
|
var keShadowContainer = document.getElementById("ke_shadow");
|
|
|
|
|
if (keShadowContainer == null) {
|
|
|
|
|
keShadowContainer = document.createElement("div");
|
|
|
|
|
keShadowContainer.id = "ke_shadow";
|
|
|
|
|
keShadowContainer.innerHTML = "<div class='ui-widget-overlay' z-index: 1001;'></div>";
|
|
|
|
|
$("#ajax-modal").after(keShadowContainer);
|
|
|
|
|
}
|
|
|
|
|
var tWidth = document.body.scrollWidth;
|
|
|
|
|
var tHeight = document.body.scrollHeight;
|
|
|
|
|
$(".ui-widget-overlay").css("width", tWidth);
|
|
|
|
|
$(".ui-widget-overlay").css("height", tHeight);
|
|
|
|
|
$("#ke_shadow").show();
|
|
|
|
|
myself.readonly();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function uploadpic(piclist,myself) {
|
|
|
|
|
if (piclist.length == 0) return false;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "/kindeditor/uploadpic",
|
|
|
|
|
data:{"pic":piclist},
|
|
|
|
|
type: "GET",
|
|
|
|
|
beforeSend: function () {
|
|
|
|
|
// $("#ajax-indicator span").text("图片上传中请稍等...");
|
|
|
|
|
keShadow(myself);
|
|
|
|
|
},
|
|
|
|
|
success: function (msg) {
|
|
|
|
|
if (msg !== "") {
|
|
|
|
|
var str = new Array();
|
|
|
|
|
str = msg.split('|');
|
|
|
|
|
var currele = document.activeElement;
|
|
|
|
|
var img = $(currele).contents().find("img");
|
|
|
|
|
var tIndex = 0;
|
|
|
|
|
$(img).each(function (i) {
|
|
|
|
|
var that = $(this);
|
|
|
|
|
if(that.attr("src")){
|
|
|
|
|
if (that.attr("src").indexOf("http://") >= 0 || that.attr("src").indexOf("https://") >= 0) {
|
|
|
|
|
that.attr("src", str[tIndex]);
|
|
|
|
|
that.attr("data-ke-src", str[tIndex]);
|
|
|
|
|
|
|
|
|
|
//非视频
|
|
|
|
|
if(!(that.parent().attr("class") && that.parent().attr("class") == "mediaIcobox" )) {
|
|
|
|
|
that.parent().attr("href", str[tIndex]);
|
|
|
|
|
that.parent().attr("data-ke-src", str[tIndex]);
|
|
|
|
|
}
|
|
|
|
|
tIndex = tIndex + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// $("#ajax-indicator span").text("载入中...");
|
|
|
|
|
$("#ke_shadow").hide();
|
|
|
|
|
myself.readonly(false);
|
|
|
|
|
}
|
|
|
|
|
}).fail(function(xhr, status){
|
|
|
|
|
// $("#ajax-indicator span").text("载入中...");
|
|
|
|
|
$("#ke_shadow").hide();
|
|
|
|
|
myself.readonly(false);
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|