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

Make keyboard shortcuts declarative #1234

Merged
merged 4 commits into from Mar 24, 2016

Conversation

5 participants
@Carreau
Member

Carreau commented Mar 20, 2016

look in config for keys.command.unbind, keys.edit.unbind for which shortcuts to unbind,
then keys.command.bind, keys.edit.bind for new shortcut to bind.

Done after feedback at JupyterDays.

Command Palette hover of Shortcut area show the action name as a tooltip so that users know what to bind.

Cleanup Js here and there, and replace (command) in command palette with (command mode) to remove confusion with Cmd keys on Mac.

@minrk minrk added this to the 5.0 milestone Mar 21, 2016

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Mar 21, 2016

Member

A few minor comments, but 👍

Member

minrk commented Mar 21, 2016

A few minor comments, but 👍

@ellisonbg

This comment has been minimized.

Show comment
Hide comment
@ellisonbg

ellisonbg Mar 22, 2016

Contributor

Is this API compatible?

Sent from my iPhone

On Mar 20, 2016, at 3:58 PM, Matthias Bussonnier notifications@github.com wrote:

look in config for keys.command.unbind, keys.edit.unbind for which shortcuts to unbind,
then keys.command.bind, keys.edit.bind for new shortcut to bind.

Done after feedback at JupyterDays.

Command Palette hover of Shortcut area show the action name as a tooltip so that users know what to bind.

Cleanup Js here and there, and replace (command) in command palette with (command mode) to remove confusion with Cmd keys on Mac.

You can view, comment on, or merge this pull request online at:

#1234

Commit Summary

Make keyboard shortcuts declaratives
File Changes

M notebook/static/base/js/keyboard.js (10)
M notebook/static/deprecated-imports.js (2)
M notebook/static/notebook/js/celltoolbarpresets/attachments.js (3)
M notebook/static/notebook/js/celltoolbarpresets/default.js (1)
M notebook/static/notebook/js/celltoolbarpresets/rawcell.js (1)
M notebook/static/notebook/js/celltoolbarpresets/slideshow.js (1)
M notebook/static/notebook/js/commandpalette.js (2)
M notebook/static/notebook/js/keyboardmanager.js (20)
M notebook/static/notebook/js/main.js (4)
M notebook/static/notebook/js/notebook.js (3)
M notebook/static/notebook/js/quickhelp.js (2)
M notebook/static/notebook/less/commandpalette.less (5)
M notebook/static/services/config.js (4)
Patch Links:

https://github.com/jupyter/notebook/pull/1234.patch
https://github.com/jupyter/notebook/pull/1234.diff

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

Contributor

ellisonbg commented Mar 22, 2016

Is this API compatible?

Sent from my iPhone

On Mar 20, 2016, at 3:58 PM, Matthias Bussonnier notifications@github.com wrote:

look in config for keys.command.unbind, keys.edit.unbind for which shortcuts to unbind,
then keys.command.bind, keys.edit.bind for new shortcut to bind.

Done after feedback at JupyterDays.

Command Palette hover of Shortcut area show the action name as a tooltip so that users know what to bind.

Cleanup Js here and there, and replace (command) in command palette with (command mode) to remove confusion with Cmd keys on Mac.

You can view, comment on, or merge this pull request online at:

#1234

Commit Summary

Make keyboard shortcuts declaratives
File Changes

M notebook/static/base/js/keyboard.js (10)
M notebook/static/deprecated-imports.js (2)
M notebook/static/notebook/js/celltoolbarpresets/attachments.js (3)
M notebook/static/notebook/js/celltoolbarpresets/default.js (1)
M notebook/static/notebook/js/celltoolbarpresets/rawcell.js (1)
M notebook/static/notebook/js/celltoolbarpresets/slideshow.js (1)
M notebook/static/notebook/js/commandpalette.js (2)
M notebook/static/notebook/js/keyboardmanager.js (20)
M notebook/static/notebook/js/main.js (4)
M notebook/static/notebook/js/notebook.js (3)
M notebook/static/notebook/js/quickhelp.js (2)
M notebook/static/notebook/less/commandpalette.less (5)
M notebook/static/services/config.js (4)
Patch Links:

https://github.com/jupyter/notebook/pull/1234.patch
https://github.com/jupyter/notebook/pull/1234.diff

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

@Carreau

This comment has been minimized.

Show comment
Hide comment
@Carreau

Carreau Mar 22, 2016

Member

Is this API compatible?

With what ?

Member

Carreau commented Mar 22, 2016

Is this API compatible?

With what ?

@Carreau

