|
|
@ -470,36 +470,39 @@ define([
|
|
|
|
.click(function () {
|
|
|
|
.click(function () {
|
|
|
|
$('<input>', {type:'file'}).on('change', onUpload).click();
|
|
|
|
$('<input>', {type:'file'}).on('change', onUpload).click();
|
|
|
|
}).appendTo($rightside);
|
|
|
|
}).appendTo($rightside);
|
|
|
|
var fileDialogCfg = {
|
|
|
|
|
|
|
|
onSelect: function (data) {
|
|
|
|
if (common.isLoggedIn()) {
|
|
|
|
if (data.type === 'file') {
|
|
|
|
var fileDialogCfg = {
|
|
|
|
var mt = '<media-tag src="' + data.src + '" data-crypto-key="cryptpad:' + data.key + '"></media-tag>';
|
|
|
|
onSelect: function (data) {
|
|
|
|
common.displayMediatagImage($(mt), function (err, $image) {
|
|
|
|
if (data.type === 'file') {
|
|
|
|
Util.blobURLToImage($image.attr('src'), function (imgSrc) {
|
|
|
|
var mt = '<media-tag src="' + data.src + '" data-crypto-key="cryptpad:' + data.key + '"></media-tag>';
|
|
|
|
var img = new Image();
|
|
|
|
common.displayMediatagImage($(mt), function (err, $image) {
|
|
|
|
img.onload = function () { addImageToCanvas(img); };
|
|
|
|
Util.blobURLToImage($image.attr('src'), function (imgSrc) {
|
|
|
|
img.src = imgSrc;
|
|
|
|
var img = new Image();
|
|
|
|
|
|
|
|
img.onload = function () { addImageToCanvas(img); };
|
|
|
|
|
|
|
|
img.src = imgSrc;
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
common.initFilePicker(fileDialogCfg);
|
|
|
|
|
|
|
|
APP.$mediaTagButton = $('<button>', {
|
|
|
|
|
|
|
|
title: Messages.filePickerButton,
|
|
|
|
|
|
|
|
'class': 'cp-toolbar-rightside-button fa fa-picture-o',
|
|
|
|
|
|
|
|
style: 'font-size: 17px'
|
|
|
|
|
|
|
|
}).click(function () {
|
|
|
|
|
|
|
|
var pickerCfg = {
|
|
|
|
|
|
|
|
types: ['file'],
|
|
|
|
|
|
|
|
where: ['root'],
|
|
|
|
|
|
|
|
filter: {
|
|
|
|
|
|
|
|
fileType: ['image/']
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
common.openFilePicker(pickerCfg);
|
|
|
|
common.initFilePicker(fileDialogCfg);
|
|
|
|
}).appendTo($rightside);
|
|
|
|
APP.$mediaTagButton = $('<button>', {
|
|
|
|
|
|
|
|
title: Messages.filePickerButton,
|
|
|
|
|
|
|
|
'class': 'cp-toolbar-rightside-button fa fa-picture-o',
|
|
|
|
|
|
|
|
style: 'font-size: 17px'
|
|
|
|
|
|
|
|
}).click(function () {
|
|
|
|
|
|
|
|
var pickerCfg = {
|
|
|
|
|
|
|
|
types: ['file'],
|
|
|
|
|
|
|
|
where: ['root'],
|
|
|
|
|
|
|
|
filter: {
|
|
|
|
|
|
|
|
fileType: ['image/']
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
common.openFilePicker(pickerCfg);
|
|
|
|
|
|
|
|
}).appendTo($rightside);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
metadataMgr.onChange(function () {
|
|
|
|
metadataMgr.onChange(function () {
|
|
|
|