Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audit keyboard shortcuts for Accel instead of Ctrl #6447

Merged
merged 6 commits into from Jun 1, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/console-extension/schema/tracker.json
Expand Up @@ -14,7 +14,7 @@
},
{
"command": "console:linebreak",
"keys": ["Ctrl Enter"],
"keys": ["Accel Enter"],
"selector": ".jp-CodeConsole[data-jp-interaction-mode='terminal'] .jp-CodeConsole-promptCell"
},
{
Expand Down
3 changes: 1 addition & 2 deletions packages/help-extension/package.json
Expand Up @@ -49,7 +49,6 @@
"access": "public"
},
"jupyterlab": {
"extension": true,
"schemaDir": "schema"
"extension": true
}
}
14 changes: 0 additions & 14 deletions packages/help-extension/schema/plugin.json

This file was deleted.

2 changes: 0 additions & 2 deletions packages/help-extension/src/index.tsx
Expand Up @@ -44,8 +44,6 @@ namespace CommandIDs {

export const hide = 'help:hide';

export const toggle = 'help:toggle';

export const launchClassic = 'help:launch-classic-notebook';
}

Expand Down
4 changes: 2 additions & 2 deletions packages/mainmenu-extension/schema/plugin.json
Expand Up @@ -24,12 +24,12 @@
},
{
"command": "editmenu:redo",
"keys": ["Ctrl Shift Z"],
"keys": ["Accel Shift Z"],
"selector": "[data-jp-undoer]"
},
{
"command": "editmenu:undo",
"keys": ["Ctrl Z"],
"keys": ["Accel Z"],
"selector": "[data-jp-undoer]"
},
{
Expand Down
29 changes: 19 additions & 10 deletions packages/mainmenu-extension/src/index.ts
Expand Up @@ -298,6 +298,9 @@ export function createFileMenu(
const commands = menu.menu.commands;

// Add a delegator command for closing and cleaning up an activity.
// This one is a bit different, in that we consider it enabled
// even if it cannot find a delegate for the activity.
// In that case, we instead call the application `close` command.
commands.addCommand(CommandIDs.closeAndCleanup, {
label: () => {
const action = Private.delegateLabel(
Expand All @@ -308,16 +311,22 @@ export function createFileMenu(
const name = Private.delegateLabel(app, menu.closeAndCleaners, 'name');
return `Close and ${action ? ` ${action} ${name}` : 'Shutdown'}`;
},
isEnabled: Private.delegateEnabled(
app,
menu.closeAndCleaners,
'closeAndCleanup'
),
execute: Private.delegateExecute(
app,
menu.closeAndCleaners,
'closeAndCleanup'
)
isEnabled: () =>
!!app.shell.currentWidget && !!app.shell.currentWidget.title.closable,
execute: () => {
// Check if we have a registered delegate. If so, call that.
if (
Private.delegateEnabled(app, menu.closeAndCleaners, 'closeAndCleanup')()
) {
return Private.delegateExecute(
app,
menu.closeAndCleaners,
'closeAndCleanup'
)();
}
// If we have no delegate, call the top-level application close.
return app.commands.execute('application:close');
}
});

// Add a delegator command for creating a console for an activity.
Expand Down
13 changes: 12 additions & 1 deletion packages/terminal-extension/src/index.ts
Expand Up @@ -18,7 +18,7 @@ import {

import { ILauncher } from '@jupyterlab/launcher';

import { IMainMenu } from '@jupyterlab/mainmenu';
import { IFileMenu, IMainMenu } from '@jupyterlab/mainmenu';

import { ITerminalTracker, ITerminal } from '@jupyterlab/terminal';

Expand Down Expand Up @@ -192,6 +192,17 @@ function activate(

// Add terminal creation to the file menu.
mainMenu.fileMenu.newMenu.addGroup([{ command: CommandIDs.createNew }], 20);

// Add terminal close-and-shutdown to the file menu.
mainMenu.fileMenu.closeAndCleaners.add({
tracker,
action: 'Shutdown',
name: 'Terminal',
closeAndCleanup: (current: MainAreaWidget<ITerminal.ITerminal>) => {
// The widget is automatically disposed upon session shutdown.
return current.content.session.shutdown();
}
} as IFileMenu.ICloseAndCleaner<MainAreaWidget<ITerminal.ITerminal>>);
}

if (palette) {
Expand Down