|
|
@ -69,10 +69,12 @@ define([
|
|
|
|
because otherwise special keybindings like ctrl-b and ctrl-i
|
|
|
|
because otherwise special keybindings like ctrl-b and ctrl-i
|
|
|
|
would open bookmarks and info instead of applying bold/italic styles
|
|
|
|
would open bookmarks and info instead of applying bold/italic styles
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
docBody && bindEvents(docBody,
|
|
|
|
if (docBody) {
|
|
|
|
|
|
|
|
bindEvents(docBody,
|
|
|
|
['textInput', 'keydown', 'keyup', 'select', 'cut', 'paste'],
|
|
|
|
['textInput', 'keydown', 'keyup', 'select', 'cut', 'paste'],
|
|
|
|
onEvent,
|
|
|
|
onEvent,
|
|
|
|
unbind);
|
|
|
|
unbind);
|
|
|
|
|
|
|
|
}
|
|
|
|
bindEvents(textarea,
|
|
|
|
bindEvents(textarea,
|
|
|
|
['mousedown','mouseup','click','change'],
|
|
|
|
['mousedown','mouseup','click','change'],
|
|
|
|
onEvent,
|
|
|
|
onEvent,
|
|
|
@ -179,10 +181,11 @@ define([
|
|
|
|
transformFunction: config.transformFunction
|
|
|
|
transformFunction: config.transformFunction
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (config.onInit) {
|
|
|
|
config.onInit && config.onInit({
|
|
|
|
config.onInit({
|
|
|
|
realtime: realtime
|
|
|
|
realtime: realtime
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onEvent = function () {
|
|
|
|
onEvent = function () {
|
|
|
|
if (isErrorState || initializing) { return; }
|
|
|
|
if (isErrorState || initializing) { return; }
|
|
|
@ -198,9 +201,11 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
// execute an onReady callback if one was supplied
|
|
|
|
// execute an onReady callback if one was supplied
|
|
|
|
// pass an object so we can extend this later
|
|
|
|
// pass an object so we can extend this later
|
|
|
|
config.onReady && config.onReady({
|
|
|
|
if (config.onReady) {
|
|
|
|
|
|
|
|
config.onReady({
|
|
|
|
userList: userList
|
|
|
|
userList: userList
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var whoami = new RegExp(userName.replace(/\/\+/g, function (c) {
|
|
|
|
var whoami = new RegExp(userName.replace(/\/\+/g, function (c) {
|
|
|
@ -231,7 +236,7 @@ define([
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
//verbose("Received remote message");
|
|
|
|
//verbose("Received remote message");
|
|
|
|
// obviously this is only going to get called if
|
|
|
|
// obviously this is only going to get called if
|
|
|
|
onRemote && onRemote(realtime.getUserDoc());
|
|
|
|
if (onRemote) { onRemote(realtime.getUserDoc()); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -271,14 +276,14 @@ define([
|
|
|
|
if (recoverableErrorCount >= MAX_RECOVERABLE_ERRORS) {
|
|
|
|
if (recoverableErrorCount >= MAX_RECOVERABLE_ERRORS) {
|
|
|
|
warn("Giving up!");
|
|
|
|
warn("Giving up!");
|
|
|
|
abort(socket, realtime);
|
|
|
|
abort(socket, realtime);
|
|
|
|
socketChecker && clearInterval(socketChecker);
|
|
|
|
if (socketChecker) { clearInterval(socketChecker); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// TODO
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},200);
|
|
|
|
},200);
|
|
|
|
|
|
|
|
|
|
|
|
bindAllEvents(textarea, doc, onEvent, false)
|
|
|
|
bindAllEvents(textarea, doc, onEvent, false);
|
|
|
|
|
|
|
|
|
|
|
|
// attach textarea?
|
|
|
|
// attach textarea?
|
|
|
|
sharejs.attach(textarea, realtime);
|
|
|
|
sharejs.attach(textarea, realtime);
|
|
|
|