UNPKG

@blockly/keyboard-navigation

Version:
123 lines 4.24 kB
/** * @license * Copyright 2021 Google LLC * SPDX-License-Identifier: Apache-2.0 */ /** * @fileoverview Registers all of the keyboard shortcuts that are necessary for * navigating blockly using the keyboard. * @author aschmiedt@google.com (Abby Schmiedt) */ import './toolbox_monkey_patch'; import * as Blockly from 'blockly/core'; import { ShortcutRegistry, WorkspaceSvg } from 'blockly/core'; import { Clipboard } from './actions/clipboard'; import { DeleteAction } from './actions/delete'; import { EditAction } from './actions/edit'; import { ShortcutDialog } from './shortcut_dialog'; import { WorkspaceMovement } from './actions/ws_movement'; import { ArrowNavigation } from './actions/arrow_navigation'; import { ExitAction } from './actions/exit'; import { EnterAction } from './actions/enter'; import { DisconnectAction } from './actions/disconnect'; import { ActionMenu } from './actions/action_menu'; import { MoveActions } from './actions/move'; import { UndoRedoAction } from './actions/undo_redo'; /** * Class for registering shortcuts for keyboard navigation. */ export declare class NavigationController { private navigation; private mover; shortcutDialog: ShortcutDialog; /** Context menu and keyboard action for deletion. */ deleteAction: DeleteAction; /** Context menu and keyboard action for deletion. */ editAction: EditAction; /** Keyboard shortcut for disconnection. */ disconnectAction: DisconnectAction; clipboard: Clipboard; workspaceMovement: WorkspaceMovement; /** Keyboard navigation actions for the arrow keys. */ arrowNavigation: ArrowNavigation; exitAction: ExitAction; enterAction: EnterAction; undoRedoAction: UndoRedoAction; actionMenu: ActionMenu; moveActions: MoveActions; /** * Original Toolbox.prototype.onShortcut method, saved by * addShortcutHandlers. */ private origToolboxOnShortcut; /** * Registers the default keyboard shortcuts for keyboard navigation. */ init(): void; /** * Monkeypatches core Blockly components to add methods that allow * them to handle keyboard shortcuts when in keyboard navigation * mode. */ protected addShortcutHandlers(): void; /** * Removes monkeypatches from core Blockly components. */ protected removeShortcutHandlers(): void; /** * Handles the given keyboard shortcut. * This is only triggered when keyboard accessibility mode is enabled. * * @param shortcut The shortcut to be handled. * @returns True if the toolbox handled the shortcut, false otherwise. */ protected toolboxHandler(this: Blockly.Toolbox, shortcut: ShortcutRegistry.KeyboardShortcut): boolean; /** * Adds all necessary event listeners and markers to a workspace for keyboard * navigation to work. This must be called for keyboard navigation to work * on a workspace. * * @param workspace The workspace to add keyboard * navigation to. */ addWorkspace(workspace: WorkspaceSvg): void; /** * Removes all necessary event listeners and markers to a workspace for * keyboard navigation to work. * * @param workspace The workspace to remove keyboard * navigation from. */ removeWorkspace(workspace: WorkspaceSvg): void; /** * Turns on keyboard navigation. * * @param workspace The workspace to turn on keyboard * navigation for. */ enable(workspace: WorkspaceSvg): void; /** * Turns off keyboard navigation. * * @param workspace The workspace to turn off keyboard * navigation on. */ disable(workspace: WorkspaceSvg): void; /** * Dictionary of KeyboardShortcuts. */ protected shortcuts: { [name: string]: ShortcutRegistry.KeyboardShortcut; }; /** * Registers all default keyboard shortcut items for keyboard * navigation. This should be called once per instance of * KeyboardShortcutRegistry. */ protected registerDefaults(): void; /** * Removes all the keyboard navigation shortcuts. */ dispose(): void; } //# sourceMappingURL=navigation_controller.d.ts.map