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 | }, |
@@ -375,6 +375,12 b' define([' | |||||
375 | return false; |
|
375 | return false; | |
376 | } |
|
376 | } | |
377 | }; |
|
377 | }; | |
|
378 | ||||
|
379 | Cell.prototype.ensure_focused = function() { | |||
|
380 | if(this.element !== document.activeElement && !this.code_mirror.hasFocus()){ | |||
|
381 | this.focus_cell(); | |||
|
382 | } | |||
|
383 | } | |||
378 |
|
384 | |||
379 | /** |
|
385 | /** | |
380 | * Focus the cell in the DOM sense |
|
386 | * Focus the cell in the DOM sense |
@@ -695,6 +695,16 b' define(function (require) {' | |||||
695 | cell.focus_editor(); |
|
695 | cell.focus_editor(); | |
696 | } |
|
696 | } | |
697 | }; |
|
697 | }; | |
|
698 | ||||
|
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 | } | |||
698 |
|
708 | |||
699 | /** |
|
709 | /** | |
700 | * Focus the currently selected cell. |
|
710 | * Focus the currently selected cell. |
General Comments 0
You need to be logged in to leave comments.
Login now