Author API Initialization
assetRequest()
Integrate your own digital asset management (DAM) system to use your own media content in Questions and Features.
You would want to use this to give authors the ability to embed your own media into your Questions and Features for use in assessments.
When defined, the Widget editor will display a directory or file icon, for instance "...", in fields where media is supported, as well as binding to the insert image button in the rich text editor. The callback is executed when an author clicks the custom button.
Examples
var callbacks = {
assetRequest: function (mediaRequested, returnType, callback, attributes) {
// Function that opens an asset browser or uploader and then calls
// callback(URL|HTML|UrlHeightWidth)
},
// ...
};
var authorApp = window.LearnosityAuthor.init(
initializationOptions,
callbacks
);
Arguments
-
mediaRequested string
Specifies the type of media.
Possible values
"audio"
"image"
"video"
-
"resource"
- for example, a text file.
-
returnType string
Controls whether to return HTML, a URL, or an object that contains an image's URL, height, and width.
Possible values
"HTML"
"URL"
"UrlHeightWidth"
-
callback function
When a media file has been selected, this callback will be executed to render the results in the rich text editor.
-
result string
The HTML to be placed in the rich text editor.
-
-
attributes object
Properties of the asset.
-
src string
The URL of an asset.
-
alt string
The alternative text for an image.
-
height string
Height of the image in pixels.
-
width string
Width of the image in pixels.
-
cssClass string
CSS classes to be applied to the image.
-
Return value
None (undefined
).