粘贴图片 留言和回复框 保持一直截图都可以粘贴进去

This commit is contained in:
yuanke 2016-06-27 15:57:45 +08:00
parent dd397a060b
commit a83400f233
1 changed files with 21 additions and 21 deletions

View File

@ -328,27 +328,27 @@ function enablePasteImg(_editor) {
$(nodeBody).on('pasteImage', function(ev, data) {
//粘贴图片时走这里会出现两张图片走df()即可
// console.log('pasteImage');
// console.log("dataURL: " + data.dataURL);
// console.log("width: " + data.width);
// console.log("height: " + data.height);
// var blob = dataURItoBlob(data.dataURL);
// if (data.blob !== null) {
// var data = new FormData();
// data.append("imgFile",blob, "imageFilename.png");
// console.log(data);
// $.ajax({
// url: '/kindeditor/upload?dir=image',
// contentType: false,
// type: 'POST',
// data: data,
// processData: false,
// success: function(data) {
// console.log(data);
// editor.exec('insertimage', JSON.parse(data).url);
// }
// });
// }
console.log('pasteImage');
console.log("dataURL: " + data.dataURL);
console.log("width: " + data.width);
console.log("height: " + data.height);
var blob = dataURItoBlob(data.dataURL);
if (data.blob !== null) {
var data = new FormData();
data.append("imgFile",blob, "imageFilename.png");
console.log(data);
$.ajax({
url: '/kindeditor/upload?dir=image',
contentType: false,
type: 'POST',
data: data,
processData: false,
success: function(data) {
console.log(data);
editor.exec('insertimage', JSON.parse(data).url);
}
});
}
});
return;
};