save images drawn with whiteboard to your CryptDrive

This commit is contained in:
ansuz
2017-08-02 16:51:41 +02:00
parent fe826133b3
commit 8b0831ac5d
3 changed files with 29 additions and 1 deletions

View File

@@ -212,6 +212,18 @@ window.canvas = canvas;
});
};
module.FM = Cryptpad.createFileManager({});
module.upload = function (title) {
$canvas[0].toBlob(function (blob) {
blob.name = title;
var reader = new FileReader();
reader.onloadend = function () {
module.FM.handleFile(blob);
};
reader.readAsArrayBuffer(blob);
});
};
var initializing = true;
var $bar = $('#toolbar');
@@ -337,6 +349,15 @@ window.canvas = canvas;
var $export = Cryptpad.createButton('export', true, {}, saveImage);
$rightside.append($export);
Cryptpad.createButton('savetodrive', true, {}, function () {})
.click(function () {
Cryptpad.prompt(Messages.exportPrompt, document.title + '.png',
function (name) {
if (name === null || !name.trim()) { return; }
module.upload(name);
});
}).appendTo($rightside);
var $forget = Cryptpad.createButton('forget', true, {}, function (err) {
if (err) { return; }
setEditable(false);
@@ -344,7 +365,6 @@ window.canvas = canvas;
});
$rightside.append($forget);
var editHash;
if (!readOnly) {