Show users editing and lag, properly send message to indicate that all users have left channel and show basic error box if disconnected.

This commit is contained in:
Caleb James DeLisle
2014-11-03 16:07:39 +01:00
parent 5ae599fa07
commit 6cbdcdec65
8 changed files with 191 additions and 58 deletions

View File

@@ -1,29 +1,15 @@
define([
'api/config?cb=' + Math.random().toString(16).substring(2),
'realtime-wysiwyg',
'messages',
'bower/jquery/dist/jquery.min',
'bower/ckeditor/ckeditor',
'bower/tweetnacl/nacl-fast.min',
], function (Config, RTWysiwyg) {
], function (Config, RTWysiwyg, Messages) {
var Ckeditor = window.CKEDITOR;
var Nacl = window.nacl;
var $ = jQuery;
var INITIAL_STATE = [
'<p>',
'This is <strong>CryptPad</strong>, the zero knowledge realtime collaborative editor.',
'<br>',
'What you type here is encrypted so only people who have the link can access it.',
'<br>',
'Even the server cannot see what you type.',
'</p>',
'<p>',
'<small>',
'<i>What you see here, what you hear here, when you leave here, let it stay here</i>',
'</small>',
'</p>',
].join('');
var module = { exports: {} };
var parseKey = function (str) {
@@ -54,12 +40,11 @@ define([
editor.on('instanceReady', function () {
editor.execCommand('maximize');
var ifr = window.ifr = $('iframe')[0];
ifr.contentDocument.body.innerHTML = INITIAL_STATE;
ifr.contentDocument.body.innerHTML = Messages.initialState;
var rtw =
RTWysiwyg.start(Config.websocketURL,
userName(),
{},
Nacl.util.encodeBase64(key.lookupKey).substring(0,10),
key.cryptKey);
editor.on('change', function () { rtw.onEvent(); });