Documentation

Addon Model

Model

Supported property types and their editors:

Type name Editor type Value
audio Audio editor. Allows selecting or uploading audios. Audio URL
boolean Editor with checkbox for true/false values. 'True' or 'False' as string
event Code editor Event code
file Upload editor. Allows uploading custom files. Uploaded file URL
script Upload editor. Allows uploading custom javascript file that will be embedded in a <script> element when the player is loaded. If the name of this property is set to "{library}", then it will not be visible in the lesson editor (useful when used with a default value). Uploaded file URL
module-script Upload editor. Like script type, but adds type="module" to the <script> element. Uploaded file URL
html HTML editor HTML
image Image editor. Allows selecting or uploading images. Image URL
video Video editor. Allows selecting or uploading videos. Video URL
list List editor Array with list elements. Each element is hashmap with property name and value.
narration Multiline text editor without formatting. Narration for recorded audio
string TextArea editor Text
text Multiline text editor without formatting. Text
{option A, option B, option C} Combo box with list of options. Selected in combo option by name

Base properties

The following properties will be automatically added to each addon.

Property name Description
id Module's id unique to the page.
isVisible Sets initial visibility of the addon.
Layout Defines module's layout.
Left Left position.
Top Top position.
Width Module's width.
Height Module's height.
Right Right position.
Bottom Bottom position.

Property List

This property allows creating a list with records. Each record is composed of several properties.

Let's take a look at the examplary list definition:

Items, list
- Title, string
- Text, html

We have the property Item type list.

The Title and Text properties define the list's records. It means that the list will have several records each with these 2 properties.

When defining a record, it is necessary to prefix each record property with a '-' (minus) character.

Record property types

It is possible to use the following property types in the record's definition:

  • boolean
  • file
  • html
  • image
  • audio
  • video
  • string

Accessing list in presenter

To access the list property, it is necessary to first get the record and access its property as HashMap.

So in order to access the property Text of the 3rd record, it is possible to write:

model['Items'][2]['Text']

Localization

Fields which should be localized to different languages should be marked with the 'localize' keyword. Example:

title, string, localize

Display Name

Fields that should have a display name (used in the editor) different than the field name, should have it provided as a third argument.

Example:

title, string, My Title
description, string, My Description, localize

Default value

Fields that are supposed to have a default value can have an additional parameter added at the end.

Example:

title, string, My Title, Title goes here...
description, string, My Description, Description goes here...
{library}, script, Lottie, /file/serve/6421765106827264