Skip to main content

Mentions

"Mentions" are created when a user tags another user in a comment using the @ symbol.

When a user starts typing in a comment and the @ key is pressed, a list of users will be presented. The user can then select the user they want to mention.

When a user is mentioned, a few things happen:

Events#

When the currently signed in user is mentioned, a mentionAdded event will be triggered. This event can be used to handle any application specific logic you may want.

import { CollabClient } from '@pdftron/collab-client'
const client = new CollabClient({
...options
})
client.EventManager.subscribe('mentionAdded', (mention) => {
// event handling code
})

Notifications#

When the currently signed in user is mentioned, a message notification will be triggered with the Annotation.hasMention property set to true.

import { CollabClient } from '@pdftron/collab-client'
const client = new CollabClient({
...otherOptions,
notificationHandler: CollabClient.defaultNotificationHandler({
getText: (event) => {
if(event.type === 'message') {
if(event.annotation.hasMention) {
return {
title: `New mention from ${event.annotation.author.userName}`,
body: `Click here to view ${event.annotation.document.name}`
}
}
}
},
})
})

For more information, see the notifications guide.