loleaflet: Handle Close_Session even if document is not loaded

Now the Close_Session Post message command can be used to close the
documents while it is loading.

Change-Id: If60391834fedc90b3dcb63848aa72503eb43888d
This commit is contained in:
Pranav Kant 2017-08-14 17:42:07 +05:30
parent 7455705517
commit 1a9d5c2ccc

View file

@ -109,6 +109,12 @@ L.Map.WOPI = L.Handler.extend({
return;
}
// allow closing documents before they are completely loaded
if (msg.MessageId === 'Close_Session') {
this._map._socket.sendMessage('closedocument');
return;
}
// For all other messages, warn if trying to interact before we are completely loaded
if (!this._appLoaded) {
console.error('LibreOffice Online not loaded yet. Listen for App_LoadingStatus (Document_Loaded) event before using PostMessage API. Ignoring post message \'' + msg.MessageId + '\'.');
@ -170,9 +176,6 @@ L.Map.WOPI = L.Handler.extend({
this._postMessage({msgId: 'Get_Views_Resp', args: getMembersRespVal});
}
else if (msg.MessageId === 'Close_Session') {
this._map._socket.sendMessage('closedocument');
}
else if (msg.MessageId === 'Action_Save') {
var dontTerminateEdit = msg.Values && msg.Values['DontTerminateEdit'];
var dontSaveIfUnmodified = msg.Values && msg.Values['DontSaveIfUnmodified'];