This event will fire whenever an annotation is being selected or unselected.
This event will be emitted whenever an annotation loses focus.
The parameter is a Events.AnnotationsBlurEvent.
This event will be emitted whenever the current annotations change either due to a user action (eg. clicking the UI) or via Instance#create, Instance#update or Instance#delete.
The event might also be emitted every time the NutrientViewer's annotations model changes. This for example can happen when scrolling to a page and NutrientViewer loads the annotations for that page or when opening the annotations sidebar and NutrientViewer (has to) loads all the document annotations.
The change event will fire before all specific events and it could be used in case you want to perform some action regardless of which event caused the annotation to "change" (create, delete, update, load, internal load, etc). Consider using the specific events for more advanced use cases.
This event will be emitted whenever an annotation is copied using Cmd/Ctrl+C keyboard shortcut.
The parameter is a Events.AnnotationsCopyEvent
This event will be emitted whenever new annotations were created (either via the public API or via the UI).
If Nutrient Instant is enabled, annotations created by remote clients will also cause this event to be emitted.
The parameter is a NutrientViewer.Immutable.List of created NutrientViewer.Annotations.Annotation.
This event will be emitted whenever an annotation is cut using Cmd/Ctrl+X keyboard shortcut.
The parameter is a Events.AnnotationsCutEvent
This event will be emitted whenever new annotations were deleted (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of deleted NutrientViewer.Annotations.
This event will be emitted whenever annotations were saved to the annotation provider.
This event will follow a Events.AnnotationsWillSaveEvent.
This event will be emitted whenever an annotation is duplicated using the Ctrl/Cmd+D keyboard shortcut.
The parameter is a Events.AnnotationsDuplicateEvent
This event will be emitted whenever an annotation is focused.
The parameter is a Events.AnnotationsFocusEvent.
This event will be emitted whenever annotations are loaded from the annotation provider. This can happen more than once since we often load annotations on demand only.
The parameter is a NutrientViewer.Immutable.List of loaded NutrientViewer.Annotations.
This event will be emitted whenever an annotation is pasted using Cmd/Ctrl+V keyboard shortcut.
The parameter is a Events.AnnotationsPasteEvent
This event will be emitted whenever an annotation is pressed i.e. either clicked or tapped.
The parameter is a Events.AnnotationsPressEvent.
Prevent the default behavior for LinkAnnotation and redirect to another site when an annotation is pressed.
instance.addEventListener("annotations.press", (event) => {
if (event.annotation instanceof Annotations.LinkAnnotation) {
event.preventDefault();
window.location.href = "https://example.com";
}
});
This event will be emitted whenever an annotation is dragged or resized using the UI.
The parameter is a Events.AnnotationsTransformEvent
This event will be emitted whenever new annotations were updated (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of updated NutrientViewer.Annotations.Annotation.
This event will be emitted when the user starts or ends an interaction with an annotation. See NutrientViewer.AnnotationsWillChangeReason for a comprehensive list of actions supported.
Note that this event is only emitted for actions performed through the UI.
Despite the name, it is not necessarily fired before each emission of NutrientViewer.EventName.ANNOTATIONS_CHANGE, since that would not correspond to the list of possible reasons described in NutrientViewer.AnnotationsWillChangeReason on all cases.
Show a message depending on whether the user started or finished deleting an annotation.
instance.addEventListener("annotations.willChange", event => {
const annotation = event.annotations.get(0);
if (event.reason === AnnotationsWillChangeReason.DELETE_START) {
console.log("Will open deletion confirmation dialog");
} else if (
event.reason === AnnotationsWillChangeReason.DELETE_END
) {
if (annotation) {
console.log("The user decided to delete the annotation.");
} else {
console.log("The user decided to not delete the annotation.");
}
}
});
This event will be emitted before annotations will be saved to the annotation provider.
Right now, this happens whenever attributes of the annotation change (either via the public API or via the UI) and the annotation is in a valid state.
You can use this to display a loading spinner for example. This event will always be followed by Events.AnnotationsDidSaveEvent.
This event will be emitted whenever an annotation note icon is hovered, which by default shows the annotation note editor popover element.
The parameter is a Events.AnnotationNotePressEvent.
This event will be emitted whenever an annotation note is selected by pressing its associated icon.
The parameter is a Events.AnnotationNotePressEvent.
This event will be emitted whenever the current bookmarks change either via Instance#create, Instance#update or Instance#delete.
The change event will fire before all specific events. Consider using the specific events for more advanced use cases.
This event will be emitted whenever new bookmarks are created (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of created Bookmark.
This event will be emitted whenever bookmarks are deleted (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of deleted Bookmark.
This event will be emitted whenever bookmarks were saved to the bookmark provider.
This event will follow a NutrientViewer.EventName.BOOKMARKS_WILL_SAVE.
This event will be emitted whenever bookmarks are loaded from the bookmark provider. This can happen more than once since we often load bookmarks on demand only.
The parameter is a NutrientViewer.Immutable.List of loaded Bookmark.
This event will be emitted whenever bookmarks are updated (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of updated Bookmark.
This event will be emitted before bookmarks will be saved to the bookmark provider.
Right now, this happens whenever attributes of the bookmark change (either via the public API or via the UI) and the bookmark is in a valid state.
You can use this to display a loading spinner for example. This event will always be followed by NutrientViewer.EventName.BOOKMARKS_DID_SAVE.
This event will be emitted whenever the current comments change either via Instance#create, Instance#update or Instance#delete.
The change event will fire before all specific events. Consider using the specific events for more advanced use cases.
This event will be emitted whenever new comments are created (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of created Comment.
This event will be emitted whenever comments are deleted (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of deleted Comment.
This event will be emitted whenever comments were saved to the comment provider.
This event will follow a NutrientViewer.EventName.COMMENTS_WILL_SAVE.
This event will be emitted whenever comments are loaded from the comment provider. This can happen more than once since we often load comments on demand only.
The parameter is a NutrientViewer.Immutable.List of loaded Comment.
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 Comment.getMentionedUserIds method.
Log which users were mentioned or unmentioned in a comment.
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}`);
}
});
});
This event will be emitted whenever comments are updated (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of updated Comment.
This event will be emitted before comments will be saved to the comment provider.
Right now, this happens whenever attributes of the comment change (either via the public API or via the UI) and the comment is in a valid state.
You can use this to display a loading spinner for example. This event will always be followed by NutrientViewer.EventName.COMMENTS_DID_SAVE.
This event will be emitted whenever the CropArea begins being created, moved, or resized (via UI interaction).
This event will be emitted whenever the crop area stops being created, moved or resized (via UI interaction).
This event will be emitted whenever operations have been performed in the document.
The event listener will receive the array of DocumentOperations operations performed on the document.
This event will be emitted whenever document save state changes. This reflects changes to return value of Instance.hasUnsavedChanges.
The parameter is Events.SaveStateChangeEvent.
This event will be emitted whenever the document comparison UI is hidden.
This event will be emitted whenever the document comparison UI is shown.
The event listener will receive the document comparison configuration object with which setDocumentComparisonMode() has been called.
This event will be emitted whenever the form field values were saved to the data provider.
This event will follow a NutrientViewer.EventName.FORM_FIELD_VALUES_WILL_SAVE.
This event will be emitted whenever the current value of form field were updated either due to a user action or when Instance#setFormFieldValues is invoked.
This event will be emitted before form field values will be saved to the data provider.
You can use this to display a loading spinner, for example. This event will always be followed by NutrientViewer.EventName.FORM_FIELD_VALUES_WILL_SAVE.
This event will be emitted whenever the current form fields change either due to a user action (eg. clicking the UI) or via Instance#create, Instance#update or Instance#delete.
The change event will fire before all specific events and it could be used in case you want to perform some action regardless of which event caused the form fields to "change" (create, delete, update, load, internal load, etc). Consider using the specific events for more advanced use cases.
This event will be emitted whenever new form fields where created (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of created NutrientViewer.FormFields.
This event will be emitted whenever new form fields where deleted (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of deleted NutrientViewer.FormFields.
This event will be emitted whenever form fields were saved to the form field provider.
This event will follow a NutrientViewer.EventName.FORM_FIELDS_WILL_SAVE.
This event will be emitted whenever form fields are loaded from the form field provider. This can happen more than once since we often load form fields on demand only.
The parameter is a NutrientViewer.Immutable.List of loaded NutrientViewer.FormFields.
This event will be emitted whenever new form fields where updated (either via the public API or via the UI).
The parameter is a NutrientViewer.Immutable.List of updated NutrientViewer.FormFields.
This event will be emitted before form fields will be saved to the form field provider.
Right now, this happens whenever attributes of the form fields change (either via the public API or via the UI) and the form field is in a valid state.
You can use this to display a loading spinner for example. This event will always be followed by NutrientViewer.EventName.FORM_FIELDS_DID_SAVE.
This event will be emitted whenever the form got submitted to the specified URI. The event will receive a object from the form submission. If the submission got transmitted successfully, the object will contain a response key, which has a https://developer.mozilla.org/en-US/docs/Web/API/Response|response object as a value. When an error occurred during the submission, the object parameter will have an error key with the error object as a value.
This event will be emitted whenever the form values will be submitted.
To cancel the form submission, call the preventDefault function with no arguments. This
event will follow a NutrientViewer.EventName.FORMS_WILL_SUBMIT, when the submission got
not canceled with preventDefault.
This event will be emitted after calling NutrientViewer.Instance#history.undo or NutrientViewer.Instance#history.redo, or after pressing the main toolbar Undo or Redo buttons, optionally available.
If provided, the listener callback will receive a Events.HistoryChangeEvent object.
This event will be emitted after calling NutrientViewer.Instance#history.clear.
This event will be emitted after calling NutrientViewer.Instance#history.redo or after pressing the main toolbar Redo button, optionally available.
If provided, the listener callback will receive a Events.HistoryChangeEvent object.
This event will be emitted after calling NutrientViewer.Instance#history.undo or after pressing the main toolbar Undo button, optionally available.
If provided, the listener callback will receive a Events.HistoryChangeEvent object.
This event will be emitted before adding an annotation change to the actions history; if the
event's preventDefault() method is called, the change will not be added and the action
will not be undoable.
If provided, the listener callback will receive a Events.HistoryWillChangeEvent object.
This event will fire whenever the list of ink signatures is changed (either a signature was added, updated, or deleted).
This event will fire whenever a signature is created and stored.
storedSignatures.create payload returns null values for the annotation
id and name. We return these values because the created signature is
not attached to the document hence it isn't assigned an id or name.
If you want to retrieve a complete list of values of the signature
annotation we suggest to listen to the annotations.create event.
This event will fire whenever a signature is deleted.
This event will fire whenever one ink signature is updated.
This event will be emitted whenever an instant client connects or disconnects from the current document. See Instance#connectedClients for more information.
To receive this callback, make sure to set up Nutrient Instant correctly.
This event will be emitted whenever a click on a page occurs that is not handled by any occluding page element (annotation, form, etc.).
This event internally uses the onpointerup event triggered by the browser. This is an
implementation detail which we are documenting because it is useful to prevent the propagation of click events on custom overlay items.
Please don't rely on this behavior if possible and use it wisely as it might break in future.
The parameter is a Events.PagePressEvent.
Whenever the search state changes, this event will fire with the latest state.
This event will fire whenever the customer types in a new search term in the search UI. It can be used to plug the default search into your own search UI.
For an example, see Events.SearchTermChangeEvent.
This event will fire whenever the list of ink signatures is changed (either a signature was added, updated, or deleted).
This event will fire whenever a signature is created and stored.
This event will fire whenever a signature is deleted.
This event will fire whenever one ink signature is updated.
This event will be emitted whenever a click on a text line occurs that is not handled by any occluding page element (annotation, form, etc.).
The parameter is a Events.TextLinePressEvent.
Whenever the text selection changes, this event will fire with the latest selection.
textSelection might be null when the selection was cleared.
This event will be emitted whenever the current view state changes either by the user (via clicking the UI) or via setViewState(). It will be called after other view state specific events. If, for example, the page index changes, Events.ViewStateCurrentPageIndexChangeEvent will emit first.
If you update multiple properties at once, this event will only be dispatched once.
The callback takes the current ViewState as first argument, and the previous ViewState as second.
This event will be emitted whenever the current page index changes. It can be used to track the current view of a user.
This event will be emitted whenever the zoom level or the zoom mode changes. This could either be a number multiplier or a distinct zoom configuration or zoom mode.
This event will be emitted whenever the current preset is about to be updated with new property values set by the user in the annotation toolbar.