This comment has been minimized.

Show comment
Hide comment
@Carreau

Carreau Mar 22, 2016

Member

@willingc added a bit of documentation. Can I get your feedback on it ?

Member

Carreau commented Mar 22, 2016

@willingc added a bit of documentation. Can I get your feedback on it ?

@Carreau

This comment has been minimized.

Show comment
Hide comment
@Carreau

Carreau Mar 22, 2016

Member

Is this API compatible?
With what ?

More especially: it is purely an addition of a config section. It maps what user were doing in their custom.js with a corresponding config entry (we can bikeshed on the name if you like).

There is 0 API deletion, 0 API addition, 0 API modification. Just the provisional (added in the docs) addition of a config section in the docs.

So I'm not sure what your question of API compatibility means.

Member

Carreau commented Mar 22, 2016

Is this API compatible?
With what ?

More especially: it is purely an addition of a config section. It maps what user were doing in their custom.js with a corresponding config entry (we can bikeshed on the name if you like).

There is 0 API deletion, 0 API addition, 0 API modification. Just the provisional (added in the docs) addition of a config section in the docs.

So I'm not sure what your question of API compatibility means.

}
}
edit_unbind.forEach(function(u){that.edit_shortcuts.remove_shortcut(u);});

This comment has been minimized.

@SamLau95

SamLau95 Mar 22, 2016

Contributor

Can this be shorted to:

edit_unbind.forEach(that.edit_shortcuts.remove_shortcut);

?

and for the command_unbind.forEach below.

@SamLau95

SamLau95 Mar 22, 2016

Contributor

Can this be shorted to:

edit_unbind.forEach(that.edit_shortcuts.remove_shortcut);

?

and for the command_unbind.forEach below.

This comment has been minimized.

@Carreau

Carreau Mar 22, 2016

Member

No, I actually tried, and it was calling the prototype in the wrong context, telling me that undefined has no attribute i_dont-remember_what my guess is that forEach will actually .bind(..) the callback to something else.

@Carreau

Carreau Mar 22, 2016

Member

No, I actually tried, and it was calling the prototype in the wrong context, telling me that undefined has no attribute i_dont-remember_what my guess is that forEach will actually .bind(..) the callback to something else.

This comment has been minimized.

@SamLau95

SamLau95 Mar 22, 2016

Contributor

Ah, you're right. I think it's because a function has the scope of the object it was defined on, so by default remove_shortcut has the scope of the edit_shortcuts object.

ES6 gives a very concise way to get around most this problems with arrow functions, but alas, it's not supported by most browsers yet.

@SamLau95

SamLau95 Mar 22, 2016

Contributor

Ah, you're right. I think it's because a function has the scope of the object it was defined on, so by default remove_shortcut has the scope of the edit_shortcuts object.

ES6 gives a very concise way to get around most this problems with arrow functions, but alas, it's not supported by most browsers yet.

This comment has been minimized.

@Carreau

Carreau Mar 22, 2016

Member

Yeah, I know. We could think of using es6 transpiler as now we use webpack.... we might be able to use:

edit_unbind.forEach(that.edit_shortcuts.remove_shortcut, that.edit_shortcuts); but I'm not sure if:

  1. it works,
  2. it's understandable by everyone.

So I'll be in favor of something obvious.

@Carreau

Carreau Mar 22, 2016

Member

Yeah, I know. We could think of using es6 transpiler as now we use webpack.... we might be able to use:

edit_unbind.forEach(that.edit_shortcuts.remove_shortcut, that.edit_shortcuts); but I'm not sure if:

  1. it works,
  2. it's understandable by everyone.

So I'll be in favor of something obvious.

@Carreau

This comment has been minimized.

Show comment
Hide comment
@Carreau

Carreau Mar 23, 2016

Member

All updated.

Member

Carreau commented Mar 23, 2016

All updated.

@minrk minrk merged commit c940237 into jupyter:master Mar 24, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

minrk added a commit that referenced this pull request Mar 24, 2016

Merge pull request #1234 from Carreau:keyb
Make keyboard shortcuts declarative
@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Mar 24, 2016

Member

Thanks!

Member

minrk commented Mar 24, 2016

Thanks!

@willingc

This comment has been minimized.

Show comment
Hide comment
@willingc

willingc Mar 24, 2016

Member

@Carreau Thanks! I'll give a look at the content now that it's merged. Spent yesterday cleaning up the other notebook stuff.

Member

willingc commented Mar 24, 2016

@Carreau Thanks! I'll give a look at the content now that it's merged. Spent yesterday cleaning up the other notebook stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment