diff --git a/public/js/index.js b/public/js/index.js index 5bddfbd0c..7294a5ba6 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -2262,7 +2262,8 @@ window.havePermission = havePermission; var io = require("socket.io-client"); var socket = io.connect({ path: urlpath ? '/' + urlpath + '/socket.io/' : '', - timeout: 5000 //5 secs to timeout + timeout: 5000, //5 secs to timeout, + reconnectionAttempts: 20 // retry 20 times on connect failed }); //overwrite original event for checking login state var on = socket.on; @@ -2636,6 +2637,8 @@ socket.on('refresh', function (data) { scrollToHash(); }, 1); } + if (editor.getOption('readOnly')) + editor.setOption('readOnly', false); }); var EditorClient = ot.EditorClient; @@ -2689,9 +2692,6 @@ socket.on('doc', function (obj) { updateView(); } - if (editor.getOption('readOnly')) - editor.setOption('readOnly', false); - restoreInfo(); });