mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Prevent errors when up/down arrows are pressed in an empty notebook.
Notebook.get_selected_cell() returns `null` in an empty notebook.
This commit is contained in:
parent
a8873230bf
commit
904be21a9f
@ -137,13 +137,13 @@ var IPython = (function (IPython) {
|
||||
}
|
||||
if (event.which === key.UPARROW && !event.shiftKey) {
|
||||
var cell = that.get_selected_cell();
|
||||
if (cell.at_top()) {
|
||||
if (cell && cell.at_top()) {
|
||||
event.preventDefault();
|
||||
that.select_prev();
|
||||
};
|
||||
} else if (event.which === key.DOWNARROW && !event.shiftKey) {
|
||||
var cell = that.get_selected_cell();
|
||||
if (cell.at_bottom()) {
|
||||
if (cell && cell.at_bottom()) {
|
||||
event.preventDefault();
|
||||
that.select_next();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user