Annotations API Methods
applyHighlight()
Highlights certain text based on provided information. If the provided startContainerPath
and endContainerPath
start with an id prefix like “[id^=”passage_”]>p:nth-of-type(2);0”
, then of all the elements that have ids matching [id^=”passage_”]
such as id='passage_0'
or id='passage_1'
will be highlighted.
Examples
itemsApp.annotationsApp().module('texthighlight').applyHighlight({
id: 'myNote',
startContainerPath: 'div:nth-of-type(1)>p:nth-of-type(2);0',
endContainerPath: 'div:nth-of-type(1)>p:nth-of-type(2);0',
startOffset: 297,
endOffset: 538
});
Arguments
-
id string
A unique string value up to 150 characters in length.
-
startContainerPath string
The beginning of the container path.
-
endContainerPath string
The end of the container path.
-
startOffset string
The beginning of the offset, a value in pixels.
-
endOffset string
The end of the offset, a value in pixels.
Return value
None (undefined
).