diff --git a/www/common/RealtimeTextSocket.js b/www/common/RealtimeTextSocket.js
index 944d7f84a..28012cce8 100644
--- a/www/common/RealtimeTextSocket.js
+++ b/www/common/RealtimeTextSocket.js
@@ -222,8 +222,8 @@ define([
verbose(message);
allMessages.push(message);
if (!initializing) {
- if (toReturn.onLocal) {
- toReturn.onLocal();
+ if (config.onLocal) {
+ config.onLocal();
}
}
realtime.message(message);
diff --git a/www/p/main.js b/www/p/main.js
index 307bc979d..31313b6c7 100644
--- a/www/p/main.js
+++ b/www/p/main.js
@@ -291,25 +291,14 @@ define([
toolbar.failed();
};
- var rti = module.realtimeInput = realtimeInput.start(realtimeOptions);
-
-
- /* It's incredibly important that you assign 'rti.onLocal'
- It's used inside of realtimeInput to make sure that all changes
- make it into chainpad.
-
- It's being assigned this way because it can't be passed in, and
- and can't be easily returned from realtime input without making
- the code less extensible.
- */
- var propogate = rti.onLocal = function () {
+ var onLocal = realtimeOptions.onLocal = function () {
+ if (initializing) { return; }
var shjson = stringifyDOM(inner);
- if (!rti.patchText(shjson)) {
- return;
- }
- rti.onEvent(shjson);
+ rti.patchText(shjson);
};
+ var rti = module.realtimeInput = realtimeInput.start(realtimeOptions);
+
/* hitting enter makes a new line, but places the cursor inside
of the
instead of the
. This makes it such that you cannot type until you click, which is rather unnacceptable. @@ -322,12 +311,13 @@ define([ var easyTest = window.easyTest = function () { cursor.update(); var start = cursor.Range.start; - var test = TypingTest.testInput(inner, start.el, start.offset, propogate); - propogate(); + var test = TypingTest.testInput(inner, start.el, start.offset, onLocal); + // why twice? + onLocale(); return test; }; - editor.on('change', propogate); + editor.on('change', onLocal); }); };