Extensions add specific functionality to Learnosity APIs. They rely on modules within LT being available.
--
Adds an SSML editor which can be launched from a custom Question Editor button in the toolbar.
You MUST use the object as defined below. Also, note the toolbar_settings
which is required to place the custom button(s) where you want in the toolbar.
{
"config": {
"dependencies": {
"question_editor_api": {
"init_options": {
"rich_text_editor": {
"customButtons": [
{
"func": "LT.extensions.ssmlEditor.launchSsmlEditor",
"icon": "https://raw.githubusercontent.com/michaelsharman/LT/refs/heads/main/src/authoring/extensions/ui/ssmlEditor/assets/images/icon_tts.svg",
"label": "Add SSML",
"name": "addSsml",
"attributes": ["content","stimulus","template","options"]
}
],
"toolbar_settings": {
"ltr_toolbar": [
{
"items": ["Bold","Italic","Underline","-","TextColor","-", "LrnUnderlinedIndicator","-","RemoveFormat","FontSize"],
"name": "basicstyles"
},
{
"items": ["NumberedList","BulletedList","-","Indent","Outdent"],
"name": "list"
},
{
"items": ["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],
"name": "justify"
},
{
"items": ["Link","Unlink"],
"name": "link"
},
{
"items": ["Image","LrnMath","Table","Blockquote","SpecialChar"],
"name": "insert"
},
{
"items": ["LrnSimpleFeature"],
"name": "simplefeature"
},
{
"items": ["LrnResource"],
"name": "resource"
},
{
"items": ["LrnEditAriaLabel","LrnPopupContent"],
"name": "editAriaLabel"
},
{
"name": "custombuttons"
},
{
"items": ["Undo","Redo"],
"name": "clipboard"
},
{
"items": ["Styles"],
"name": "style"
},
{
"items": ["Sourcedialog"],
"name": "mode"
},
{
"items": ["lrn_datatable"],
"name": "data"
}
]
}
}
}
}
}
}
}
Methods
launchSsmlEditor(attribute, callback)
Called via a custom button in the rich text toolbar. Renders a modal with an SSML editor.
Since
- 2.8.0
Parameters:
Name | Type | Description |
---|---|---|
attribute |
string | Which Question Editor attribute is being edited |
callback |
* | Called to return to the parent rich-text editor |
run()
Extension constructor.
Since
- 2.8.0
Example
import { LT } from '@caspingus/lt/src/authoring/index';
LT.init(authorApp); // Set up LT with the Author API application instance variable
LT.extensions.ssmlEditor.run();