Ability to export mediatag images in pad
This commit is contained in:
@@ -207,5 +207,19 @@ define([], function () {
|
||||
return Array.prototype.slice.call(A);
|
||||
};
|
||||
|
||||
Util.blobURLToImage = function (url, cb) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onload = function() {
|
||||
var reader = new FileReader();
|
||||
reader.onloadend = function() {
|
||||
cb(reader.result);
|
||||
};
|
||||
reader.readAsDataURL(xhr.response);
|
||||
};
|
||||
xhr.open('GET', url);
|
||||
xhr.responseType = 'blob';
|
||||
xhr.send();
|
||||
};
|
||||
|
||||
return Util;
|
||||
});
|
||||
|
||||
@@ -265,7 +265,7 @@ define([
|
||||
}
|
||||
};
|
||||
|
||||
var setFileExporter = function (extension, fe) {
|
||||
var setFileExporter = function (extension, fe, async) {
|
||||
var $export = common.createButton('export', true, {}, function () {
|
||||
var ext = (typeof(extension) === 'function') ? extension() : extension;
|
||||
var suggestion = title.suggestTitle('cryptpad-document');
|
||||
@@ -273,6 +273,12 @@ define([
|
||||
Cryptpad.fixFileName(suggestion) + '.' + ext, function (filename)
|
||||
{
|
||||
if (!(typeof(filename) === 'string' && filename)) { return; }
|
||||
if (async) {
|
||||
fe(function (blob) {
|
||||
SaveAs(blob, filename);
|
||||
});
|
||||
return;
|
||||
}
|
||||
var blob = fe();
|
||||
SaveAs(blob, filename);
|
||||
});
|
||||
@@ -280,10 +286,17 @@ define([
|
||||
toolbar.$drawer.append($export);
|
||||
};
|
||||
|
||||
var setFileImporter = function (options, fi) {
|
||||
var setFileImporter = function (options, fi, async) {
|
||||
if (readOnly) { return; }
|
||||
toolbar.$drawer.append(
|
||||
common.createButton('import', true, options, function (c, f) {
|
||||
if (async) {
|
||||
fi(c, f, function (content) {
|
||||
contentUpdate(content);
|
||||
onLocal();
|
||||
});
|
||||
return;
|
||||
}
|
||||
contentUpdate(fi(c, f));
|
||||
onLocal();
|
||||
})
|
||||
@@ -551,4 +564,4 @@ define([
|
||||
});
|
||||
};
|
||||
return { create: create };
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user