@blockly/keyboard-navigation
Version:
A plugin for keyboard navigation.
73 lines • 2.27 kB
TypeScript
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type { Navigation } from '../navigation';
import { Mover } from './mover';
/**
* Class for registering a shortcut for the enter action.
*/
export declare class EnterAction {
private mover;
private navigation;
constructor(mover: Mover, navigation: Navigation);
/**
* Adds the enter action shortcut to the registry.
*/
install(): void;
/**
* Handles hitting the enter key on the workspace.
*
* @param workspace The workspace.
*/
private handleEnterForWS;
/**
* Inserts a block from the flyout.
* Tries to find a connection on the block to connect to the marked
* location. If no connection has been marked, or there is not a compatible
* connection then the block is placed on the workspace.
* Trigger a toast per session if possible.
*
* @param workspace The main workspace. The workspace
* the block will be placed on.
*/
private insertFromFlyout;
/**
* Position a new top-level block to avoid overlap at the top left.
*
* Similar to `WorkspaceSvg.cleanUp()` but does not constrain itself to not
* affecting code ordering in order to use horizontal space.
*
* @param workspace The workspace.
* @param newBlock The top-level block to move to free space.
*/
private positionNewTopLevelBlock;
/**
* Triggers a flyout button's callback.
*
* @param workspace The main workspace. The workspace
* containing a flyout with a button.
*/
private triggerButtonCallback;
/**
* If this block has a full block field then show its editor.
*
* @param block A block.
* @returns True if we showed the editor, false otherwise.
*/
private tryShowFullBlockFieldEditor;
/**
* Creates a new block based on the current block the flyout cursor is on.
*
* @param workspace The main workspace. The workspace
* the block will be placed on.
* @returns The newly created block.
*/
private createNewBlock;
/**
* Removes the enter action shortcut.
*/
uninstall(): void;
}
//# sourceMappingURL=enter.d.ts.map