update minor editors to use new realtime-input api
This commit is contained in:
@@ -28,7 +28,13 @@ define([
|
|||||||
transformFunction
|
transformFunction
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var config = {};
|
var config = {
|
||||||
|
textarea: $textarea[0],
|
||||||
|
websocketURL: Config.websocketURL,
|
||||||
|
userName: Crypto.rand64(8),
|
||||||
|
channel: key.channel,
|
||||||
|
cryptKey: key.cryptKey,
|
||||||
|
};
|
||||||
var initializing = true;
|
var initializing = true;
|
||||||
|
|
||||||
$textarea.attr('disabled', true);
|
$textarea.attr('disabled', true);
|
||||||
@@ -51,12 +57,7 @@ define([
|
|||||||
window.alert("Server Connection Lost");
|
window.alert("Server Connection Lost");
|
||||||
};
|
};
|
||||||
|
|
||||||
var rt = Realtime.start($textarea[0], // window
|
var rt = Realtime.start(config);
|
||||||
Config.websocketURL, // websocketUrl
|
|
||||||
Crypto.rand64(8), // userName
|
|
||||||
key.channel, // channel
|
|
||||||
key.cryptKey,
|
|
||||||
config); // cryptKey
|
|
||||||
|
|
||||||
$run.click(function (e) {
|
$run.click(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@@ -28,10 +28,13 @@ define([
|
|||||||
|
|
||||||
var key = Crypto.parseKey(window.location.hash.substring(1));
|
var key = Crypto.parseKey(window.location.hash.substring(1));
|
||||||
|
|
||||||
var rttext =
|
var config = {
|
||||||
RTText.start( $textarea[0], // window
|
textarea: $textarea[0],
|
||||||
Config.websocketURL, // websocketUrl
|
websocketURL: Config.websocketURL,
|
||||||
Crypto.rand64(8), // userName
|
userName: Crypto.rand64(8),
|
||||||
key.channel, // channel
|
channel: key.channel,
|
||||||
key.cryptKey); // cryptKey
|
key.cryptKey
|
||||||
|
};
|
||||||
|
|
||||||
|
var rttext = RTText.start(config);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,11 +18,15 @@ define([
|
|||||||
var key = Crypto.parseKey(window.location.hash.substring(1));
|
var key = Crypto.parseKey(window.location.hash.substring(1));
|
||||||
|
|
||||||
var rts = $('textarea').toArray().map(function (e, i) {
|
var rts = $('textarea').toArray().map(function (e, i) {
|
||||||
var rt = Realtime.start(e, // window
|
var config = {
|
||||||
Config.websocketURL, // websocketUrl
|
textarea: e,
|
||||||
Crypto.rand64(8), // userName
|
websocketURL: Config.websocketURL,
|
||||||
key.channel, // channel
|
userName: Crypto.rand64(8),
|
||||||
key.cryptKey); // cryptKey
|
channel: key.channel,
|
||||||
|
cryptKey: key.cryptKey
|
||||||
|
};
|
||||||
|
|
||||||
|
var rt = Realtime.start(config);
|
||||||
return rt;
|
return rt;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -83,12 +83,13 @@ define([
|
|||||||
}, 450);
|
}, 450);
|
||||||
};
|
};
|
||||||
|
|
||||||
var rts = Realtime.start($textarea[0], // window
|
var config = {
|
||||||
Config.websocketURL, // websocketUrl
|
textarea: $textarea[0],
|
||||||
Crypto.rand64(8), // userName
|
websocketURL: Config.websocketURL,
|
||||||
key.channel, // channel
|
userName: Crypto.rand64(8),
|
||||||
key.cryptKey, // cryptkey
|
channel: key.channel,
|
||||||
{
|
cryptKey: key.cryptKey,
|
||||||
|
|
||||||
// when remote editors do things...
|
// when remote editors do things...
|
||||||
onRemote: function () {
|
onRemote: function () {
|
||||||
lazyDraw($textarea.val());
|
lazyDraw($textarea.val());
|
||||||
@@ -99,7 +100,9 @@ define([
|
|||||||
console.log("Realtime is ready!");
|
console.log("Realtime is ready!");
|
||||||
$textarea.trigger('keyup');
|
$textarea.trigger('keyup');
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
var rts = Realtime.start(config);
|
||||||
|
|
||||||
$textarea.on('change keyup keydown', function () {
|
$textarea.on('change keyup keydown', function () {
|
||||||
if (redrawTimeout) { clearTimeout(redrawTimeout); }
|
if (redrawTimeout) { clearTimeout(redrawTimeout); }
|
||||||
|
|||||||
@@ -47,16 +47,20 @@ define([
|
|||||||
.on('change', draw);
|
.on('change', draw);
|
||||||
|
|
||||||
var rts = $('textarea').toArray().map(function (e, i) {
|
var rts = $('textarea').toArray().map(function (e, i) {
|
||||||
var rt = Realtime.start(e, // window
|
|
||||||
Config.websocketURL, // websocketUrl
|
var config = {
|
||||||
userName, // userName
|
|
||||||
key.channel, // channel
|
|
||||||
key.cryptKey, // cryptKey
|
|
||||||
{
|
|
||||||
onRemote: draw,
|
onRemote: draw,
|
||||||
onInit: draw,
|
onInit: draw,
|
||||||
onReady: draw
|
onReady: draw,
|
||||||
});
|
|
||||||
|
textarea: e,
|
||||||
|
websocketURL: Config.websocketURL,
|
||||||
|
userName: userName,
|
||||||
|
channel: key.channel,
|
||||||
|
cryptKey: key.cryptKey
|
||||||
|
};
|
||||||
|
|
||||||
|
var rt = Realtime.start(config);
|
||||||
return rt;
|
return rt;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -19,7 +19,12 @@ define([
|
|||||||
var initializing = true;
|
var initializing = true;
|
||||||
var $textarea = $('textarea');
|
var $textarea = $('textarea');
|
||||||
|
|
||||||
var config = {};
|
var config = {
|
||||||
|
websocketURL: Config.websocketURL,
|
||||||
|
userName: Crypto.rand64(8),
|
||||||
|
channel: key.channel,
|
||||||
|
cryptKey: key.cryptKey
|
||||||
|
};
|
||||||
|
|
||||||
var onInit = config.onInit = function (info) { };
|
var onInit = config.onInit = function (info) { };
|
||||||
|
|
||||||
@@ -38,10 +43,5 @@ define([
|
|||||||
window.alert("Server Connection Lost");
|
window.alert("Server Connection Lost");
|
||||||
};
|
};
|
||||||
|
|
||||||
var rt = Realtime.start($textarea[0], // window
|
var rt = Realtime.start(config);
|
||||||
Config.websocketURL, // websocketUrl
|
|
||||||
Crypto.rand64(8), // userName
|
|
||||||
key.channel, // channel
|
|
||||||
key.cryptKey,
|
|
||||||
config); // cryptKey
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user