Merge branch 'staging' of https://github.com/xwiki-labs/cryptpad into staging

pull/1/head
Pierre Bondoerffer 8 years ago
commit fc2aac2d1b
No known key found for this signature in database
GPG Key ID: C0C7C0C5063F2236

@ -234,7 +234,7 @@ define(function () {
"<li>You can import pads which were recently viewed in your browser so you have them in your account.</li>", "<li>You can import pads which were recently viewed in your browser so you have them in your account.</li>",
"<li>If you are using a shared computer, you need to log out when you are done, closing the tab is not enough.</li>", "<li>If you are using a shared computer, you need to log out when you are done, closing the tab is not enough.</li>",
"</ul>" "</ul>"
]; ].join('');
// Settings // Settings
out.settings_title = "Settings"; out.settings_title = "Settings";

@ -564,6 +564,11 @@ define([
editor.setValue(newDoc || ''); editor.setValue(newDoc || '');
if (Cryptpad.initialName && document.title === defaultName) {
updateTitle(Cryptpad.initialName);
onLocal();
}
if (Visible.isSupported()) { if (Visible.isSupported()) {
Visible.onChange(function (yes) { Visible.onChange(function (yes) {
if (yes) { unnotify(); } if (yes) { unnotify(); }

@ -214,15 +214,6 @@ define([
secret.keys = Crypto.createEditCryptor(); secret.keys = Crypto.createEditCryptor();
secret.key = Crypto.createEditCryptor().editKeyStr; secret.key = Crypto.createEditCryptor().editKeyStr;
}; };
// If we have a hash in the URL specifying a path, it means the document was created from
// the drive and should be stored at the selected path.
if (/[?&]path=/.test(window.location.hash)) {
var patharr = window.location.hash.match(/[?&]path=([^&]+)/);
var namearr = window.location.hash.match(/[?&]name=([^&]+)/);
common.initialPath = patharr[1] || undefined;
common.initialName = namearr && namearr[1] ? decodeURIComponent(namearr[1]) : undefined;
window.location.hash = '';
}
if (!secretHash && !/#/.test(window.location.href)) { if (!secretHash && !/#/.test(window.location.href)) {
generate(); generate();
return secret; return secret;
@ -698,6 +689,9 @@ define([
}); });
}; };
var newPadNameKey = common.newPadNameKey = "newPadName";
var newPadPathKey = common.newPadPathKey = "newPadPath";
// local name? // local name?
common.ready = function (f) { common.ready = function (f) {
var state = 0; var state = 0;
@ -708,6 +702,15 @@ define([
f(void 0, env); f(void 0, env);
}; };
if (sessionStorage[newPadNameKey]) {
common.initialName = sessionStorage[newPadNameKey];
delete sessionStorage[newPadNameKey];
}
if (sessionStorage[newPadPathKey]) {
common.initialPath = sessionStorage[newPadPathKey];
delete sessionStorage[newPadPathKey];
}
Store.ready(function (err, storeObj) { Store.ready(function (err, storeObj) {
store = common.store = env.store = storeObj; store = common.store = env.store = storeObj;

@ -897,8 +897,11 @@ define([
} }
var onNamed = function (name) { var onNamed = function (name) {
if (!name) { return; } if (!name) { return; }
// TODO
var path = '/#?name=' + encodeURIComponent(name) + '&path=' + encodeURIComponent(currentPath); var path = '/#?name=' + encodeURIComponent(name) + '&path=' + encodeURIComponent(currentPath);
window.open('/' + type + path); sessionStorage[Cryptpad.newPadNameKey] = name;
sessionStorage[Cryptpad.newPadPathKey] = currentPath;
window.open('/' + type + '/');
}; };
Cryptpad.prompt(Messages.fm_nameFile, Cryptpad.getDefaultName({type: type}), onNamed); Cryptpad.prompt(Messages.fm_nameFile, Cryptpad.getDefaultName({type: type}), onNamed);
}; };

@ -372,6 +372,8 @@ define([
}; };
if (!initializing) { if (!initializing) {
hjson[3].metadata.title = document.title; hjson[3].metadata.title = document.title;
} else if (Cryptpad.initialName) {
hjson[3].metadata.title = Cryptpad.initialName;
} }
return stringify(hjson); return stringify(hjson);
}; };

@ -567,7 +567,11 @@ define([
} else { } else {
APP.proxy.info.defaultTitle = defaultName; APP.proxy.info.defaultTitle = defaultName;
} }
updateTitle(APP.proxy.info.title || defaultName); if (Cryptpad.initialName && !APP.proxy.info.title) {
updateTitle(Cryptpad.initialName);
} else {
updateTitle(APP.proxy.info.title || defaultName);
}
// Description // Description
var resize = function () { var resize = function () {

@ -638,6 +638,11 @@ define([
editor.setValue(newDoc || ''); editor.setValue(newDoc || '');
Slide.update(newDoc); Slide.update(newDoc);
if (Cryptpad.initialName && APP.title === defaultName) {
updateTitle(Cryptpad.initialName);
onLocal();
}
if (Visible.isSupported()) { if (Visible.isSupported()) {
Visible.onChange(function (yes) { Visible.onChange(function (yes) {
if (yes) { unnotify(); } if (yes) { unnotify(); }

Loading…
Cancel
Save