Type Definitions
Type Definitions
This event is emitted when the list of users mentioned in a comment changes or a new
comment is created with mentions. The modifications
property contains a list of
modifications that were applied to the comment. Each modification contains the user ID
and the action that was performed.
The event is only emitted for the user that created or updated the comment either via the
UI or the API. If you want to listen for changes to comments made by other users, you can
use the comments.create
, comments.change
and comments.delete
event. You get the affected
comment in the event payload and can check the mentioned users using PSPDFKit.Comment.getMentionedUserIds method.
Example
instance.addEventListener("comments.mention", (event) => {
const { comment, modifications } = event;
modifications.forEach((modification) => {
const { userId, action } = modification;
if (action === "ADDED") {
console.log(`User ${userId} was mentioned in comment ${comment.id}`);
} else {
console.log(`User ${userId} was unmentioned in comment ${comment.id}`);
}
});
});
The configuration of the resizing behavior of the annotations
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
maintainAspectRatio |
boolean |
<nullable> |
set to |
minWidth |
number |
<nullable> |
minimum width of the annotation while resizing. |
maxWidth |
number |
<nullable> |
maximum width of the annotation while resizing. |
minHeight |
number |
<nullable> |
minimum height of the annotation while resizing. |
maxHeight |
number |
<nullable> |
maximum height of the annotation while resizing. |
The additional options that are passed to PSPDFKit.AnnotationToolbarItemsCallback
.
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
defaultAnnotationToolbarItems |
Array.<PSPDFKit.AnnotationToolbarItem> | The list of default items that are shown for this particular annotation. |
hasDesktopLayout |
boolean | Whether the screen is in desktop layout. |
A union of all annotation types.
Type:
- PSPDFKit.Annotations.InkAnnotation | PSPDFKit.Annotations.LineAnnotation | PSPDFKit.Annotations.RectangleAnnotation | PSPDFKit.Annotations.EllipseAnnotation | PSPDFKit.Annotations.PolygonAnnotation | PSPDFKit.Annotations.PolylineAnnotation | PSPDFKit.Annotations.LinkAnnotation | PSPDFKit.Annotations.HighlightAnnotation | PSPDFKit.Annotations.SquiggleAnnotation | PSPDFKit.Annotations.StrikeOutAnnotation | PSPDFKit.Annotations.UnderlineAnnotation | PSPDFKit.Annotations.RedactionAnnotation | PSPDFKit.Annotations.NoteAnnotation | PSPDFKit.Annotations.TextAnnotation | PSPDFKit.Annotations.ImageAnnotation | PSPDFKit.Annotations.StampAnnotation | PSPDFKit.Annotations.WidgetAnnotation | PSPDFKit.Annotations.CommentMarkerAnnotation | PSPDFKit.Annotations.MediaAnnotation | PSPDFKit.Annotations.UnknownAnnotation
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
color |
PSPDFKit.Color | null | The Color represented by this preset. Eg: |
localization |
Localization |
On Standalone, this callback receives the name of a font to retrieve as an argument
and you can return from it a Promise
that resolves to a Blob
with the font data to
use.
See this guide to learn more.
Parameters:
Name | Type | Description |
---|---|---|
fontName |
string | The |
Example
new PSPDFKit.Font({
name: "Arial.ttf",
callback: name => fetch(`https://example.com/${name}`).then(r => r.blob());
})
Type:
- "none" | "square" | "circle" | "diamond" | "openArrow" | "closedArrow" | "butt" | "reverseOpenArrow" | "reverseClosedArrow" | "slash"
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | Eg: 'purple' |
|
defaultMessage |
string |
<nullable> |
Default Localization message. Eg: 'Purple' |
description |
string |
<nullable> |
Description of the localization message. Eg: 'Purple Color' |
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
id |
string | The unique ID of the user. |
|
name |
string | The name of the user. |
|
avatarUrl |
string |
<optional> |
The URL of the user's avatar. |
displayName |
string | The display name of the user. |
|
description |
string |
<optional> |
The description of the user. This is shown in the mention list. If you want to show the email, you can pass it here. |
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
format |
string | The format of the text. Either |
value |
string | The text value. |