assetRequest - Initialization - Author API

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.

  • returnType string

    Controls whether to return HTML, a URL, or an object that contains an image's URL, height, and width.

  • 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).

Related articles

Was this article helpful?

Did you arrive here by accident? If so, learn more about Learnosity.