mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-27 04:20:22 +08:00
Only call CM.focus() if CM is not already focused.
This commit is contained in:
parent
fa0d5b2f1a
commit
5f4d4017c1
@ -288,8 +288,16 @@ var IPython = (function (IPython) {
|
||||
* @method focus_editor
|
||||
*/
|
||||
Cell.prototype.focus_editor = function () {
|
||||
var that = this;
|
||||
this.refresh();
|
||||
this.code_mirror.focus();
|
||||
// Only focus the CM editor if it is not focused already. This prevents jumps
|
||||
// related to the previous prompt position.
|
||||
setTimeout(function () {
|
||||
var isf = IPython.utils.is_focused;
|
||||
if (!isf(that.element.find('div.CodeMirror'))) {
|
||||
this.code_mirror.focus();
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user