Skip to content

Commit

Permalink
Merge pull request #6447 from ian-r-rose/audit-accel
Browse files Browse the repository at this point in the history
Audit accel
  • Loading branch information
jasongrout committed Jun 1, 2019
2 parents 1612332 + 54b8041 commit 85c872e
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 32 deletions.
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

0 comments on commit 85c872e

Please sign in to comment.