|
|
@ -399,34 +399,18 @@ define([
|
|
|
|
}).appendTo($rightside);
|
|
|
|
}).appendTo($rightside);
|
|
|
|
|
|
|
|
|
|
|
|
if (framework._.sfCommon.isLoggedIn()) {
|
|
|
|
if (framework._.sfCommon.isLoggedIn()) {
|
|
|
|
var fileDialogCfg = {
|
|
|
|
framework.setMediaTagEmbedder(function ($mt) {
|
|
|
|
onSelect: function (data) {
|
|
|
|
framework._.sfCommon.displayMediatagImage($mt, function (err, $image) {
|
|
|
|
if (data.type === 'file') {
|
|
|
|
|
|
|
|
var mt = '<media-tag src="' + data.src + '" data-crypto-key="cryptpad:' + data.key + '"></media-tag>';
|
|
|
|
|
|
|
|
framework._.sfCommon.displayMediatagImage($(mt), function (err, $image) {
|
|
|
|
|
|
|
|
// Convert src from blob URL to base64 data URL
|
|
|
|
// Convert src from blob URL to base64 data URL
|
|
|
|
// XXX base64 is heavy...
|
|
|
|
|
|
|
|
Util.blobURLToImage($image.attr('src'), function (imgSrc) {
|
|
|
|
Util.blobURLToImage($image.attr('src'), function (imgSrc) {
|
|
|
|
var img = new Image();
|
|
|
|
var img = new Image();
|
|
|
|
img.onload = function () { addImageToCanvas(img); };
|
|
|
|
img.onload = function () { addImageToCanvas(img); };
|
|
|
|
img.src = imgSrc;
|
|
|
|
img.src = imgSrc;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}, {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
framework._.sfCommon.initFilePicker(fileDialogCfg);
|
|
|
|
|
|
|
|
framework._.sfCommon.createButton('mediatag', true).click(function () {
|
|
|
|
|
|
|
|
var pickerCfg = {
|
|
|
|
|
|
|
|
types: ['file'],
|
|
|
|
|
|
|
|
where: ['root'],
|
|
|
|
|
|
|
|
filter: {
|
|
|
|
|
|
|
|
fileType: ['image/']
|
|
|
|
fileType: ['image/']
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
framework._.sfCommon.openFilePicker(pickerCfg);
|
|
|
|
|
|
|
|
}).appendTo($rightside);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Export to drive as PNG
|
|
|
|
// Export to drive as PNG
|
|
|
|
framework._.sfCommon.createButton('savetodrive', true, {}).click(function () {
|
|
|
|
framework._.sfCommon.createButton('savetodrive', true, {}).click(function () {
|
|
|
|