Annotations API Initialization
This page details the initialization options for Annotations API.
Enabling Annotations API
This section details how to enable Learnosity Annotations API in Items API. You can enable Annotations API in Items API by adding annotations: true
to the config object within the request object of Items API. By default, Annotations API is disabled in Items API.
Note
Annotations API is instantiated in Items API (Assess and Inline modes). Additionally, when enabling Annotations API via specifying annotations_api_init_options
, these will override the more general annotations: true
setting.
Initialization object
The initialization object contains all of the configuration properties for user & session identification, look and feel for the user interface, as well as properties to enable/disable certain functionality of the API. Most configuration is done within the “modules” object, where each module can be enabled and configured as desired.
Example
const annotations_api_init_options = {
"modules": {
"notepad": true, // enable notepad module with default options
"texthighlight": { // enable texthighlight with the following options:
// Allows client to define a custom set of color scheme classes
// Learnosity Default colors are named: theme-1, theme-2, theme-3, theme-4
"highlight_colors": [
'my-color-1', // highlighted DOM node will have classname "lrn-annotations-color--my-color-1"
'my-color-2'
],
},
"stickynote": { // enable stickynote with the following options:
"start_expanded": true, //sticky notes will be loaded in an expanded form
"start_hidden": true //sticky notes will be loaded in hidden state
},
"drawing": { // enable drawing with the following options:
// Allows client to define a custom set of color scheme classes
// Learnosity Default colors are named:
// lrn-annotations-drawing-color-1, lrn-annotations-drawing-color-2,
// lrn-annotations-drawing-color-3, lrn-annotations-drawing-color-4
"colors": [
'my-color-1', // drawing elements will have classname "my-color-1"
'my-color-2'
],
"show_grid": true // enable the background grid display.
}
}
};
Important
by default, all modules of Annotations API are disabled unless specified. Modules can be enabled by providing either a true
or object
value for that module. If no modules are enabled, Annotations API will not initialize.
Note
Specifying "annotations": true
in Items API enables all Annotations modules with a set of useful defaults, so you can activate all of the modules of Annotations API with one setting.
Modules object
The available modules of Annotations API are:
Properties
Note All initialization options for Annotations API are optional.
-
drawing object
Enables the drawing module, which allows users to annotate the page with a freehand drawing tool.
-
notepad boolean
Enables the notepad module, which allows users to type notes into a separate window on the page.
-
stickynote object
Enables the sticky note module, which allows users to place colored squares onto the page and type text into them.
-
texthighlight object
Enables the text highlight module, which allows users to select text elements on screen and have those selections marked with different colors.