diff --git a/www/common/realtime-input.js b/www/common/realtime-input.js index 9c9e36a7c..6807879fb 100644 --- a/www/common/realtime-input.js +++ b/www/common/realtime-input.js @@ -64,8 +64,11 @@ define([ var bindAllEvents = function (textarea, docBody, onEvent, unbind) { - // FIXME why docBody? - + /* + we use docBody for the purposes of CKEditor. + because otherwise special keybindings like ctrl-b and ctrl-i + would open bookmarks and info instead of applying bold/italic styles + */ docBody && bindEvents(docBody, ['textInput', 'keydown', 'keyup', 'select', 'cut', 'paste'], onEvent, @@ -133,17 +136,20 @@ define([ }; var start = module.exports.start = - function (textarea, websocketUrl, userName, channel, cryptKey, doc, onRemote) + function (textarea, websocketUrl, userName, channel, cryptKey, config) { + var passwd = 'y'; - console.log({ - textarea: textarea, - websocketUrl: websocketUrl, - userName: userName, - channel: channel, - cryptKey: cryptKey - }); + // make sure configuration is defined + config = config || {}; + + var doc = config.doc || null; + + // trying to deprecate onRemote, prefer loading it via the conf + onRemote = config.onRemote || onRemote; + + transformFunction = config.transformFunction || null; var socket = makeWebsocket(websocketUrl); // define this in case it gets called before the rest of our stuff is ready. @@ -156,12 +162,6 @@ define([ var $textarea = $(textarea); - var inputDisabled = function (cond) { - $textarea.attr("disabled", cond||false); - }; - - inputDisabled(false); - var bump = function () {}; socket.onOpen.push(function (evt) { @@ -176,24 +176,11 @@ define([ channel, $(textarea).val(), { - transformFunction: function (text, toTransform, transformBy) { - console.log({ - text: text, - toTransform: toTransform, - transformBy: transformBy - }); - - // returning **null** breaks out of the loop - // which transforms conflicting operations - // in theory this should prevent us from producing bad JSON - return null; - } + transformFunction: config.transformFunction }); onEvent = function () { if (isErrorState || initializing) { return; } -/* var currentDoc = $textarea.val(); - if (currentDoc !== realtime.getUserDoc()) { warn("currentDoc !== realtime.getUserDoc()"); } */ }; realtime.onUserListChange(function (userList) { @@ -202,14 +189,13 @@ define([ } // if we spot ourselves being added to the document, we'll switch // 'initializing' off because it means we're fully synced. - - // we should only see this happen once initializing = false; - debug("Done initializing:"); - debug("Userlist: ["+userList.join(",")+"]"); - /* TODO execute a callback here */ - inputDisabled(true); + // execute an onReady callback if one was supplied + // pass an object so we can extend this later + config.onReady && config.onReady({ + userList: userList + }); }); var whoami = new RegExp(userName.replace(/\/\+/g, function (c) { @@ -274,7 +260,6 @@ define([ var socketChecker = setInterval(function () { if (checkSocket(socket)) { warn("Socket disconnected!"); - inputDisabled(true); recoverableErrorCount += 1; @@ -284,7 +269,7 @@ define([ socketChecker && clearInterval(socketChecker); } } else { - inputDisabled(false); + // TODO } },200); @@ -296,7 +281,6 @@ define([ realtime.start(); debug('started'); - // this has three names :| bump = realtime.bumpSharejs; }); return { diff --git a/www/render/index.html b/www/render/index.html index 7b1794dd1..b463a5dac 100644 --- a/www/render/index.html +++ b/www/render/index.html @@ -34,9 +34,18 @@ code { font-family: monospace; } - /* TODO - bump up text size on mobile - */ + + /* bigger text size for difficult to read elements */ + blockquote, p, pre, code, li { + font-size: 20px; + } + + /* tables */ + table, thead, tbody, th, tr, td{ + border: 1pt solid #586e75; + background-color: #002b36; + padding: 15px; + }
@@ -46,4 +55,3 @@