mirror of https://github.com/xwiki-labs/cryptpad
update minor editors to use new realtime-input api
This commit is contained in:
parent
9b228eea6b
commit
1c54af69a1
|
@ -28,7 +28,13 @@ define([
|
|||
transformFunction
|
||||
*/
|
||||
|
||||
var config = {};
|
||||
var config = {
|
||||
textarea: $textarea[0],
|
||||
websocketURL: Config.websocketURL,
|
||||
userName: Crypto.rand64(8),
|
||||
channel: key.channel,
|
||||
cryptKey: key.cryptKey,
|
||||
};
|
||||
var initializing = true;
|
||||
|
||||
$textarea.attr('disabled', true);
|
||||
|
@ -51,12 +57,7 @@ define([
|
|||
window.alert("Server Connection Lost");
|
||||
};
|
||||
|
||||
var rt = Realtime.start($textarea[0], // window
|
||||
Config.websocketURL, // websocketUrl
|
||||
Crypto.rand64(8), // userName
|
||||
key.channel, // channel
|
||||
key.cryptKey,
|
||||
config); // cryptKey
|
||||
var rt = Realtime.start(config);
|
||||
|
||||
$run.click(function (e) {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -11,7 +11,7 @@ define([
|
|||
Crypto) {
|
||||
|
||||
var $ = window.jQuery;
|
||||
|
||||
|
||||
var $textarea = $('input');
|
||||
|
||||
$(window).on('hashchange', function() {
|
||||
|
@ -28,10 +28,13 @@ define([
|
|||
|
||||
var key = Crypto.parseKey(window.location.hash.substring(1));
|
||||
|
||||
var rttext =
|
||||
RTText.start( $textarea[0], // window
|
||||
Config.websocketURL, // websocketUrl
|
||||
Crypto.rand64(8), // userName
|
||||
key.channel, // channel
|
||||
key.cryptKey); // cryptKey
|
||||
var config = {
|
||||
textarea: $textarea[0],
|
||||
websocketURL: Config.websocketURL,
|
||||
userName: Crypto.rand64(8),
|
||||
channel: key.channel,
|
||||
key.cryptKey
|
||||
};
|
||||
|
||||
var rttext = RTText.start(config);
|
||||
});
|
||||
|
|
|
@ -18,11 +18,15 @@ define([
|
|||
var key = Crypto.parseKey(window.location.hash.substring(1));
|
||||
|
||||
var rts = $('textarea').toArray().map(function (e, i) {
|
||||
var rt = Realtime.start(e, // window
|
||||
Config.websocketURL, // websocketUrl
|
||||
Crypto.rand64(8), // userName
|
||||
key.channel, // channel
|
||||
key.cryptKey); // cryptKey
|
||||
var config = {
|
||||
textarea: e,
|
||||
websocketURL: Config.websocketURL,
|
||||
userName: Crypto.rand64(8),
|
||||
channel: key.channel,
|
||||
cryptKey: key.cryptKey
|
||||
};
|
||||
|
||||
var rt = Realtime.start(config);
|
||||
return rt;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -83,23 +83,26 @@ define([
|
|||
}, 450);
|
||||
};
|
||||
|
||||
var rts = Realtime.start($textarea[0], // window
|
||||
Config.websocketURL, // websocketUrl
|
||||
Crypto.rand64(8), // userName
|
||||
key.channel, // channel
|
||||
key.cryptKey, // cryptkey
|
||||
{
|
||||
// when remote editors do things...
|
||||
onRemote: function () {
|
||||
lazyDraw($textarea.val());
|
||||
},
|
||||
// when your editor is ready
|
||||
onReady: function (info) {
|
||||
if (info.userList) { console.log("Userlist: [%s]", info.userList.join(',')); }
|
||||
console.log("Realtime is ready!");
|
||||
$textarea.trigger('keyup');
|
||||
}
|
||||
});
|
||||
var config = {
|
||||
textarea: $textarea[0],
|
||||
websocketURL: Config.websocketURL,
|
||||
userName: Crypto.rand64(8),
|
||||
channel: key.channel,
|
||||
cryptKey: key.cryptKey,
|
||||
|
||||
// when remote editors do things...
|
||||
onRemote: function () {
|
||||
lazyDraw($textarea.val());
|
||||
},
|
||||
// when your editor is ready
|
||||
onReady: function (info) {
|
||||
if (info.userList) { console.log("Userlist: [%s]", info.userList.join(',')); }
|
||||
console.log("Realtime is ready!");
|
||||
$textarea.trigger('keyup');
|
||||
}
|
||||
};
|
||||
|
||||
var rts = Realtime.start(config);
|
||||
|
||||
$textarea.on('change keyup keydown', function () {
|
||||
if (redrawTimeout) { clearTimeout(redrawTimeout); }
|
||||
|
|
|
@ -47,16 +47,20 @@ define([
|
|||
.on('change', draw);
|
||||
|
||||
var rts = $('textarea').toArray().map(function (e, i) {
|
||||
var rt = Realtime.start(e, // window
|
||||
Config.websocketURL, // websocketUrl
|
||||
userName, // userName
|
||||
key.channel, // channel
|
||||
key.cryptKey, // cryptKey
|
||||
{
|
||||
onRemote: draw,
|
||||
onInit: draw,
|
||||
onReady: draw
|
||||
});
|
||||
|
||||
var config = {
|
||||
onRemote: draw,
|
||||
onInit: draw,
|
||||
onReady: draw,
|
||||
|
||||
textarea: e,
|
||||
websocketURL: Config.websocketURL,
|
||||
userName: userName,
|
||||
channel: key.channel,
|
||||
cryptKey: key.cryptKey
|
||||
};
|
||||
|
||||
var rt = Realtime.start(config);
|
||||
return rt;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,7 +19,12 @@ define([
|
|||
var initializing = true;
|
||||
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) { };
|
||||
|
||||
|
@ -38,10 +43,5 @@ define([
|
|||
window.alert("Server Connection Lost");
|
||||
};
|
||||
|
||||
var rt = Realtime.start($textarea[0], // window
|
||||
Config.websocketURL, // websocketUrl
|
||||
Crypto.rand64(8), // userName
|
||||
key.channel, // channel
|
||||
key.cryptKey,
|
||||
config); // cryptKey
|
||||
var rt = Realtime.start(config);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue