Show More
@@ -381,7 +381,7 b' define(function(require){' | |||||
381 | if(event){ |
|
381 | if(event){ | |
382 | event.preventDefault(); |
|
382 | event.preventDefault(); | |
383 | } |
|
383 | } | |
384 |
env.notebook. |
|
384 | env.notebook.ensure_focused(); | |
385 | return false; |
|
385 | return false; | |
386 | } |
|
386 | } | |
387 | }, |
|
387 | }, |
@@ -376,6 +376,12 b' define([' | |||||
376 | } |
|
376 | } | |
377 | }; |
|
377 | }; | |
378 |
|
378 | |||
|
379 | Cell.prototype.ensure_focused = function() { | |||
|
380 | if(this.element !== document.activeElement && !this.code_mirror.hasFocus()){ | |||
|
381 | this.focus_cell(); | |||
|
382 | } | |||
|
383 | } | |||
|
384 | ||||
379 | /** |
|
385 | /** | |
380 | * Focus the cell in the DOM sense |
|
386 | * Focus the cell in the DOM sense | |
381 | * @method focus_cell |
|
387 | * @method focus_cell |
@@ -697,6 +697,16 b' define(function (require) {' | |||||
697 | }; |
|
697 | }; | |
698 |
|
698 | |||
699 | /** |
|
699 | /** | |
|
700 | * Ensure either cell, or codemirror is focused. Is none | |||
|
701 | * is focused, focus the cell. | |||
|
702 | */ | |||
|
703 | Notebook.prototype.ensure_focused = function(){ | |||
|
704 | var cell = this.get_selected_cell(); | |||
|
705 | if (cell === null) {return;} // No cell is selected | |||
|
706 | cell.ensure_focused(); | |||
|
707 | } | |||
|
708 | ||||
|
709 | /** | |||
700 | * Focus the currently selected cell. |
|
710 | * Focus the currently selected cell. | |
701 | */ |
|
711 | */ | |
702 | Notebook.prototype.focus_cell = function () { |
|
712 | Notebook.prototype.focus_cell = function () { |
General Comments 0
You need to be logged in to leave comments.
Login now