|
|
@@ -87,9 +87,18 @@ var gagaSn = {
|
|
|
fontSizes: ['8','9','10','11','12','13','14','15','16','17','18','19','20','24','30','36'],
|
|
|
toolbar: toolbarOptions,
|
|
|
callbacks: {
|
|
|
- onImageUpload: function(files, editor, welEditable) { //이미지 업로드
|
|
|
- for (var i = files.length - 1; i >= 0; i--) {
|
|
|
- sendFile(files[i], this);
|
|
|
+ onImageUpload: function(files) { // 이미지 업로드
|
|
|
+ for (var i = 0; i < files.length; i++) {
|
|
|
+ uploadImage(files[i], this);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onPaste: function(e) {
|
|
|
+ var clipboardData = e.originalEvent.clipboardData;
|
|
|
+ if (clipboardData && clipboardData.items && clipboardData.items.length) {
|
|
|
+ var item = clipboardData.items[0];
|
|
|
+ if (item.kind === 'file' && item.type.indexOf('image/') !== -1) {
|
|
|
+ e.preventDefault();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -107,6 +116,32 @@ var gagaSn = {
|
|
|
} catch(e) {
|
|
|
// Do nothing
|
|
|
}
|
|
|
+ },
|
|
|
+
|
|
|
+ uploadImage : function(file, editorId) {
|
|
|
+ var formData = new FormData();
|
|
|
+ formData.append("file", file);
|
|
|
+ formData.append("policy", image);
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ data : formData,
|
|
|
+ type : 'POST',
|
|
|
+ url : '/common/file/upload?subDir=/editor',
|
|
|
+ cache : false,
|
|
|
+ contentType : false,
|
|
|
+ enctype : 'multipart/form-data',
|
|
|
+ processData : false,
|
|
|
+ success : function(data) {
|
|
|
+ console.log("================== EDITOR FILE UPLOAD ===================");
|
|
|
+ console.log("viewUrl : " + data.viewUrl);
|
|
|
+ console.log("viewPath : " + data.viewPath);
|
|
|
+ console.log("oldFileNm : " + data.oldFileNm);
|
|
|
+ console.log("newFileNm : " + data.newFileNm);
|
|
|
+ console.log("filePath : " + data.filePath);
|
|
|
+ console.log("================== // EDITOR FILE UPLOAD ===================");
|
|
|
+ $(editorId).summernote('insertImage', data.viewPath);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
}
|