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

This commit is contained in:
ansuz 2017-06-15 13:51:11 +02:00
commit 5ce453afa0
5 changed files with 37 additions and 37 deletions

View file

@ -134,8 +134,9 @@ define(function () {
out.filePickerButton = "Intégrer un fichier";
out.filePicker_close = "Fermer";
out.filePicker_description = "Choisissez un fichier de votre CryptDrive pour l'intégrer";
out.filePicker_description = "Choisissez un fichier de votre CryptDrive pour l'intégrer ou uploadez-en un nouveau";
out.filePicker_filter = "Filtrez les fichiers par leur nom";
out.or = 'ou';
out.slideOptionsTitle = "Personnaliser la présentation";
out.slideOptionsButton = "Enregistrer (Entrée)";

View file

@ -136,8 +136,9 @@ define(function () {
out.filePickerButton = "Embed a file";
out.filePicker_close = "Close";
out.filePicker_description = "Choose a file from your CryptDrive to embed it";
out.filePicker_description = "Choose a file from your CryptDrive to embed it or upload a new one";
out.filePicker_filter = "Filter files by name";
out.or = 'or';
out.slideOptionsTitle = "Customize your slides";
out.slideOptionsButton = "Save (enter)";

View file

@ -945,6 +945,25 @@ define([
}));
}
break;
case 'upload':
button = $('<button>', {
'class': 'btn btn-primary new',
title: Messages.uploadButtonTitle,
}).append($('<span>', {'class':'fa fa-upload'})).append(' '+Messages.uploadButton);
if (!data.FM) { return; }
var $input = $('<input>', {
'type': 'file',
'style': 'display: none;'
}).on('change', function (e) {
var file = e.target.files[0];
var ev = {
target: data.target
};
data.FM.handleFile(file, ev);
if (callback) { callback(); }
});
button.click(function () { $input.click(); })
break;
case 'template':
if (!AppConfig.enableTemplates) { return; }
button = $('<button>', {

View file

@ -1439,26 +1439,11 @@ define([
var createUploadButton = function () {
var inTrash = filesOp.isPathIn(currentPath, [TRASH]);
if (inTrash) { return; }
var $icon = $('<span>', {
'class': 'fa fa-upload'
});
var $input = $('<input>', {
'type': 'file',
'style': 'display: none;'
}).on('change', function (e) {
var file = e.target.files[0];
var ev = {
target: $content[0]
};
APP.FM.handleFile(file, ev);
});
var $button = $('<button>', {
'class': 'btn btn-primary new',
title: Messages.uploadButtonTitle
}).append($icon).append(' '+Messages.uploadButton).click(function () {
$input.click();
});
return $button;
var data = {
FM: APP.FM,
target: $content[0]
};
return Cryptpad.createButton('upload', false, data);
};
var hideNewButton = function () {

View file

@ -244,6 +244,11 @@ define([
if (to) { window.clearTimeout(to); }
to = window.setTimeout(updateContainer, 300);
});
$filter.append(' '+Messages.or+' ');
var data = {FM: APP.FM};
$filter.append(Cryptpad.createButton('upload', false, data, function () {
$block.hide();
}));
updateContainer();
$body.keydown(function (e) {
if (e.which === 27) { $block.hide(); }
@ -578,27 +583,16 @@ define([
dropArea: $iframe.find('.CodeMirror'),
body: $iframe.find('body'),
onUploaded: function (ev, data) {
console.log(ev, data);
/*
TODO: test if getCursor() works
If we can drop a file without updating the cursor, we'll need the following
code to get the cursor position from the drop event
var obj = {
left: ev.originalEvent.pageX,
top: ev.originalEvent.pageY,
};
var cursor = editor.coordsChar(obj);
*/
//var cursor = editor.getCursor();
var cleanName = data.name.replace(/[\[\]]/g, '');
var text = '['+cleanName+']('+data.url+')';
if (data.mediatag) {
var text = '!['+cleanName+']('+data.url+')';
/*if (data.mediatag) {
text = '!'+text;
}
}*/
editor.replaceSelection(text);
}
};
Cryptpad.createFileManager(fmConfig);
APP.FM = Cryptpad.createFileManager(fmConfig);
};
config.onRemote = function () {