onRequestClose event & document status

We are trying to implement a connector for our document management platform which allows users to create versions.

We are currently using the onRequestClose event to detect when the user selects the ‘save and close’ command so that we can ask about the document version details, before saving it to the DMS.

When the onRequestClose event is triggered, how can we determine if the document has been modified since opening or since last saved by another user ? This will avoid an unnecessary popup since the document is already saved.

Thank you.

Hi @stefanu,
Please specify what kind of unnecessary popup you mean? If you need to determine whether there are some changes in the editor that have not been sent to the server yet, you can use this event:
https://api.onlyoffice.com/editors/config/events#onDocumentStateChange

Hello,
Thank you for the reply.
The popup is from our document management app. Here’s what the sequence of operations looks like :

  1. the user selects a document in the DMS, then clicks on the ‘edit’ icon
  2. a new tab is opened with the onlyoffice document editor (much like in the example app from the development version)
  3. the user makes changes and clicks the ‘save and close’ icon the upper-right corner
  4. when onRequestClose event is triggered we display a popup asking the user what kind of version he wants saved to the DMS
  5. the version is saved

Our problem happens if step (3) does not happen. So the user opens the document, but makes no changes to it, then closes.

When the onRequestClose event is triggered we would like to check if the user (or any other user) modified the document, and if not, do not display our popup from step (4), since it is not necessary.

Of course, if there’s another way of doing this or if we’re using the editor the wrong way, please let us know.

Thank you.

Hello @stefanu
If you don’t mind, I will step to this thread.

When the onRequestClose event is triggered we would like to check if the user (or any other user) modified the document, and if not, do not display our popup from step (4), since it is not necessary.

Probably you have to take a look at this title: ONLYOFFICE Api Documentation - Callback handler
Your described scenario is status 4 - document is closed with no changes.