mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-06 11:35:24 +08:00
fix tooltip keep focus on wrong cell
check that the cell the tooltip is giving focus back is the currently selected cell
This commit is contained in:
parent
a083ce93c1
commit
523ae0c377
@ -160,6 +160,7 @@ var IPython = (function (IPython) {
|
||||
// keep scroll top to be sure to always see the first line
|
||||
this.text.scrollTop(0);
|
||||
this._hidden = true;
|
||||
this.code_mirror = null;
|
||||
}
|
||||
|
||||
Tooltip.prototype.remove_and_cancel_tooltip = function (force) {
|
||||
@ -229,7 +230,7 @@ var IPython = (function (IPython) {
|
||||
ch: 0
|
||||
}, cursor).trim();
|
||||
|
||||
// need a permanent handel to codemirror for future auto recall
|
||||
// need a permanent handel to code_mirror for future auto recall
|
||||
this.code_mirror = editor;
|
||||
|
||||
// now we treat the different number of keypress
|
||||
@ -346,13 +347,16 @@ var IPython = (function (IPython) {
|
||||
this.text.scrollTop(0);
|
||||
}
|
||||
|
||||
// convenient funciton to have the correct codemirror back into focus
|
||||
// convenient funciton to have the correct code_mirror back into focus
|
||||
Tooltip.prototype._cmfocus = function () {
|
||||
var cm = this.code_mirror;
|
||||
if (cm == IPython.notebook.get_selected_cell())
|
||||
{
|
||||
setTimeout(function () {
|
||||
cm.focus();
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
|
||||
IPython.Tooltip = Tooltip;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user