OnlyOffice use js save file

Can you please tell me if I can use javascript to actively call the save button event to save the current file? Like if I add a save button myself and click on that button to force the file to be saved to the onlyOffice service.

You can use this Command Service method to save the current version of the edited document without closing it: [ONLYOFFICE Api Documentation - Command service]. You can link function sending the forcesave request to your custom button. Here you can learn more about the logic of forcesave: [ONLYOFFICE Api Documentation - Saving File]. You can monitor the status 6 message sent to the callback (ONLYOFFICE Api Documentation - Callback handler) and add your own javascript events that would be triggered each time the saving occurs.

Hi Dmitriiv,
I found that i use the interface https://documentserver/coauthoring/CommandService.ashx,
the return parameter is
“error”: 0,
“key”: “uuid0878123231”
But the file is not immediately deposited into the file service, the page changes are not immediately deposited into the server, resulting in the loss of part of the data.

Is there way to use js call, complete the effect like editorConfig.customisation.forcesave = true when the effect of pressing the save button, the changes can be immediately deposited into the server?


What loss of data are you talking about? Please describe in more detail.
The file is not saved immediately as some time is needed for file compilation, downloading by the file storage