Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions src/navigation_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -524,16 +524,6 @@ export class NavigationController {
allowCollision: true,
},

/** List all of the currently registered shortcuts. */
announceShortcuts: {
name: Constants.SHORTCUT_NAMES.LIST_SHORTCUTS,
callback: () => {
this.shortcutDialog.toggle();
return true;
},
keyCodes: [KeyCodes.SLASH],
},

/** Announce the current location of the cursor. */
announceLocation: {
name: Constants.SHORTCUT_NAMES.ANNOUNCE,
Expand Down Expand Up @@ -682,8 +672,9 @@ export class NavigationController {
this.workspaceMovement.install();

this.clipboard.install();
this.shortcutDialog.install();

// Initalise the shortcut modal with available shortcuts. Needs
// Initialize the shortcut modal with available shortcuts. Needs
// to be done separately rather at construction, as many shortcuts
// are not registered at that point.
this.shortcutDialog.createModalContent();
Expand All @@ -701,6 +692,7 @@ export class NavigationController {
this.insertAction.uninstall();
this.clipboard.uninstall();
this.workspaceMovement.uninstall();
this.shortcutDialog.uninstall();

this.removeShortcutHandlers();
this.navigation.dispose();
Expand Down
25 changes: 25 additions & 0 deletions src/shortcut_dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,31 @@ export class ShortcutDialog {
}
}
}

/**
* Registers an action to list shortcuts with the shortcut registry.
*/
install() {
/** List all of the currently registered shortcuts. */
const announceShortcut: ShortcutRegistry.KeyboardShortcut = {
name: Constants.SHORTCUT_NAMES.LIST_SHORTCUTS,
callback: () => {
this.toggle();
return true;
},
keyCodes: [Blockly.utils.KeyCodes.SLASH],
};
ShortcutRegistry.registry.register(announceShortcut);
}

/**
* Unregisters the action to list shortcuts.
*/
uninstall() {
ShortcutRegistry.registry.unregister(
Constants.SHORTCUT_NAMES.LIST_SHORTCUTS,
);
}
}

/**
Expand Down