createEditor - Methods - Rubric Editor API

Rubric Editor API Methods

createEditor()

Creates the editor interface.

You would want to use this method when you want to create a new rubric editor instance, for example, when you want to create a new rubric editor in your application.

Examples

const editor = await rubricEditorApp.createEditor(
    {
        variant: 'dropdown',
        rubric_json: {...},
        rubric_templates: {...}
    }
);

Arguments

  • options object

    Additional editor options.

    The following properties are supported.

    • variant string

      Specifies the editor layout to use for rubric editor. For example, when modal is specified, the editor will display a button that opens the editor in a modal dialog.

      You would want to use this argument to specify the editor layout you want to use for the rubric editor.

      See Rubric Editor Variants for further detail.

      Possible values

      • "default"
      • "dropdown"
      • "modal"
    • rubric_json object

      The rubric JSON to be loaded into the rubric editor.

      You would want to use this argument to specify the existing rubric JSON you want to load into the editor.

      Note The editor initializes in the edit view when a rubric JSON is provided, or in the create view when none is provided.

      See Feedback Aide Rubrics for example rubrics.

    • rubric_templates object

      The templates for the rubric editor. This is used to define the available templates for the rubric editor such as: analytic, holistic, short response general, and more.

      You would want to use this to define your own templates or override the default templates or hide certain default templates.

      By default, we group templates into the following categories:

      • essay: Templates for essay-type rubrics, for example, analytic, holistic.
      • short_response: Templates for short response rubrics, for example, general, categorize, etc.

      Important If any template group is set to false, that template group will be ignored. This would be useful to ignore certain default template groups like essay, for example.

      This argument should be a key/value object where each key is a template group name such as "essay" or "short_response", and the value is an object with the following properties:

      • name string: The template name.
      • templates array[object]: List of template objects, each containing:
        • name: Template name.
        • description: Template description.
        • image: The image URL of the template.
        • defaults: The default rubric JSON when the template is selected.
    • rubric_practice object

      Configuration options for the rubric practice functionality which allows authors to test a rubric against sample learner responses using Feedback Aide's generated feedback.

      A valid security provider and stimulus must be provided to be able to run practice tests.

      See Enabling Rubric Practice in Rubric Editor API for a full setup guide.

      const editor = await rubricEditorApp.createEditor({
          variant: 'modal',
          rubric_json: {...},
          rubric_practice: {
              security_provider: async (context) => {
                  // Request a new access token from your backend
                  const response = await fetch('/your-endpoint/rubric-practice-token', {
                      method: 'POST',
                      body: JSON.stringify({ reason: context.reason }),
                  });
                  return response.json();
              },
              stimulus: '<p>Write a short response about the water cycle.</p>',
              sources: [
                  {
                      title: 'Reference material',
                      content: '<p>The water cycle describes the continuous movement of water...</p>'
                  }
              ],
              responses: [
                  { content: '<p>Water evaporates from the surface...</p>' }
              ],
          },
      });
      

      The following properties are supported.

      • security_provider function

        The async callback function that supplies access tokens for rubric practice.

        The function is called automatically by the editor whenever an access token is required, for example, when the user runs a test or when an access token has expired. The editor passes a context object to the function so your application can determine the appropriate response.

        Important The practice_uuid value in the return object must be generated by your backend from the specified endpoint. Do not generate this value in the browser.

        The following arguments are available.

        • context object

          Information about why a new access token is being requested. Use this in your backend to determine whether to issue a new access token.

          The following properties are supported.

          • reason string

            Indicates the reason the editor is requesting a new access token.

            Possible values

            • "initial" — The first access token request, issued when the editor initializes to verify the provider is working correctly before the first test run.
            • "expired" — The previous access token has expired.
            • "limit_exhausted" — The previous access token's usage limit has been reached.
            • "unauthorized" — The previous access token was rejected as unauthorized.
          • last_error object

            Details of the error that triggered this access token request.

            Present when reason is "expired", "limit_exhausted", or "unauthorized".

            The following properties are supported.

            • error string

              The error code from the previous request.

            • message string

              A human-readable description of the error.

            • http_status number

              The HTTP status code returned by the previous request.

      • stimulus string

        The HTML content of the question stimulus to display in the Test panel. This is typically the question prompt the learner would see.

      • sources array[object]

        A list of sources and related materials to display in the Test panel.

        See Feedback Aide Sources for more information.

        The following properties are supported.

        • title string

          The title of the source.

        • content string

          The HTML content of the source.

      • responses array[object]

        A list of sample learner responses to pre-populate the response fields in the Test panel.

        The following properties are supported.

        • content string

          The HTML content of the response.

        • autoScores array[object]

          Manually selects the Feedback Aide score indicators for this response.

        • manualComparison array[object]

          Selects the expected user scores for this response.

        • creditsUsed number

          The number of credits consumed by the test run for this response.

Return value

Type Promise

When the promise resolves, it will return a RubricEditor interface.

See this RubricEditor for more information.

Was this article helpful?

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