|
|
@ -6,9 +6,11 @@ define([
|
|
|
|
'/bower_components/nthen/index.js',
|
|
|
|
'/bower_components/nthen/index.js',
|
|
|
|
'/common/sframe-common.js',
|
|
|
|
'/common/sframe-common.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
|
|
|
|
'/common/hyperscript.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-interface.js',
|
|
|
|
'/common/common-interface.js',
|
|
|
|
|
|
|
|
'/common/common-ui-elements.js',
|
|
|
|
'/common/common-thumbnail.js',
|
|
|
|
'/common/common-thumbnail.js',
|
|
|
|
'/common/common-feedback.js',
|
|
|
|
'/common/common-feedback.js',
|
|
|
|
'/customize/application_config.js',
|
|
|
|
'/customize/application_config.js',
|
|
|
@ -26,9 +28,11 @@ define([
|
|
|
|
nThen,
|
|
|
|
nThen,
|
|
|
|
SFCommon,
|
|
|
|
SFCommon,
|
|
|
|
Messages,
|
|
|
|
Messages,
|
|
|
|
|
|
|
|
h,
|
|
|
|
Util,
|
|
|
|
Util,
|
|
|
|
Hash,
|
|
|
|
Hash,
|
|
|
|
UI,
|
|
|
|
UI,
|
|
|
|
|
|
|
|
UIElements,
|
|
|
|
Thumb,
|
|
|
|
Thumb,
|
|
|
|
Feedback,
|
|
|
|
Feedback,
|
|
|
|
AppConfig,
|
|
|
|
AppConfig,
|
|
|
@ -408,10 +412,36 @@ define([
|
|
|
|
var $export = common.createButton('export', true, {}, function () {
|
|
|
|
var $export = common.createButton('export', true, {}, function () {
|
|
|
|
var ext = (typeof(extension) === 'function') ? extension() : extension;
|
|
|
|
var ext = (typeof(extension) === 'function') ? extension() : extension;
|
|
|
|
var suggestion = title.suggestTitle('cryptpad-document');
|
|
|
|
var suggestion = title.suggestTitle('cryptpad-document');
|
|
|
|
|
|
|
|
ext = ext || '.txt';
|
|
|
|
|
|
|
|
var types = [{
|
|
|
|
|
|
|
|
tag: 'a',
|
|
|
|
|
|
|
|
attributes: {
|
|
|
|
|
|
|
|
'data-value': ext,
|
|
|
|
|
|
|
|
'href': '#'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
content: ext
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
tag: 'a',
|
|
|
|
|
|
|
|
attributes: {
|
|
|
|
|
|
|
|
'data-value': '',
|
|
|
|
|
|
|
|
'href': '#'
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
content: ' '
|
|
|
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
var dropdownConfig = {
|
|
|
|
|
|
|
|
text: ext, // Button initial text
|
|
|
|
|
|
|
|
caretDown: true,
|
|
|
|
|
|
|
|
options: types, // Entries displayed in the menu
|
|
|
|
|
|
|
|
isSelect: true,
|
|
|
|
|
|
|
|
initialValue: ext,
|
|
|
|
|
|
|
|
common: common
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
var $select = UIElements.createDropdown(dropdownConfig);
|
|
|
|
UI.prompt(Messages.exportPrompt,
|
|
|
|
UI.prompt(Messages.exportPrompt,
|
|
|
|
Util.fixFileName(suggestion) + ext, function (filename)
|
|
|
|
Util.fixFileName(suggestion), function (filename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!(typeof(filename) === 'string' && filename)) { return; }
|
|
|
|
if (!(typeof(filename) === 'string' && filename)) { return; }
|
|
|
|
|
|
|
|
filename = filename + $select.getValue();
|
|
|
|
if (async) {
|
|
|
|
if (async) {
|
|
|
|
fe(function (blob) {
|
|
|
|
fe(function (blob) {
|
|
|
|
SaveAs(blob, filename);
|
|
|
|
SaveAs(blob, filename);
|
|
|
@ -420,6 +450,8 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var blob = fe();
|
|
|
|
var blob = fe();
|
|
|
|
SaveAs(blob, filename);
|
|
|
|
SaveAs(blob, filename);
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
typeInput: $select[0]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
toolbar.$drawer.append($export);
|
|
|
|
toolbar.$drawer.append($export);
|
|
|
|