Add support for the file applicaiton in the drive

pull/1/head
yflory 8 years ago
parent 2a417ddae8
commit 9882a3a923

@ -11,6 +11,7 @@ define(function () {
out.type.slide = 'Présentation'; out.type.slide = 'Présentation';
out.type.drive = 'Drive'; out.type.drive = 'Drive';
out.type.whiteboard = "Tableau Blanc"; out.type.whiteboard = "Tableau Blanc";
out.type.file = "Fichier";
out.button_newpad = 'Nouveau document texte'; out.button_newpad = 'Nouveau document texte';
out.button_newcode = 'Nouvelle page de code'; out.button_newcode = 'Nouvelle page de code';

@ -11,6 +11,7 @@ define(function () {
out.type.slide = 'Presentation'; out.type.slide = 'Presentation';
out.type.drive = 'Drive'; out.type.drive = 'Drive';
out.type.whiteboard = 'Whiteboard'; out.type.whiteboard = 'Whiteboard';
out.type.file = 'File';
out.button_newpad = 'New Rich Text pad'; out.button_newpad = 'New Rich Text pad';
out.button_newcode = 'New Code pad'; out.button_newcode = 'New Code pad';

@ -252,7 +252,7 @@ Version 2
if (parsed.version === 0) { if (parsed.version === 0) {
return parsed.channel; return parsed.channel;
} else if (parsed.version !== 1) { } else if (parsed.version !== 1 && parsed.version !== 2) {
console.error("parsed href had no version"); console.error("parsed href had no version");
console.error(parsed); console.error(parsed);
return; return;

@ -791,7 +791,7 @@ define([
if (!connected) { return; } if (!connected) { return; }
checkLag(getLag, lagElement); checkLag(getLag, lagElement);
}, 3000); }, 3000);
} } else { connected = true; }
var failed = function () { var failed = function () {
connected = false; connected = false;

@ -31,6 +31,37 @@ define([
// Test hash: // Test hash:
// #/2/K6xWU-LT9BJHCQcDCT-DcQ/TBo77200c0e-FdldQFcnQx4Y/image-png // #/2/K6xWU-LT9BJHCQcDCT-DcQ/TBo77200c0e-FdldQFcnQx4Y/image-png
var parsed = Cryptpad.parsePadUrl(window.location.href);
var defaultName = Cryptpad.getDefaultName(parsed);
var getTitle = function () {
var pad = Cryptpad.getRelativeHref(window.location.href);
var fo = Cryptpad.getStore().getProxy().fo;
var data = fo.getFileData(pad);
return data ? data.title : undefined;
};
var updateTitle = function (newTitle) {
Cryptpad.renamePad(newTitle, function (err, data) {
if (err) {
console.log("Couldn't set pad title");
console.error(err);
return;
}
document.title = newTitle;
$bar.find('.' + Toolbar.constants.title).find('span.title').text(data);
$bar.find('.' + Toolbar.constants.title).find('input').val(data);
});
};
var suggestName = function () {
return document.title || getTitle() || '';
};
var renameCb = function (err, title) {
document.title = title;
};
var $mt = $iframe.find('#encryptedFile'); var $mt = $iframe.find('#encryptedFile');
$mt.attr('src', '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName); $mt.attr('src', '/blob/' + hexFileName.slice(0,2) + '/' + hexFileName);
$mt.attr('data-crypto-key', cryptKey); $mt.attr('data-crypto-key', cryptKey);
@ -41,9 +72,16 @@ define([
var configTb = { var configTb = {
displayed: ['useradmin', 'newpad'], displayed: ['useradmin', 'newpad'],
ifrw: ifrw, ifrw: ifrw,
common: Cryptpad common: Cryptpad,
title: {
onRename: renameCb,
defaultName: defaultName,
suggestName: suggestName
}
}; };
Toolbar.create($bar, null, null, null, null, configTb); Toolbar.create($bar, null, null, null, null, configTb);
updateTitle(Cryptpad.initialName || getTitle() || defaultName);
}); });
}; };
Loading…
Cancel
Save