Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
ansuz
2017-06-14 17:24:49 +02:00
9 changed files with 125 additions and 123 deletions

View File

@@ -223,7 +223,6 @@ define([
};
var handleFile = File.handleFile = function (file, e) {
console.log(file);
var reader = new FileReader();
reader.onloadend = function () {
queue.push({
@@ -238,7 +237,13 @@ define([
reader.readAsArrayBuffer(file);
};
var createAreaHandlers = File.createDropArea = function ($area, $hoverArea, todo) {
var onFileDrop = File.onFileDrop = function (file, e) {
Array.prototype.slice.call(file).forEach(function (d) {
handleFile(d, e);
});
};
var createAreaHandlers = File.createDropArea = function ($area, $hoverArea) {
var counter = 0;
if (!$hoverArea) { $hoverArea = $area; }
$hoverArea
@@ -267,15 +272,14 @@ define([
var dropped = e.originalEvent.dataTransfer.files;
counter = 0;
$hoverArea.removeClass('hovering');
Array.prototype.slice.call(dropped).forEach(function (d) {
todo(d, e);
});
onFileDrop(dropped, e);
});
};
var createUploader = function ($area, $hover, $body) {
createAreaHandlers($area, null, handleFile);
if (!config.noHandlers) {
createAreaHandlers($area, null);
}
createTableContainer($body);
};

View File

@@ -585,19 +585,6 @@ define([
return pad;
});
if (!contains && href) {
var data = makePad(href, name);
getStore().pushData(data, function (e, id) {
if (e) {
if (e === 'E_OVER_LIMIT') {
common.alert(Messages.pinLimitNotPinned, null, true);
return;
}
else { return void cb(e); }
}
getStore().addPad(id, common.initialPath);
});
}
if (updateWeaker.length > 0) {
updateWeaker.forEach(function (obj) {
// If we have a stronger url, and if all the occurences of the weaker were
@@ -605,6 +592,20 @@ define([
getStore().restoreHref(obj.n);
});
}
if (!contains && href) {
var data = makePad(href, name);
getStore().pushData(data, function (e, id) {
if (e) {
if (e === 'E_OVER_LIMIT') {
common.alert(Messages.pinLimitNotPinned, null, true);
}
return void cb(e);
}
getStore().addPad(id, common.initialPath);
cb(err, recent);
});
return;
}
cb(err, recent);
});
};

View File

@@ -96,6 +96,10 @@ define([
} else {
styleToolbar($container);
}
$container.on('drop dragover', function (e) {
e.preventDefault();
e.stopPropagation();
});
return $toolbar;
};