Merge branch 'develop-feature'

This commit is contained in:
life
2014-09-22 00:43:50 +08:00
6 changed files with 29 additions and 27 deletions

View File

@ -1045,10 +1045,11 @@ require.config({
'leaui_image': 'tinymce/plugins/leaui_image/public/js/for_editor',
'attachment_upload': 'js/app/attachment_upload',
'jquery.ui.widget': 'tinymce/plugins/leaui_image/public/js/jquery.ui.widget',
'fileupload': '/tinymce/plugins/leaui_image/public/js/jquery.fileupload'
'fileupload': '/tinymce/plugins/leaui_image/public/js/jquery.fileupload',
'iframe-transport': '/tinymce/plugins/leaui_image/public/js/jquery.iframe-transport'
},
shim: {
'fileupload': {deps: ['jquery.ui.widget']}
'fileupload': {deps: ['jquery.ui.widget', 'iframe-transport']}
}
});
require(['leaui_image'], function(leaui_image) {

View File

@ -1045,10 +1045,11 @@ require.config({
'leaui_image': 'tinymce/plugins/leaui_image/public/js/for_editor',
'attachment_upload': 'js/app/attachment_upload',
'jquery.ui.widget': 'tinymce/plugins/leaui_image/public/js/jquery.ui.widget',
'fileupload': '/tinymce/plugins/leaui_image/public/js/jquery.fileupload'
'fileupload': '/tinymce/plugins/leaui_image/public/js/jquery.fileupload',
'iframe-transport': '/tinymce/plugins/leaui_image/public/js/jquery.iframe-transport'
},
shim: {
'fileupload': {deps: ['jquery.ui.widget']}
'fileupload': {deps: ['jquery.ui.widget', 'iframe-transport']}
}
});
require(['leaui_image'], function(leaui_image) {

View File

@ -2,9 +2,6 @@
// 依赖note
var urlPrefix = window.location.protocol + "//" + window.location.host;
define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
// var editor = tinymce.activeEditor;
// var dom = editor.dom;
var initUploader = function() {
var $msg = $('#attachUploadMsg');
@ -36,23 +33,28 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
tpl.append(data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small>');
// Add the HTML to the UL element
tpl.appendTo($msg);
$msg.html(tpl);
data.context = $msg;
// Automatically upload the file once it is added to the queue
var jqXHR;
setTimeout(function() {
jqXHR = data.submit();
}, 0);
}, 10);
},
/*
progress: function (e, data) {
},
*/
done: function(e, data) {
if (data.result.Ok == true) {
data.context.remove();
data.context.html("");
Attach.addAttach(data.result.Item);
} else {
var re = data.result;
data.context.empty();
data.context.html("");
var tpl = $('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');
tpl.append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.result.Msg);
data.context.html(tpl);
@ -65,7 +67,7 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
$("#uploadAttachMsg").scrollTop(1000);
},
fail: function(e, data) {
data.context.empty();
data.context.html("");
var tpl = $('<div class="alert alert-danger"><a class="close" data-dismiss="alert">×</a></div>');
tpl.append('<b>Error:</b> ' + data.files[0].name + ' <small>[<i>' + formatFileSize(data.files[0].size) + '</i>]</small> ' + data.errorThrown);
data.context.html(tpl);
@ -79,11 +81,6 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
}
});
// Prevent the default action when a file is dropped on the window
$(document).on('drop dragover', function(e) {
e.preventDefault();
});
// Helper function that formats the file sizes
function formatFileSize(bytes) {
if (typeof bytes !== 'number') {
@ -99,15 +96,14 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
}
// drag css
$(document).bind('dragover', function (e) {
var dropZone = $('#dropAttach'),
timeout = window.dropZoneTimeout;
if (!timeout) {
dropZone.addClass('in');
showUpload();
} else {
var dropZone = $('#dropAttach');
$("#uploadAttach").bind('dragover', function (e) {
e.preventDefault();
var timeout = window.dropZoneTimeoutAttach;
if(timeout) {
clearTimeout(timeout);
}
var found = false,
node = e.target;
do {
@ -122,10 +118,9 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
} else {
dropZone.removeClass('hover');
}
window.dropZoneTimeout = setTimeout(function () {
window.dropZoneTimeout = null;
window.dropZoneTimeoutAttach = setTimeout(function () {
window.dropZoneTimeoutAttach = null;
dropZone.removeClass('in hover');
hideUpload();
}, 100);
});
}

View File

@ -203,6 +203,7 @@ define('leaui_image', ['jquery.ui.widget', 'fileupload'], function(){
} else {
clearTimeout(timeout);
}
var found = false,
node = e.target;
do {

View File

@ -14,6 +14,7 @@
(function (factory) {
'use strict';
/*
if (typeof define === 'function' && define.amd) {
// Register as an anonymous AMD module:
define(['jquery'], factory);
@ -21,6 +22,8 @@
// Browser globals:
factory(window.jQuery);
}
*/
factory(window.jQuery);
}(function ($) {
'use strict';

View File

@ -739,6 +739,7 @@ var o = {
// Automatically upload the file once it is added to the queue
var jqXHR = data.submit();
},
done: function(e, data) {
if (data.result.Ok == true) {