mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
set cell_type properly first-class in the Cell object
- in toJSON - don't clobber existing value in Cell constructor
This commit is contained in:
parent
f420b48aae
commit
9fc9580256
@ -52,7 +52,7 @@ var IPython = (function (IPython) {
|
||||
// same order. Easiest is to create and set to null in parent class.
|
||||
|
||||
this.element = null;
|
||||
this.cell_type = null;
|
||||
this.cell_type = this.cell_type || null;
|
||||
this.code_mirror = null;
|
||||
|
||||
|
||||
@ -201,6 +201,7 @@ var IPython = (function (IPython) {
|
||||
Cell.prototype.toJSON = function () {
|
||||
var data = {};
|
||||
data.metadata = this.metadata;
|
||||
data.cell_type = this.cell_type;
|
||||
return data;
|
||||
};
|
||||
|
||||
|
@ -444,7 +444,6 @@ var IPython = (function (IPython) {
|
||||
CodeCell.prototype.toJSON = function () {
|
||||
var data = IPython.Cell.prototype.toJSON.apply(this);
|
||||
data.input = this.get_text();
|
||||
data.cell_type = 'code';
|
||||
// is finite protect against undefined and '*' value
|
||||
if (isFinite(this.input_prompt_number)) {
|
||||
data.prompt_number = this.input_prompt_number;
|
||||
|
@ -276,7 +276,6 @@ var IPython = (function (IPython) {
|
||||
*/
|
||||
TextCell.prototype.toJSON = function () {
|
||||
var data = IPython.Cell.prototype.toJSON.apply(this);
|
||||
data.cell_type = this.cell_type;
|
||||
data.source = this.get_text();
|
||||
if (data.source == this.placeholder) {
|
||||
data.source = "";
|
||||
@ -357,7 +356,7 @@ var IPython = (function (IPython) {
|
||||
var that = this;
|
||||
this.element.focusout(
|
||||
function() { that.auto_highlight(); }
|
||||
);
|
||||
);
|
||||
};
|
||||
|
||||
RawCell.options_default = {
|
||||
|
Loading…
Reference in New Issue
Block a user