Merge pull request #6416 from Carreau/foobarcode

Unify Text/CodeCell code.
This commit is contained in:
Min RK 2014-10-09 15:00:15 -07:00
commit 63a7969123
3 changed files with 11 additions and 26 deletions

View File

@ -157,6 +157,16 @@ define([
that.events.trigger('command_mode.Cell', {cell: that});
});
}
this.element.dblclick(function () {
if (that.selected === false) {
this.events.trigger('select.Cell', {'cell':that});
}
var cont = that.unrender();
if (cont) {
that.focus_editor();
}
});
};
/**

View File

@ -288,6 +288,7 @@ define([
delete CodeCell.msg_cells[old_msg_id];
}
CodeCell.msg_cells[this.last_msg_id] = this;
this.render();
};
/**
@ -360,11 +361,6 @@ define([
return cont;
};
CodeCell.prototype.unrender = function () {
// CodeCell is always rendered
return false;
};
CodeCell.prototype.select_all = function () {
var start = {line: 0, ch: 0};
var nlines = this.code_mirror.lineCount();

View File

@ -92,27 +92,6 @@ define([
};
/**
* Bind the DOM evet to cell actions
* Need to be called after TextCell.create_element
* @private
* @method bind_event
*/
TextCell.prototype.bind_events = function () {
Cell.prototype.bind_events.apply(this);
var that = this;
this.element.dblclick(function () {
if (that.selected === false) {
this.events.trigger('select.Cell', {'cell':that});
}
var cont = that.unrender();
if (cont) {
that.focus_editor();
}
});
};
// Cell level actions
TextCell.prototype.select = function () {