Add support for reconnecting websocket

This commit is contained in:
yflory 2017-01-05 18:42:18 +01:00
parent 7a0442afe0
commit 5a8f0df19e

View File

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