Enable onlyoffice reconnection

pull/1/head
yflory 5 years ago
parent e32398b308
commit 0a543ae6ea

@ -62,6 +62,15 @@ body.cp-app-sheet, body.cp-app-oodoc, body.cp-app-ooslide {
background-color: lightgrey;
display: flex;
flex-flow: column;
position: relative;
}
#cp-app-oo-offline {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
background-color: rgba(255,255,255,0.5);
}
#ooframe {
flex: 1;

@ -601,12 +601,6 @@ define([
});
};
var handleChanges = function (obj, send) {
// Allow the changes
send({
type: "unSaveLock",
index: ooChannel.cpIndex,
time: +new Date()
});
// Send the changes
rtChannel.sendMsg({
type: "saveChanges",
@ -616,6 +610,15 @@ define([
excelAdditionalInfo: null
}, null, function (err, hash) {
if (err) { return void console.error(err); }
// Call unSaveLock to tell onlyoffice that the patch was sent.
// It will allow you to make changes to another cell.
// If there is an error and unSaveLock is not called, onlyoffice
// will try to send the patch again
send({
type: "unSaveLock",
index: ooChannel.cpIndex,
time: +new Date()
});
// Increment index and update latest hash
ooChannel.cpIndex++;
ooChannel.lastHash = hash;
@ -748,7 +751,9 @@ define([
},
"events": {
"onAppReady": function(/*evt*/) {
var $tb = $('iframe[name="frameEditor"]').contents().find('head');
var $iframe = $('iframe[name="frameEditor"]').contents();
$iframe.prop('tabindex', '-1');
var $tb = $iframe.find('head');
var css = // Old OO
'#id-toolbar-full .toolbar-group:nth-child(2), #id-toolbar-full .separator:nth-child(3) { display: none; }' +
'#fm-btn-save { display: none !important; }' +
@ -1301,10 +1306,13 @@ define([
};
var setEditable = function (state) {
if (!state) {
$('#cp-app-oo-editor').find('#cp-app-oo-offline').remove();;
try {
window.frames[0].editor.setViewModeDisconnect(true);
window.frames[0].editor.asc_setViewMode(!state);
//window.frames[0].editor.setViewModeDisconnect(true);
} catch (e) {}
if (!state) {
$('#cp-app-oo-editor').append(h('div#cp-app-oo-offline'));
}
debug(state);
};
@ -1569,10 +1577,11 @@ define([
setEditable(info.state);
if (info.state) {
UI.findOKButton().click();
UI.confirm(Messages.oo_reconnect, function (yes) {
offline = false;
/*UI.confirm(Messages.oo_reconnect, function (yes) {
if (!yes) { return; }
common.gotoURL();
});
});*/
} else {
offline = true;
UI.findOKButton().click();

@ -53,7 +53,7 @@ define([
// all our client IDs.
if (chan.clients) {
chan.clients.forEach(function (cl) {
if (ctx.clients[cl] && !ctx.clients[cl].id) {
if (ctx.clients[cl]) {
ctx.clients[cl].id = wc.myID + '-' + cl;
}
});
@ -189,15 +189,22 @@ define([
if (!c) { return void cb({ error: 'NOT_IN_CHANNEL' }); }
var chan = ctx.channels[c.channel];
if (!chan) { return void cb({ error: 'INVALID_CHANNEL' }); }
if (data.isCp) {
return void chan.sendMsg(data.isCp, cb);
}
chan.sendMsg(data.msg, cb);
// Prepare the callback: broadcast the message to the other local tabs
// if the message is sent
var _cb = function (obj) {
if (obj && obj.error) { return void cb(obj); }
ctx.emit('MESSAGE', {
msg: data.msg
}, chan.clients.filter(function (cl) {
return cl !== clientId;
}));
cb();
};
// Send the message
if (data.isCp) {
return void chan.sendMsg(data.isCp, _cb);
}
chan.sendMsg(data.msg, _cb);
};
var reencrypt = function (ctx, data, cId, cb) {

Loading…
Cancel
Save