Unlock onlyoffice's cells sooner

pull/1/head
yflory 5 years ago
parent 2060223edb
commit 5673aa687c

@ -52,7 +52,6 @@ define([
$: $ $: $
}; };
var CHECKPOINT_INTERVAL = 50; var CHECKPOINT_INTERVAL = 50;
var DISPLAY_RESTORE_BUTTON = false; var DISPLAY_RESTORE_BUTTON = false;
var NEW_VERSION = 2; var NEW_VERSION = 2;
@ -91,6 +90,7 @@ define([
var myUniqueOOId; var myUniqueOOId;
var myOOId; var myOOId;
var sessionId = Hash.createChannelId(); var sessionId = Hash.createChannelId();
var cpNfInner;
// This structure is used for caching media data and blob urls for each media cryptpad url // This structure is used for caching media data and blob urls for each media cryptpad url
var mediasData = {}; var mediasData = {};
@ -589,15 +589,21 @@ define([
oldLocks = JSON.parse(JSON.stringify(content.locks)); oldLocks = JSON.parse(JSON.stringify(content.locks));
// Remove old locks // Remove old locks
deleteOfflineLocks(); deleteOfflineLocks();
// Commit // Prepare callback
APP.onLocal(); if (cpNfInner) {
APP.realtime.onSettle(function () { var onPatchSent = function () {
cpNfInner.offPatchSent(onPatchSent);
// Answer to our onlyoffice // Answer to our onlyoffice
send({ send({
type: "getLock", type: "getLock",
locks: getLock() locks: getLock()
}); });
}); };
cpNfInner.onPatchSent(onPatchSent);
}
// Commit
APP.onLocal();
APP.realtime.sync();
}; };
var parseChanges = function (changes) { var parseChanges = function (changes) {
@ -1335,7 +1341,6 @@ define([
var initializing = true; var initializing = true;
var $bar = $('#cp-toolbar'); var $bar = $('#cp-toolbar');
var cpNfInner;
config = { config = {
patchTransformer: ChainPad.SmartJSONTransformer, patchTransformer: ChainPad.SmartJSONTransformer,

@ -48,6 +48,8 @@ define([
var updateLoadingProgress = config.updateLoadingProgress; var updateLoadingProgress = config.updateLoadingProgress;
config = undefined; config = undefined;
var evPatchSent = Util.mkEvent();
var chainpad = ChainPad.create({ var chainpad = ChainPad.create({
userName: userName, userName: userName,
initialState: initialState, initialState: initialState,
@ -57,7 +59,10 @@ define([
logLevel: logLevel logLevel: logLevel
}); });
chainpad.onMessage(function(message, cb) { chainpad.onMessage(function(message, cb) {
sframeChan.query('Q_RT_MESSAGE', message, cb); sframeChan.query('Q_RT_MESSAGE', message, function (err) {
if (!err) { evPatchSent.fire(); }
cb(err);
});
}); });
chainpad.onPatch(function () { chainpad.onPatch(function () {
onRemote({ realtime: chainpad }); onRemote({ realtime: chainpad });
@ -149,6 +154,8 @@ define([
metadataMgr: metadataMgr, metadataMgr: metadataMgr,
whenRealtimeSyncs: whenRealtimeSyncs, whenRealtimeSyncs: whenRealtimeSyncs,
onInfiniteSpinner: evInfiniteSpinner.reg, onInfiniteSpinner: evInfiniteSpinner.reg,
onPatchSent: evPatchSent.reg,
offPatchSent: evPatchSent.unreg,
chainpad: chainpad, chainpad: chainpad,
}); });
}; };

Loading…
Cancel
Save