Collabora Online

How to monitor annotation addition, reply, and other operations through JS on the browser side?

hello @xisheng welcome to forums :slight_smile:

The PostMessage API in Collabora Online primarily supports interactions like user actions, configuration updates, or custom integrations. However, annotation-specific events may not be directly supported through this API as of now unless explicitly mentioned in recent updates or custom extensions to the API.

To confirm support for annotation events, you should:

  1. Consult Official Documentation:
    Review the latest Collabora Online SDK documentation for the list of supported events.

  2. Check for Message Logs:
    If annotations are supported, you can listen to postMessage events and log all incoming messages to see if annotation-related events appear:

    window.addEventListener("message", (event) => {
        console.log("Received message:", event.data);
    });
    
  3. Look into the Source Code:
    Since you mentioned working with the Collabora Online SDK examples, you can explore whether any annotations are explicitly supported in recent SDK updates.

Alternative Approaches

If the PostMessage API doesn’t directly support annotation events, here are alternatives:

  1. Customization with Core Collabora Code:
    You may need to extend or customize Collabora Online’s codebase to emit annotation-related events via the API. This would involve modifying the online repository to support such events.

  2. Server-Side Hooks (WOPI):
    If you’re using a WOPI-like integration, monitor file save or update events on the backend to detect changes that might include annotations.

  3. Client-Side Polling:
    Implement client-side JavaScript to periodically query document content or metadata for annotations using available UNO commands or REST APIs.

Since you mentioned working with the Collabora Online SDK examples, you can explore whether any annotations are explicitly supported in recent SDK updates.

Thanks,
Darshan

Hello Darshan! Thank you very much for your prompt and detailed response. I will follow your advice and make some attempts.

Thanks again,
xisheng

1 Like