From 5a8f0df19e1cdea8c542bfa71fc5b2008eb7c29f Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 5 Jan 2017 18:42:18 +0100 Subject: [PATCH] Add support for reconnecting websocket --- www/file/main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/www/file/main.js b/www/file/main.js index b7e4f5c21..e98375df5 100644 --- a/www/file/main.js +++ b/www/file/main.js @@ -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) {