This is a lower-level API. Lower-level APIs are not recommended for most projects, and may not be available on all plans. See our page on recommended deployment patterns for more information.
Initialization Option Question Editor API


If defined the Editor will display a directory/file icon. I.e. "..." in fields where media is supported, as well as binding to the "insert image" button in the html WYSIWIG editor. If the icon is clicked by an author the function is called.


"assetRequest": function( mediaRequested,
                              callback ,
                              attributes) {
    // myfunction that opens an asset
    // browser or uploader and then calls
    // callback(URL|HTML|UrlHeightWidth)
// example function to be called by assetRequest
var assetRequestFunction = function(mediaRequested, returnType, callback) {
if (mediaRequested === 'image') {
    var $modal = $('.modal.img-upload'),
    $images = $('.asset-img-gallery img'),
    imgClickHandler = function () {
        if (returnType === 'HTML') {
            callback('<img src="' + $(this).data('img') + '"/>');
        } else {
        $'click', imgClickHandler);
    $images.on('click', imgClickHandler);
        backdrop: 'static'


Type function

Callback arguments

The callback receives the following arguments when it is executed.

  • mediaRequested string

    Determine the type of media

    Possible values:
    • "audio"
    • "image"
    • "video"
    • "resource"
  • returnType string

    Let the function know whether to supply HTML or a URL or an object that contains image's url, width and height.

    Possible values:
    • "HTML"
    • "URL"
    • "UrlHeightWidth"
  • callback callback

    Function that must be executed once the HTML, URL or UrlHeightWidth is ascertained.

    • data string | UrlHeightWidth
  • attributes object

    Attributes of media to be used in assetRequest

    • alt string

      The alternative text for an image.

    • height string
    • src string

      The url of an asset.

    • width string
Was this article helpful?