The provided workaround solution looks good. However, please bear in mind that this isn’t ‘clicking on the Save button’ scenario. As for the implementation of the ForceSave scenario for the button, we are still working on it and I will update this thread when we have something to share.
Hello, @Alexandre
А couple more questions about the “forcesave” command:
-
If a request to the command service with forcesave command returned “error”: 0, does this mean that the save is already guaranteed to have happened? Couldn’t it then happen asynchronously and therefore delayed, especially under high loads?
-
When the user quickly changes something in the edited document in OnlyOffice, the save button is active in the top panel of the editor. But if the user pauses for a few seconds, it is deactivated. While the button is active, the edits made by the user have not yet been transferred to the OnlyOffice server?
The experiment shows that if we call the forcesave command to the OnlyOffice server at the moment when user starts editing and save button activated, we can get a response that there were no changes, there is nothing to save. How can we ensure that the forcesave command saves all the latest changes?
Hello @Vladimir
- If a request to the command service with forcesave command returned “error”: 0, does this mean that the save is already guaranteed to have happened? Couldn’t it then happen asynchronously and therefore delayed, especially under high loads?
The ‘error’:0 means that save process has started successfully. This process will finish when the request to the callbackUrl arrives.
When the user quickly changes something in the edited document in OnlyOffice, the save button is active in the top panel of the editor. But if the user pauses for a few seconds, it is deactivated. While the button is active, the edits made by the user have not yet been transferred to the OnlyOffice server?
The experiment shows that if we call the forcesave command to the OnlyOffice server at the moment when user starts editing and save button activated, we can get a response that there were no changes, there is nothing to save. How can we ensure that the forcesave command saves all the latest changes?
In the bottom of editor interface, a pop-up message ‘All changes saved’ appears constantly. That message means that changes have been passed to Document server cache\database. In your described scenario, a user has started editing and changes still haven’t passed from client to Document server. Meanwhile, at this very moment you have run ForceSave command, but haven’t received any changes to save.
This is expected result since in this very moment Document server didn’t get any new changes from the client yet. Please clarify what guarantees are you lookin for? I mean, do you need to check that changes have come to Document server or something else?
Hello, @Alexandre
1)
But on the Forcesave command on the Document Server integrated with WOPI, it calls the PutFile method instead of callbackUrl. Does this process also run asynchronously?
2)
Yes exactly. Is it possible to check in the client’s host page that the OnlyOffice editor has saved all the latest edits?
Hello @Vladimir
But on the Forcesave command on the Document Server integrated with WOPI, it calls the PutFile method instead of callbackUrl. Does this process also run asynchronously?
Yes, for WOPI the PutFile method will also be called asynchronously without binding to the response ‘error’: 0.
Yes exactly. Is it possible to check in the client’s host page that the OnlyOffice editor has saved all the latest edits?
It seems that you need this event: ONLYOFFICE Api Documentation - Config
and with the parameter: {“data” : false} when the current user’s changes are sent to the document editing service .
Please clarify if I misunderstood your scenario.
Thank you, @Alexandre
Yes, this is exactly the scenario, but with integration via WOPI. In this case, events from the API are not working? How to do the same in WOPI mode?
Hello @Vladimir
There’re analogues. You can use this message: ONLYOFFICE Api Documentation - Overview
Please bear in mind, that in this scenario you need to pass EditNotificationPostMessage: ONLYOFFICE Api Documentation - Overview
Hello @rsoika and @Vladimir
It took some time, but we have implemented Forcesave via WOPI. It will be included in the next major release (v.8.1).
After release, you can check the feature by clicking “Save” button in the editors.
The quick test will be available in our test sample, you will need to add this:
<input name="docs_api_config" value="{"editorConfig":{"customization":{"forcesave":true}}}" type="hidden">
in the form
tag document-server-integration/web/documentserver-example/nodejs/views/wopiAction.ejs at master · ONLYOFFICE/document-server-integration · GitHub.