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

pull/1/head
ansuz 8 years ago
commit d15a08830e

@ -155,9 +155,11 @@ define(req, function(Default, Language) {
$('#pad-iframe').contents().find('[data-localization-title]').each(translateTitle);
};
messages.driveReadme = '["BODY",{"class":"cke_editable cke_editable_themed cke_contents_ltr cke_show_borders","contenteditable":"true","spellcheck":"false","style":"color: rgb(51, 51, 51);"},' +
/*messages.driveReadme = '["BODY",{"class":"cke_editable cke_editable_themed cke_contents_ltr cke_show_borders","contenteditable":"true","spellcheck":"false","style":"color: rgb(51, 51, 51);"},' +
'[["H1",{},["' + messages.driveReadme_h1 + '",["BR",{},[]]]],["UL",{},[["LI",{},["' + messages.driveReadme_li1 + '",["BR",{},[]],["UL",{},[["LI",{},["' + messages.driveReadme_li1_1 + '",["BR",{},[]]]]]]]]]]],' +
'{"metadata":{"defaultTitle":"' + messages.driveReadmeTitle + '","title":"' + messages.driveReadmeTitle + '"}}]';
*/
messages.driveReadme = '[["H1",{},["'+messages.readme_welcome+'"]],["P",{},["'+messages.readme_p1+'"]],["P",{},["'+messages.readme_p2+'"]],["HR",{},[]],["H2",{},["'+messages.readme_cat1+'",["BR",{},[]]]],["UL",{},[["LI",{},["'+messages._getKey("readme_cat1_l1", ['",["STRONG",{},["'+messages.newButton+'"]],"', '",["STRONG",{},["'+messages.type.pad+'"]],"'])+'"]],["LI",{},["'+messages.readme_cat1_l2+'"]],["LI",{},["'+messages._getKey("readme_cat1_l3", ['",["STRONG",{},["'+messages.unsortedName+'"]],"'])+'",["UL",{},[["LI",{},["You can click and drag files into folders in the ",["STRONG",{},["Documents"]]," section of your drive and make new folders."]],["LI",{},["Remember to try right clicking on icons because there are often additional menus."]]]]]],["LI",{},["Put old pads in the trash: You can click and drag your pads into the ",["STRONG",{},["Trash"]]," the same way you drag them into folders.",["BR",{},[]]]]]],["P",{},[["BR",{},[]]]],["H2",{},["Make pads like a pro",["BR",{},[]]]],["UL",{},[["LI",{},["The ",["STRONG",{},["Share"]]," button in your pad allows you to give access to collaborators to either ",["STRONG",{},["edit"]]," or to ",["STRONG",{},["view"]]," the pad."]],["LI",{},["Change the title of the pad by clicking on the pencil"]]]],["P",{},[["BR",{},[]]]],["H2",{},["Discover CryptPad apps"]],["UL",{},[["LI",{},["With CryptPad code editor, you can collaborate on code like Javascript and markdown like HTML and Markdown"]],["LI",{},["With CryptPad slide editor, you can make quick presentations using Markdown"]],["LI",{},["With CryptPoll you can take quick votes, especially for scheduling meetings which fit with everybody\'s calander",["BR",{},[]]]]]]]';
return messages;

@ -391,5 +391,13 @@ define(function () {
out.driveReadme_li1 = "CryptDrive : all your pads sorted in one place";
out.driveReadme_li1_1 = "Tree, trash, unsorted files, etc.";
out.readme_welcome = "Welcome to CryptPad !";
out.readme_p1 = "Welcome to CryptPad, this is where you can take note of things alone and with friends.";
out.readme_p2 = "This pad will give you a quick walk through of how you can use CryptPad to take notes, keep them organized and work together on them.";
out.readme_cat1 = "Get to know your CryptDrive";
out.readme_cat1_l1 = "Make a pad: In your CryptDrive, click {0} then {1} and you can make a pad.";
out.readme_cat1_l2 = "Open Pads from your CryptDrive: double-click on a pad icon to open it.";
out.readme_cat1_l3 = "Organize your pads: When you are logged in, every pad you access will be shown as in the {0} section of your drive.";
return out;
});

@ -52,6 +52,7 @@ define([
var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox');
var parsedHash = Cryptpad.parsePadUrl(window.location.href);
var defaultName = Cryptpad.getDefaultName(parsedHash);
var initialState = Messages.codeInitialState;
var editor = module.editor = CMeditor.fromTextArea($textarea[0], {
lineNumbers: true,
@ -68,7 +69,7 @@ define([
mode: "javascript",
readOnly: true
});
editor.setOption('placeholder', Messages.codeInitialState);
editor.setValue(Messages.codeInitialState);
var setMode = module.setMode = function (mode, $select) {
module.highlightMode = mode;
@ -84,8 +85,6 @@ define([
}
};
editor.setValue('');
var setTheme = module.setTheme = (function () {
var path = '/common/theme/';
@ -562,7 +561,9 @@ define([
// Update the user list (metadata) from the hyperjson
updateMetadata(userDoc);
editor.setValue(newDoc || '');
if (newDoc) {
editor.setValue(newDoc);
}
if (Cryptpad.initialName && document.title === defaultName) {
updateTitle(Cryptpad.initialName);

@ -70,10 +70,16 @@ define([
TextPatcher.create({
realtime: realtime,
})(doc);
realtime.sync();
realtime.abort();
finish(Session, void 0);
var to = window.setTimeout(function () {
cb(new Error("Timeout"));
}, 5000);
Cryptpad.whenRealtimeSyncs(realtime, function () {
window.clearTimeout(to);
realtime.abort();
finish(Session, void 0);
});
};
overwrite(config, opt);

@ -1903,9 +1903,11 @@ define([
var createReadme = function (proxy, cb) {
if (proxy.initializing) {
var hash = Cryptpad.createRandomHash();
console.log(Messages.driveReadme);
Get.put(hash, Messages.driveReadme, function (e) {
if (e) { console.error(e); }
var href = '/pad/#' + hash;
console.log(href);
proxy.drive[UNSORTED].push(href);
proxy.drive[FILES_DATA].push({
href: href,

@ -4,7 +4,6 @@
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
<link rel="stylesheet" href="/bower_components/components-font-awesome/css/font-awesome.min.css">
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
<script src="/bower_components/ckeditor/ckeditor.js"></script>
<style>

@ -130,7 +130,7 @@ define([
$(inner).css({
color: '#fff',
});
documentBody.innerHTML = Messages.initialState;
//documentBody.innerHTML = Messages.initialState;
var cursor = window.cursor = Cursor(inner);
@ -367,7 +367,8 @@ define([
var realtimeOptions = {
// provide initialstate...
initialState: stringifyDOM(inner) || '{}',
//initialState: stringifyDOM(inner) || '{}',
initialState: '[]',
// the websocket URL
websocketURL: Cryptpad.getWebsocketURL(),
@ -675,32 +676,41 @@ define([
module.realtime = info.realtime;
var shjson = info.realtime.getUserDoc();
applyHjson(shjson);
// Update the user list (metadata) from the hyperjson
updateMetadata(shjson);
var newPad = false;
if (shjson === '[]') { newPad = true; }
if (Visible.isSupported()) {
Visible.onChange(function (yes) {
if (yes) { unnotify(); }
});
}
if (!newPad) {
applyHjson(shjson);
if (!readOnly) {
var shjson2 = stringifyDOM(inner);
var hjson2 = JSON.parse(shjson2).slice(0,-1);
var hjson = JSON.parse(shjson).slice(0,-1);
if (stringify(hjson2) !== stringify(hjson)) {
console.log('err');
console.error("shjson2 !== shjson");
Cryptpad.errorLoadingScreen("Unable to display the content of that realtime session in your browser. Please try to reload that page."); // TODO translate
throw new Error();
// Update the user list (metadata) from the hyperjson
updateMetadata(shjson);
if (Visible.isSupported()) {
Visible.onChange(function (yes) {
if (yes) { unnotify(); }
});
}
if (!readOnly) {
var shjson2 = stringifyDOM(inner);
var hjson2 = JSON.parse(shjson2).slice(0,-1);
var hjson = JSON.parse(shjson).slice(0,-1);
if (stringify(hjson2) !== stringify(hjson)) {
console.log('err');
console.error("shjson2 !== shjson");
Cryptpad.errorLoadingScreen("Unable to display the content of that realtime session in your browser. Please try to reload that page."); // TODO translate
throw new Error();
}
}
} else {
updateMetadata(shjson);
documentBody.innerHTML = Messages.initialState;
}
Cryptpad.getLastName(function (err, lastName) {
console.log("Unlocking editor");
setEditable(true);
setEditable(!readOnly);
initializing = false;
Cryptpad.removeLoadingScreen(emitResize);

@ -72,6 +72,7 @@ define([
var $bar = $('#pad-iframe')[0].contentWindow.$('#cme_toolbox');
var parsedHash = Cryptpad.parsePadUrl(window.location.href);
var defaultName = Cryptpad.getDefaultName(parsedHash);
var initialState = Messages.slideInitialState;
var editor = module.editor = CMeditor.fromTextArea($textarea[0], {
lineNumbers: true,
@ -88,7 +89,7 @@ define([
mode: "javascript",
readOnly: true
});
editor.setOption('placeholder', Messages.slideInitialState);
editor.setValue(initialState);
var setMode = module.setMode = function (mode, $select) {
module.highlightMode = mode;
@ -102,8 +103,6 @@ define([
};
setMode('markdown');
editor.setValue('');
var setTheme = module.setTheme = (function () {
var path = '/common/theme/';
@ -136,7 +135,7 @@ define([
var $modal = $pad.contents().find('#modal');
var $content = $pad.contents().find('#content');
Slide.setModal($modal, $content, $pad, ifrw, Messages.slideInitialState);
Slide.setModal($modal, $content, $pad, ifrw, initialState);
var enterPresentationMode = function (shouldLog) {
Slide.show(true, $textarea.val());
@ -634,7 +633,7 @@ define([
// Update the user list (metadata) from the hyperjson
updateMetadata(userDoc);
editor.setValue(newDoc || '');
editor.setValue(newDoc || initialState);
Slide.update(newDoc);
if (Cryptpad.initialName && APP.title === defaultName) {

Loading…
Cancel
Save