Warn users if they try to use post message API incorrectly
Change-Id: I09ce1a14587f558765e02fc8197030f4a5d2cee0
This commit is contained in:
parent
8ca5efb671
commit
2abf2421f3
1 changed files with 11 additions and 0 deletions
|
@ -100,6 +100,17 @@ L.Map.WOPI = L.Handler.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
var msg = JSON.parse(e.data);
|
var msg = JSON.parse(e.data);
|
||||||
|
if (msg.MessageId === 'Host_PostmessageReady') {
|
||||||
|
// We already have a listener for this in loleaflet.html, so ignore it here
|
||||||
|
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 + '\'.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.MessageId === 'Insert_Button') {
|
if (msg.MessageId === 'Insert_Button') {
|
||||||
if (msg.Values) {
|
if (msg.Values) {
|
||||||
if (msg.Values.id && !w2ui['toolbar-up'].get(msg.Values.id)
|
if (msg.Values.id && !w2ui['toolbar-up'].get(msg.Values.id)
|
||||||
|
|
Loading…
Reference in a new issue