From 55b93864e56758037500fdcf4e56abaed7272468 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 3 Jan 2018 11:53:14 +0100 Subject: [PATCH 1/5] update dependency versions --- bower.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index fad124ba9..c95e466cd 100644 --- a/bower.json +++ b/bower.json @@ -30,9 +30,9 @@ "secure-fabric.js": "secure-v1.7.9", "hyperjson": "~1.4.0", "chainpad-crypto": "^0.1.3", - "chainpad-listmap": "^0.4.0", + "chainpad-listmap": "^0.4.1", "chainpad": "^5.0.0", - "chainpad-netflux": "^0.6.0", + "chainpad-netflux": "^0.6.1", "file-saver": "1.3.1", "alertifyjs": "1.0.11", "scrypt-async": "1.2.0", From fc49b7ac871356508a0d72e92ee17b936fcce000 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 3 Jan 2018 11:56:58 +0100 Subject: [PATCH 2/5] bump bower again --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index c95e466cd..f9501dfeb 100644 --- a/bower.json +++ b/bower.json @@ -30,7 +30,7 @@ "secure-fabric.js": "secure-v1.7.9", "hyperjson": "~1.4.0", "chainpad-crypto": "^0.1.3", - "chainpad-listmap": "^0.4.1", + "chainpad-listmap": "^0.4.2", "chainpad": "^5.0.0", "chainpad-netflux": "^0.6.1", "file-saver": "1.3.1", From 4fc1079d679bb1cd3d981f7de24349bfdc585f37 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 15 Jan 2018 17:43:58 +0100 Subject: [PATCH 3/5] translate some stuff --- customize.dist/translations/messages.es.js | 3 ++- customize.dist/translations/messages.fr.js | 2 +- customize.dist/translations/messages.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/customize.dist/translations/messages.es.js b/customize.dist/translations/messages.es.js index b78673fc3..6df44d691 100644 --- a/customize.dist/translations/messages.es.js +++ b/customize.dist/translations/messages.es.js @@ -234,7 +234,8 @@ define(function () { out.login_invalUser = "Nombre de usuario requerido"; out.login_invalPass = "Contraseña requerida"; out.login_unhandledError = "Ha ocurrido un error inesperado :("; - out.register_importRecent = "Importar historial (recomendado)"; + out.register_importRecent = "Importe el historial de tu sesión anónima"; + out.register_acceptTerms = "Acepto los términos de servicio"; out.register_passwordsDontMatch = "Las contraseñas no corresponden"; out.register_mustAcceptTerms = "Tienes que aceptar los términos de servicio"; diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index 869064a8b..28c281c46 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -462,7 +462,7 @@ define(function () { out.login_invalPass = 'Mot de passe requis'; out.login_unhandledError = "Une erreur inattendue s'est produite :("; - out.register_importRecent = "Importer l'historique (Recommandé)"; + out.register_importRecent = "Importer les pads de votre session anonyme"; out.register_acceptTerms = "J'accepte les conditions d'utilisation"; out.register_passwordsDontMatch = "Les mots de passe doivent être identiques!"; out.register_passwordTooShort = "Les mots de passe doivent contenir au moins {0} caractères."; diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 6ac63c4ef..1c1a43bff 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -464,7 +464,7 @@ define(function () { out.login_invalPass = 'Password required'; out.login_unhandledError = 'An unexpected error occurred :('; - out.register_importRecent = "Import pad history (Recommended)"; + out.register_importRecent = "Import pads from your anonymous session"; out.register_acceptTerms = "I accept the terms of service"; out.register_passwordsDontMatch = "Passwords do not match!"; out.register_passwordTooShort = "Passwords must be at least {0} characters long."; From 88a04fdb07290b913e663635cc2bab9a0982e255 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 16 Jan 2018 11:26:16 +0100 Subject: [PATCH 4/5] Don't create sfcommon a second time in code and slide --- www/code/inner.js | 19 +++++++------------ www/common/sframe-common-codemirror.js | 6 +++--- www/common/sframe-common.js | 7 ++----- www/slide/inner.js | 15 +++++---------- 4 files changed, 17 insertions(+), 30 deletions(-) diff --git a/www/code/inner.js b/www/code/inner.js index d1e402aaa..8f9a4e6d1 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -4,6 +4,7 @@ define([ '/bower_components/nthen/index.js', '/common/sframe-common.js', '/common/sframe-app-framework.js', + '/common/sframe-common-codemirror.js', '/common/common-util.js', '/common/common-hash.js', '/common/modes.js', @@ -42,6 +43,7 @@ define([ nThen, SFCommon, Framework, + SFCodeMirror, Util, Hash, Modes, @@ -258,11 +260,11 @@ define([ mkFilePicker(framework, editor, evModeChange); if (!framework.isReadOnly()) { - CodeMirror.configureTheme(function () { - CodeMirror.configureLanguage(null, evModeChange.fire); + CodeMirror.configureTheme(common, function () { + CodeMirror.configureLanguage(common, null, evModeChange.fire); }); } else { - CodeMirror.configureTheme(); + CodeMirror.configureTheme(common); } //// @@ -345,7 +347,6 @@ define([ var main = function () { var CodeMirror; var editor; - var common; var framework; nThen(function (waitFor) { @@ -370,20 +371,14 @@ define([ nThen(function (waitFor) { $(waitFor()); - // TODO(cjd): This is crap but we cannot bring up codemirror until after - // the CryptPad Common is up and we can't bring up framework - // without codemirror. - SFCommon.create(waitFor(function (c) { common = c; })); }).nThen(function () { - CodeMirror = common.initCodeMirrorApp(null, CMeditor); + CodeMirror = SFCodeMirror.create(null, CMeditor); $('#cp-app-code-container').addClass('cp-app-code-fullpage'); editor = CodeMirror.editor; }).nThen(waitFor()); - }).nThen(function (waitFor) { - common.getSframeChannel().onReady(waitFor()); }).nThen(function (/*waitFor*/) { - common.isPresentUrl(function (err, val) { + framework._.sfCommon.isPresentUrl(function (err, val) { andThen2(editor, CodeMirror, framework, val); }); }); diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index b9d14b658..7470d4547 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -103,7 +103,7 @@ define([ return text.trim(); }; - module.create = function (Common, defaultMode, CMeditor) { + module.create = function (defaultMode, CMeditor) { var exp = {}; var CodeMirror = exp.CodeMirror = CMeditor; @@ -195,7 +195,7 @@ define([ return module.getHeadingText(editor); }; - exp.configureLanguage = function (cb, onModeChanged) { + exp.configureLanguage = function (Common, cb, onModeChanged) { var options = []; Modes.list.forEach(function (l) { options.push({ @@ -227,7 +227,7 @@ define([ if (cb) { cb(); } }; - exp.configureTheme = function (cb) { + exp.configureTheme = function (Common, cb) { /* Remember the user's last choice of theme using localStorage */ var themeKey = ['codemirror', 'theme']; diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 3899a0976..d2aaf90ea 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -329,13 +329,10 @@ define([ Object.freeze(funcs); return { create: function (cb) { - // TODO(cjd): This is crap but this gets loaded multiple places by /code/ and it is - // not ok with being loaded more than once. if (window.CryptPad_sframe_common) { - setTimeout(function () { cb(window.CryptPad_sframe_common); }); - return; + throw new Error("Sframe-common should only be created once"); } - window.CryptPad_sframe_common = funcs; + window.CryptPad_sframe_common = true; nThen(function (waitFor) { SFrameChannel.create(window.parent, waitFor(function (sfc) { ctx.sframeChan = sfc; }), true); diff --git a/www/slide/inner.js b/www/slide/inner.js index 8b4610ca5..173726d34 100644 --- a/www/slide/inner.js +++ b/www/slide/inner.js @@ -5,6 +5,7 @@ define([ '/common/sframe-common.js', '/slide/slide.js', '/common/sframe-app-framework.js', + '/common/sframe-common-codemirror.js', '/common/common-util.js', '/common/common-hash.js', '/common/common-interface.js', @@ -48,6 +49,7 @@ define([ SFCommon, Slide, Framework, + SFCodeMirror, Util, Hash, UI, @@ -464,7 +466,7 @@ define([ mkSlidePreviewPane(framework, $contentContainer); mkMarkdownToolbar(framework, editor); - CodeMirror.configureTheme(); + CodeMirror.configureTheme(common); framework.onContentUpdate(function (newContent) { CodeMirror.contentUpdate(newContent); @@ -550,7 +552,6 @@ define([ var main = function () { var CodeMirror; var editor; - var common; var framework; nThen(function (waitFor) { @@ -573,20 +574,14 @@ define([ nThen(function (waitFor) { $(waitFor()); - // TODO(cjd): This is crap but we cannot bring up codemirror until after - // the CryptPad Common is up and we can't bring up framework - // without codemirror. - SFCommon.create(waitFor(function (c) { common = c; })); }).nThen(function () { - CodeMirror = common.initCodeMirrorApp(null, CMeditor); + CodeMirror = SFCodeMirror.create(null, CMeditor); $('.CodeMirror').addClass('fullPage'); editor = CodeMirror.editor; }).nThen(waitFor()); - }).nThen(function (waitFor) { - common.getSframeChannel().onReady(waitFor()); }).nThen(function (/*waitFor*/) { - common.isPresentUrl(function (err, val) { + framework._.sfCommon.isPresentUrl(function (err, val) { andThen2(editor, CodeMirror, framework, val); }); }); From 3118dd8312beaa60497c481cbd66c0bfa193a350 Mon Sep 17 00:00:00 2001 From: ansuz Date: Tue, 16 Jan 2018 11:52:04 +0100 Subject: [PATCH 5/5] set logLevel to 2 by default for sframe apps --- www/common/sframe-chainpad-netflux-inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/www/common/sframe-chainpad-netflux-inner.js b/www/common/sframe-chainpad-netflux-inner.js index 71359ba4a..9467d8dae 100644 --- a/www/common/sframe-chainpad-netflux-inner.js +++ b/www/common/sframe-chainpad-netflux-inner.js @@ -40,7 +40,7 @@ define([ var patchTransformer = config.patchTransformer; var validateContent = config.validateContent; var avgSyncMilliseconds = config.avgSyncMilliseconds; - var logLevel = typeof(config.logLevel) !== 'undefined'? config.logLevel : 1; + var logLevel = typeof(config.logLevel) !== 'undefined'? config.logLevel : 2; var readOnly = config.readOnly || false; var sframeChan = config.sframeChan; var metadataMgr = config.metadataMgr;