Fix raw_input.

This commit is contained in:
Brian E. Granger 2014-01-07 15:21:22 -08:00
parent 1d9aa63500
commit a07eabe7c5
2 changed files with 18 additions and 4 deletions

View File

@ -588,7 +588,14 @@ var IPython = (function (IPython) {
e.on('focusout', function () {
that.command_mode();
that.enable();
})
});
// There are times (raw_input) where we remove the element from the DOM before
// focusout is called. In this case we bind to the remove event of jQueryUI,
// which gets triggered upon removal.
e.on('remove', function () {
that.command_mode();
that.enable();
});
}

View File

@ -648,11 +648,18 @@ var IPython = (function (IPython) {
})
)
);
this.element.append(area);
// weirdly need double-focus now,
// otherwise only the cell will be focused
area.find("input.raw_input").focus().focus();
var raw_input = area.find('input.raw_input');
// Register events that enable/disable the keyboard manager while raw
// input is focused.
IPython.keyboard_manager.register_events(raw_input);
// Note, the following line used to read raw_input.focus().focus().
// This seemed to be needed otherwise only the cell would be focused.
// But with the modal UI, this seems to work fine with one call to focus().
raw_input.focus();
}
OutputArea.prototype._submit_raw_input = function (evt) {
var container = this.element.find("div.raw_input");
var theprompt = container.find("span.input_prompt");