Clear IReaderViewAnnotationOptions for all ISearchResultItems previously set by setSearchResultItemAnnotationOptions().
Gets the SearchResultItem associated with the specified ReaderViewAnnotation. Use this method when:
searchHighlightAnnotationLayer.addEngineEventListener('annotationIntersectingVisibleRange', evt => {
const searchResultItemInView = agent.getSearchResultItemByAnnotation(evt.annotation);
// Add to list of visible search results.
});
Sets or replaces the query that the agent should use for searching.
Removes any annotations previously created by the agent. Set to null to remove all annotations and inactivate the agent.
Sets the IReaderViewAnnotationOptions to use when rendering ReaderViewAnnotations for the specified searchResultItems.
You can for example use this to highlight a selected search result item in a different color.
function onSearchResultListItemClicked(item: ISearchResultItem): void {
// Highlight the search result item in the ReaderView.
agent.setSearchResultItemAnnotationOptions([item], {
rangeClassName: 'selected-item'
});
}
Generated using TypeDoc
A IReaderViewSearchAgent uses a query to search the visible ReaderDocuments in the ReaderView. For each found search match, the agent creates a
ReaderViewAnnotation.The agent will continue to search, add and remove
ReaderViewAnnotationsas necessary when the ReaderView is navigated.The IReaderViewSearchAgent has no search query set by default. Call
setSearchQuery()with aIReaderDocumentSearchQueryto start searching in the visible ReaderDocuments.The following example shows how to highlight all search matches: