|
|
@ -110,10 +110,12 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var setEditable = function (state) {
|
|
|
|
var setEditable = function (state) {
|
|
|
|
$('#cp-app-oo-editor').find('#cp-app-oo-offline').remove();
|
|
|
|
$('#cp-app-oo-editor').find('#cp-app-oo-offline').remove();
|
|
|
|
|
|
|
|
/*
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
getEditor().asc_setViewMode(!state);
|
|
|
|
getEditor().asc_setViewMode(!state);
|
|
|
|
//window.frames[0].editor.setViewModeDisconnect(true);
|
|
|
|
//window.frames[0].editor.setViewModeDisconnect(true);
|
|
|
|
} catch (e) {}
|
|
|
|
} catch (e) {}
|
|
|
|
|
|
|
|
*/
|
|
|
|
if (!state && !readOnly) {
|
|
|
|
if (!state && !readOnly) {
|
|
|
|
$('#cp-app-oo-editor').append(h('div#cp-app-oo-offline'));
|
|
|
|
$('#cp-app-oo-editor').append(h('div#cp-app-oo-offline'));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -571,17 +573,11 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var handleAuth = function (obj, send) {
|
|
|
|
var handleAuth = function (obj, send) {
|
|
|
|
// OO is ready
|
|
|
|
setEditable(false);
|
|
|
|
ooChannel.ready = true;
|
|
|
|
|
|
|
|
// Get the content pushed after the latest checkpoint
|
|
|
|
|
|
|
|
var changes = [];
|
|
|
|
|
|
|
|
ooChannel.queue.forEach(function (data) {
|
|
|
|
|
|
|
|
Array.prototype.push.apply(changes, data.msg.changes);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
ooChannel.lastHash = getLastCp().hash;
|
|
|
|
ooChannel.lastHash = getLastCp().hash;
|
|
|
|
send({
|
|
|
|
send({
|
|
|
|
type: "authChanges",
|
|
|
|
type: "authChanges",
|
|
|
|
changes: changes
|
|
|
|
changes: []
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// Answer to the auth command
|
|
|
|
// Answer to the auth command
|
|
|
|
var p = getParticipants();
|
|
|
|
var p = getParticipants();
|
|
|
@ -605,14 +601,6 @@ define([
|
|
|
|
type: "documentOpen",
|
|
|
|
type: "documentOpen",
|
|
|
|
data: {"type":"open","status":"ok","data":{"Editor.bin":obj.openCmd.url}}
|
|
|
|
data: {"type":"open","status":"ok","data":{"Editor.bin":obj.openCmd.url}}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// Update current index
|
|
|
|
|
|
|
|
var last = ooChannel.queue.pop();
|
|
|
|
|
|
|
|
if (last) { ooChannel.lastHash = last.hash; }
|
|
|
|
|
|
|
|
ooChannel.cpIndex += ooChannel.queue.length;
|
|
|
|
|
|
|
|
// Apply existing locks
|
|
|
|
|
|
|
|
deleteOfflineLocks();
|
|
|
|
|
|
|
|
APP.onLocal();
|
|
|
|
|
|
|
|
handleNewLocks(oldLocks, content.locks || {});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var observer = new MutationObserver(function(mutations) {
|
|
|
|
var observer = new MutationObserver(function(mutations) {
|
|
|
|
mutations.forEach(function(mutation) {
|
|
|
|
mutations.forEach(function(mutation) {
|
|
|
@ -922,6 +910,24 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"onDocumentReady": function () {
|
|
|
|
"onDocumentReady": function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The doc is ready, fix the worksheets IDs and push the queue
|
|
|
|
|
|
|
|
fixSheets();
|
|
|
|
|
|
|
|
// Push changes since last cp
|
|
|
|
|
|
|
|
ooChannel.ready = true;
|
|
|
|
|
|
|
|
ooChannel.queue.forEach(function (data) {
|
|
|
|
|
|
|
|
ooChannel.send(data.msg);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var last = ooChannel.queue.pop();
|
|
|
|
|
|
|
|
if (last) { ooChannel.lastHash = last.hash; }
|
|
|
|
|
|
|
|
ooChannel.cpIndex += ooChannel.queue.length;
|
|
|
|
|
|
|
|
// Apply existing locks
|
|
|
|
|
|
|
|
deleteOfflineLocks();
|
|
|
|
|
|
|
|
APP.onLocal();
|
|
|
|
|
|
|
|
handleNewLocks(oldLocks, content.locks || {});
|
|
|
|
|
|
|
|
// Allow edition
|
|
|
|
|
|
|
|
setEditable(true);
|
|
|
|
|
|
|
|
|
|
|
|
if (APP.migrate && !readOnly) {
|
|
|
|
if (APP.migrate && !readOnly) {
|
|
|
|
var div = h('div.cp-oo-x2tXls', [
|
|
|
|
var div = h('div.cp-oo-x2tXls', [
|
|
|
|
h('span.fa.fa-spin.fa-spinner'),
|
|
|
|
h('span.fa.fa-spin.fa-spinner'),
|
|
|
|