Fix worksheet IDs in onlyoffice

pull/1/head
yflory 5 years ago
parent f7e0d03898
commit dee8007cc4

@ -297,7 +297,6 @@ define([
} }
APP.onLocal(); APP.onLocal();
APP.realtime.onSettle(function () { APP.realtime.onSettle(function () {
fixSheets();
UI.log(Messages.saved); UI.log(Messages.saved);
APP.realtime.onSettle(function () { APP.realtime.onSettle(function () {
if (APP.migrate) { if (APP.migrate) {
@ -342,6 +341,7 @@ define([
hash: ooChannel.lastHash, hash: ooChannel.lastHash,
index: ooChannel.cpIndex index: ooChannel.cpIndex
}; };
fixSheets();
APP.FM.handleFile(blob, data); APP.FM.handleFile(blob, data);
}; };
var makeCheckpoint = function (force) { var makeCheckpoint = function (force) {
@ -595,13 +595,19 @@ define([
deleteOfflineLocks(); deleteOfflineLocks();
// Prepare callback // Prepare callback
if (cpNfInner) { if (cpNfInner) {
var onPatchSent = function () { var onPatchSent = function (again) {
cpNfInner.offPatchSent(onPatchSent); if (!again) { cpNfInner.offPatchSent(onPatchSent); }
// Answer to our onlyoffice // Answer to our onlyoffice
send({ if (!content.saveLock) {
type: "getLock", send({
locks: getLock() type: "getLock",
}); locks: getLock()
});
} else {
setTimeout(function () {
onPatchSent(true);
}, 50);
}
}; };
cpNfInner.onPatchSent(onPatchSent); cpNfInner.onPatchSent(onPatchSent);
} }
@ -1432,7 +1438,7 @@ define([
if (window.CP_DEV_MODE) { if (window.CP_DEV_MODE) {
var $save = common.createButton('save', true, {}, function () { var $save = common.createButton('save', true, {}, function () {
saveToServer(); makeCheckpoint(true);
}); });
$save.appendTo($rightside); $save.appendTo($rightside);
} }
@ -1577,14 +1583,21 @@ define([
metadataMgr.updateMetadata(json.metadata); metadataMgr.updateMetadata(json.metadata);
} }
var wasLocked = content.saveLock;
var wasMigrating = content.migration; var wasMigrating = content.migration;
content = json.content; content = json.content;
if (!wasLocked && content.saveLock) {
// Someone is creating a new checkpoint: fix the sheets ids
fixSheets();
}
if (content.hashes) { if (content.hashes) {
var latest = getLastCp(true); var latest = getLastCp(true);
var newLatest = getLastCp(); var newLatest = getLastCp();
if (newLatest.index > latest.index) { if (newLatest.index > latest.index) {
fixSheets();
sframeChan.query('Q_OO_SAVE', { sframeChan.query('Q_OO_SAVE', {
url: newLatest.file url: newLatest.file
}, function () { }); }, function () { });

Loading…
Cancel
Save