Receive realtime patches in OO readonly mode

pull/1/head
yflory 4 years ago
parent 122d4d4882
commit 196ad3a04d

@ -727,7 +727,7 @@ define([
if (ooChannel.ready) { if (ooChannel.ready) {
// In read-only mode, push the message to the queue and prompt // In read-only mode, push the message to the queue and prompt
// the user to refresh OO (without reloading the page) // the user to refresh OO (without reloading the page)
if (readOnly) { /*if (readOnly) {
ooChannel.queue.push(obj.data); ooChannel.queue.push(obj.data);
if (APP.refreshPopup) { return; } if (APP.refreshPopup) { return; }
APP.refreshPopup = true; APP.refreshPopup = true;
@ -736,7 +736,7 @@ define([
// 1 popup every 15s // 1 popup every 15s
APP.refreshRoTo = setTimeout(refreshReadOnly, READONLY_REFRESH_TO); APP.refreshRoTo = setTimeout(refreshReadOnly, READONLY_REFRESH_TO);
return; return;
} }*/
ooChannel.send(obj.data.msg); ooChannel.send(obj.data.msg);
ooChannel.lastHash = obj.data.hash; ooChannel.lastHash = obj.data.hash;
ooChannel.cpIndex++; ooChannel.cpIndex++;
@ -1156,7 +1156,7 @@ define([
startOO = function (blob, file, force) { startOO = function (blob, file, force) {
if (APP.ooconfig && !force) { return void console.error('already started'); } if (APP.ooconfig && !force) { return void console.error('already started'); }
var url = URL.createObjectURL(blob); var url = URL.createObjectURL(blob);
var lock = !APP.history && (readOnly || APP.migrate); var lock = !APP.history && (APP.migrate);
// Starting from version 3, we can use the view mode again // Starting from version 3, we can use the view mode again
// defined but never used // defined but never used
@ -1285,6 +1285,10 @@ define([
if (lock) { if (lock) {
getEditor().setViewModeDisconnect(); getEditor().setViewModeDisconnect();
} else if (readOnly) {
try {
getEditor().asc_setRestriction(true);
} catch (e) {}
} else { } else {
setEditable(true); setEditable(true);
} }

Loading…
Cancel
Save