Extensions/Assessment/keyboardShortcuts

Extensions add specific functionality to Items API. They rely on modules within LT being available.

--

Enables keyboard shortcuts to perform an action against a question or on the assessment player.

Methods

run(mapopt)

Sets up listeners to enable item or player keyboard shortcuts.

Supports:

  • setting an MCQ response on items with a single MC questions, not multi-part.
  • enabling answer masking mode.
  • setting a mask on MCQ possible responses.
  • toggle flagging of an item.

All listeners will fire when you call run(). Pass a custom map if you want to remove any shortcuts.

See example section below for bindings.

Since
0.4.0
Example
import { LT } from '@caspingus/lt/src/assessment/index';

LT.init(itemsApp); // Set up LT with the Items API application instance variable
LT.extensions.keyboardShortcuts.run();
Parameters:
Name Type Attributes Description
map object <optional>

A map of keyboard shortcut options.

// Default configuration:
{
    global: [
        {
            bindings: {
                chromeos: ['ctrl+shift+v'],
                macos: ['command+shift+v'],
                windows: ['ctrl+shift+v'],
            },
            type: 'item.flag',
        },
        {
            bindings: {
                chromeos: ['ctrl+alt+0'],
                macos: ['command+option+0'],
                windows: ['ctrl+alt+0'],
            },
            type: 'masking.enable',
        },
    ],
    item: [
        {
            bindings: {
                chromeos: ['ctrl+shift+1', 'ctrl+shift+2', 'ctrl+shift+3', 'ctrl+shift+4', 'ctrl+shift+5', 'ctrl+shift+6'],
                macos: ['command+ctrl+1', 'command+ctrl+2', 'command+ctrl+3', 'command+ctrl+4', 'command+ctrl+5', 'command+ctrl+6'],
                windows: ['ctrl+shift+1', 'ctrl+shift+2', 'ctrl+shift+3', 'ctrl+shift+4', 'ctrl+shift+5', 'ctrl+shift+6'],
            },
            restrictTo: ['mcq'],
            type: 'response.set',
        },
        {
            bindings: {
                chromeos: ['ctrl+alt+1', 'ctrl+alt+2', 'ctrl+alt+3', 'ctrl+alt+4', 'ctrl+alt+5', 'ctrl+alt+6'],
                macos: ['command+option+1', 'command+option+2', 'command+option+3', 'command+option+4', 'command+option+5', 'command+option+6'],
                windows: ['ctrl+alt+1', 'ctrl+alt+2', 'ctrl+alt+3', 'ctrl+alt+4', 'ctrl+alt+5', 'ctrl+alt+6'],
            },
            type: 'response.mask',
        },
    ],
};