diff --git a/customize.dist/ckeditor-config.js b/customize.dist/ckeditor-config.js index 019014299..a39616e6e 100644 --- a/customize.dist/ckeditor-config.js +++ b/customize.dist/ckeditor-config.js @@ -27,7 +27,7 @@ CKEDITOR.editorConfig = function( config ) { config.font_defaultLabel = 'Arial'; config.fontSize_defaultLabel = '16'; - config.contentsCss = '/customize/ckeditor-contents.css'; + config.contentsCss = '/customize/ckeditor-contents.css?' + CKEDITOR.CRYPTPAD_URLARGS; config.keystrokes = [ [ CKEDITOR.ALT + 121 /*F10*/, 'toolbarFocus' ], @@ -55,3 +55,17 @@ CKEDITOR.editorConfig = function( config ) { //skin: 'moono-dark,/pad/themes/moono-dark/' //skin: 'office2013,/pad/themes/office2013/' }; + +(function () { + // These are overrides inside of ckeditor which add ?ver= to the CSS files so that + // every part of ckeditor will get in the browser cache. + var fix = function (x) { + if (x.map) { return x.map(fix); } + console.log('> ' + x); + return (/\/bower_components\/.*\.css$/.test(x)) ? (x + '?ver=' + CKEDITOR.timestamp) : x; + }; + CKEDITOR.tools._buildStyleHtml = CKEDITOR.tools.buildStyleHtml; + CKEDITOR.document._appendStyleSheet = CKEDITOR.document.appendStyleSheet; + CKEDITOR.tools.buildStyleHtml = function (x) { return CKEDITOR.tools._buildStyleHtml(fix(x)); }; + CKEDITOR.document.appendStyleSheet = function (x) { return CKEDITOR.document._appendStyleSheet(fix(x)); }; +}()); \ No newline at end of file diff --git a/www/common/boot2.js b/www/common/boot2.js index b24ce38af..487eb8ae6 100644 --- a/www/common/boot2.js +++ b/www/common/boot2.js @@ -2,7 +2,7 @@ define([ '/common/requireconfig.js' ], function (RequireConfig) { - require.config(RequireConfig); + require.config(RequireConfig()); // most of CryptPad breaks if you don't support isArray if (!Array.isArray) { diff --git a/www/common/requireconfig.js b/www/common/requireconfig.js index caa0da868..85258ea8b 100644 --- a/www/common/requireconfig.js +++ b/www/common/requireconfig.js @@ -21,5 +21,7 @@ define([ } }; Object.keys(ApiConfig.requireConf).forEach(function (k) { out[k] = ApiConfig.requireConf[k]; }); - return out; + return function () { + return JSON.parse(JSON.stringify(out)); + }; }); diff --git a/www/common/sframe-boot.js b/www/common/sframe-boot.js index 5206b3e68..4abac6e37 100644 --- a/www/common/sframe-boot.js +++ b/www/common/sframe-boot.js @@ -2,20 +2,18 @@ // Note that this file is meant to be executed only inside of a sandbox iframe. ;(function () { var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1))); -if (req.cfg) { require.config(req.cfg); } +req.cfg = req.cfg || {}; if (req.pfx) { - require.config({ - onNodeCreated: function (node, config, module, path) { - node.setAttribute('src', req.pfx + node.getAttribute('src')); - } - }); + req.cfg.onNodeCreated = function (node, config, module, path) { + node.setAttribute('src', req.pfx + node.getAttribute('src')); + }; } +require.config(req.cfg); if (req.req) { require(req.req, function () { }); } window.addEventListener('message', function (msg) { var data = JSON.parse(msg.data); if (data.q !== 'INIT') { return; } msg.source.postMessage(JSON.stringify({ txid: data.txid, content: 'OK' }), '*'); - if (data.content && data.content.requireConf) { require.config(data.content.requireConf); } require(['/common/sframe-boot2.js'], function () { }); }); }()); \ No newline at end of file diff --git a/www/common/sframe-boot2.js b/www/common/sframe-boot2.js index 45e32a2ca..38395a21f 100644 --- a/www/common/sframe-boot2.js +++ b/www/common/sframe-boot2.js @@ -1,7 +1,7 @@ // This is stage 1, it can be changed but you must bump the version of the project. // Note: This must only be loaded from inside of a sandbox-iframe. define(['/common/requireconfig.js'], function (RequireConfig) { - require.config(RequireConfig); + require.config(RequireConfig()); // most of CryptPad breaks if you don't support isArray if (!Array.isArray) { diff --git a/www/common/sframe-channel.js b/www/common/sframe-channel.js index dcf5e1abc..bce9cfdd3 100644 --- a/www/common/sframe-channel.js +++ b/www/common/sframe-channel.js @@ -145,7 +145,7 @@ define([ intr = setInterval(function () { ow.postMessage(JSON.stringify({ txid: txid, - content: { requireConf: RequireConfig }, + content: { requireConf: RequireConfig() }, q: 'INIT' }), '*'); }, 1); diff --git a/www/common/toolbar3.js b/www/common/toolbar3.js index 9ded9b136..e254dbb55 100644 --- a/www/common/toolbar3.js +++ b/www/common/toolbar3.js @@ -606,7 +606,7 @@ define([ title: buttonTitle, 'class': "cryptpad-logo" }).append($('', { - src: '/customize/images/logo_white.png' + src: '/customize/images/logo_white.png?' + ApiConfig.requireConf.urlArgs })); var onClick = function (e) { e.preventDefault(); diff --git a/www/pad2/inner.html b/www/pad2/inner.html index 2d5efe5b4..23aa8b764 100644 --- a/www/pad2/inner.html +++ b/www/pad2/inner.html @@ -2,11 +2,7 @@
- - - -