diff --git a/Gemfile b/Gemfile
index 97d0e5a4f..2c8df6853 100644
--- a/Gemfile
+++ b/Gemfile
@@ -40,8 +40,6 @@ gem 'kaminari'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
-gem 'certified'
-
group :development do
gem 'grape-swagger'
gem 'better_errors', '~> 1.1.0'
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index c2b113803..a085e4ce3 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -123,6 +123,7 @@ class StudentWorkController < ApplicationController
#-1 默认值 0全部正确并结束 2 超时 -2 编译错误
resultObj[:status] = -1
resultObj[:results] = result["results"].first #本次测试结果
+ result["error_msg"] = result["error_msg"][0..1023]
resultObj[:error_msg] = result["error_msg"] #编译错误时的信息
#该状态用于存入CodeTests
diff --git a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb
index fd6345f46..e47bdc048 100644
--- a/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb
+++ b/lib/rails_kindeditor/app/controllers/kindeditor/assets_controller.rb
@@ -145,11 +145,11 @@ class Kindeditor::AssetsController < ApplicationController
Dir.mkdir(dirPath+dirDate)
end
- fileStr = []
+ fileStr = ""
picArry.each_with_index do |picUrl,index|
imgBaseName = File.basename(picUrl)
- tmpImgType = imgBaseName.split(".").last[0..2]
+ tmpImgType = imgBaseName.split(".").last.split("?")[0]
# 仅支持如下图片格式:bmp,jpeg,jpg,png,gif,BMP,JPEG,JPG,PNG,GIF
fileType = tmpImgType.match("gif|jpg|jpeg|png|bmp|BMP|JPEG|JPG|PNG|GIF")
@@ -161,10 +161,13 @@ class Kindeditor::AssetsController < ApplicationController
fileDir = dirPath + dirDate + "/"+fileName
#重点!!
- File.open(fileDir,'wb'){ |f| f.write(open(picUrl).read) }
- fileDir = fileDir.split("public")[1]
- fileStr = filedir + "|"
-
+ begin
+ File.open(fileDir,'wb'){ |f| f.write(open(picUrl).read) }
+ fileDir = fileDir.split("public")[1]
+ rescue
+ fileDir = picUrl
+ end
+ fileStr = fileStr+fileDir + "|"
end
render :text =>fileStr
end
diff --git a/public/assets/kindeditor/kindeditor.js b/public/assets/kindeditor/kindeditor.js
index cb66f91ee..755f1427a 100644
--- a/public/assets/kindeditor/kindeditor.js
+++ b/public/assets/kindeditor/kindeditor.js
@@ -5993,10 +5993,24 @@ _plugin('core', function(K) {
html = html.replace(/\n/g, '
$&');
}
}
- self.insertHtml(html, true);
- df();
-// $("#ajax-indicator").hide();
+// var kePasteContainer = document.getElementById("ke_paste");
+// if (kePasteContainer == null) {
+// kePasteContainer = document.createElement("div");
+// kePasteContainer.id = "ke_paste";
+// var last=document.body.lastChild;//得到页面的最后个元素
+// document.body.insertBefore(kePasteContainer,last);//在得到的最后元素之前插入
+// }
+// kePasteContainer.innerHTML = html;
+// $("#ke_paste").hide();
+//
+// var imglist = $("#ke_paste").find("img");
+//
+// if (imglist.length > 0){
+// df(self);
+// }
+ self.insertHtml(html, true);
+ df(self);
}
K(doc.body).bind('paste', function(e){
if (self.pasteType === 0) {
diff --git a/public/assets/kindeditor/pasteimg.js b/public/assets/kindeditor/pasteimg.js
index a9505f8d6..41474d013 100644
--- a/public/assets/kindeditor/pasteimg.js
+++ b/public/assets/kindeditor/pasteimg.js
@@ -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() {
@@ -279,7 +279,7 @@ https://github.com/layerssss/paste.js
}
//firefox问题处理,因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴
if ($(img).attr('src').startsWith('data:image/')) {
- _results.push($(img).remove());
+ _results.push($(img).remove());
};
}
return _results;
@@ -307,23 +307,23 @@ function enablePasteImg(_editor) {
$(nodeBody).pastableContenteditable();
dataURItoBlob = function(dataURI) {
- // convert base64/URLEncoded data component to raw binary data held in a string
- var byteString;
- if (dataURI.split(',')[0].indexOf('base64') >= 0)
- byteString = atob(dataURI.split(',')[1]);
- else
- byteString = unescape(dataURI.split(',')[1]);
+ // convert base64/URLEncoded data component to raw binary data held in a string
+ var byteString;
+ if (dataURI.split(',')[0].indexOf('base64') >= 0)
+ byteString = atob(dataURI.split(',')[1]);
+ else
+ byteString = unescape(dataURI.split(',')[1]);
- // separate out the mime component
- var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
+ // separate out the mime component
+ var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
- // write the bytes of the string to a typed array
- var ia = new Uint8Array(byteString.length);
- for (var i = 0; i < byteString.length; i++) {
- ia[i] = byteString.charCodeAt(i);
- }
+ // write the bytes of the string to a typed array
+ var ia = new Uint8Array(byteString.length);
+ for (var i = 0; i < byteString.length; i++) {
+ ia[i] = byteString.charCodeAt(i);
+ }
- return new Blob([ia], {type:mimeString});
+ return new Blob([ia], {type:mimeString});
};
$(nodeBody).on('pasteImage', function(ev, data) {
@@ -337,15 +337,15 @@ function enablePasteImg(_editor) {
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);
- }
+ 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);
+ }
});
}
@@ -353,8 +353,11 @@ function enablePasteImg(_editor) {
return;
};
-function df() {
- var img = $(".ke-edit-iframe").contents().find("img");
+//复制粘贴时把远程图片上传到服务器
+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) {
@@ -367,24 +370,42 @@ function df() {
sstr += that.attr("src") + "|";
}
});
- uploadpic(sstr);
+ uploadpic(sstr,myself);
}
-function uploadpic(piclist) {
+function keShadow(myself)
+{
+ var keShadowContainer = document.getElementById("ke_shadow");
+ if (keShadowContainer == null) {
+ keShadowContainer = document.createElement("div");
+ keShadowContainer.id = "ke_shadow";
+ keShadowContainer.innerHTML = "