Add support for reconnecting websocket

This commit is contained in:
yflory 2017-01-05 18:42:18 +01:00
parent 7a0442afe0
commit 5a8f0df19e
1 changed files with 9 additions and 1 deletions

View File

@ -125,7 +125,7 @@ define([
var setEditable = function (state) {
APP.editable = state;
if (state) { $iframe.find('[draggable="true"]').attr('draggable', false); }
if (!state) { $iframe.find('[draggable="true"]').attr('draggable', false); }
else { $iframe.find('[draggable="false"]').attr('draggable', true); }
};
@ -1696,6 +1696,11 @@ define([
console.error('err');
Cryptpad.alert(Messages.common_connectionLost);
};
var onReconnect = function (info) {
setEditable(true);
Cryptpad.findOKButton().click();
//Cryptpad.alert("Reconnected");
};
if (storeObj && !window.location.hash) {
onCreate(storeObj.info);
@ -1710,6 +1715,9 @@ define([
proxy.on('disconnect', function () {
onDisconnect();
});
proxy.on('reconnect', function () {
onReconnect();
});
});
Cryptpad.onError(function (info) {
if (info) {