This reverts commit c6a3e02b4b partially.
Presumably, some unwanted modifications also found its way in with above
patch breaking the app. Revert problematic pieces.
This was initially introduced in OC so that we know which directory to
go after we close the editor but this seems unnecessary here in NC as
richdocuments is just an iframe which is removed from DOM when we close
the document.
loleaflet expect a BCP47 language tag syntax while OC.getLocale returns
a lanugage tag where subtags are separated by '_' instead of '-'
(BCP47).
It seems safe to just replace '_' with '-' before feeding it to
loleaflet
Adds a new property PostMessageOrigin to WOPI's CheckFileInfo.
The inner frame then only sends message to target with origin
mentioned in this property.
Also implement editor initialization WOPI specs. Inner frame
sends a App_LoadingStatus message to us when ready, and we send
Host_PostmessageReady when we are ready.
There's a race condition here between page being rendered with
all the document(s) information and showing the editor to the
user. The later requires the former as it uses data rendered into
the page.
In most cases, former is quick enough and we do not see any
problems, but in some cases, mostly when the server is responding
very slowly, it will lag behind the later causing the editor to
be shown before data is rendered into the page leading to '404
Object not found'.
This should, hopefully, avoid such cases.
... so no need to create a deferred object separately and then
resolve it manually. This is since jquery 1.5
See: https://api.jquery.com/jquery.getjson/
Route /close/ doesn't mean anything, and we were making this
additional call always before closing the document. This had a
side-effect that sometimes /close/ call would be processed after
we assign returnToDir to window.location making browser always
stuck in richdocuments#index rather than reeturnToDir. This was
mainly the problem in firefox with owncloud9