Making Notebook.set_dirty an event so CodeCell can set it.

This allows code outside notebook.js to set the dirty flag, but
doesn't require that code depend on notebook.js.
This commit is contained in:
Brian Granger 2012-05-31 13:29:22 -07:00
parent 9826a17ae2
commit 4c31453ea7
2 changed files with 5 additions and 1 deletions

View File

@ -170,7 +170,7 @@ var IPython = (function (IPython) {
CodeCell.prototype._handle_execute_reply = function (content) {
this.set_input_prompt(content.execution_count);
this.element.removeClass("running");
// this.dirty = true;
$([IPython.events]).trigger('set_dirty.Notebook', {'value': true});
}
CodeCell.prototype._handle_set_next_input = function (text) {

View File

@ -68,6 +68,10 @@ var IPython = (function (IPython) {
that.dirty = true;
});
$([IPython.events]).on('set_dirty.Notebook', function (event, data) {
that.dirty = data.value;
});
$([IPython.events]).on('select.Cell', function (event, data) {
var index = that.find_cell_index(data.cell);
that.select(index);