mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +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.
|
// same order. Easiest is to create and set to null in parent class.
|
||||||
|
|
||||||
this.element = null;
|
this.element = null;
|
||||||
this.cell_type = null;
|
this.cell_type = this.cell_type || null;
|
||||||
this.code_mirror = null;
|
this.code_mirror = null;
|
||||||
|
|
||||||
|
|
||||||
@ -201,6 +201,7 @@ var IPython = (function (IPython) {
|
|||||||
Cell.prototype.toJSON = function () {
|
Cell.prototype.toJSON = function () {
|
||||||
var data = {};
|
var data = {};
|
||||||
data.metadata = this.metadata;
|
data.metadata = this.metadata;
|
||||||
|
data.cell_type = this.cell_type;
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -444,7 +444,6 @@ var IPython = (function (IPython) {
|
|||||||
CodeCell.prototype.toJSON = function () {
|
CodeCell.prototype.toJSON = function () {
|
||||||
var data = IPython.Cell.prototype.toJSON.apply(this);
|
var data = IPython.Cell.prototype.toJSON.apply(this);
|
||||||
data.input = this.get_text();
|
data.input = this.get_text();
|
||||||
data.cell_type = 'code';
|
|
||||||
// is finite protect against undefined and '*' value
|
// is finite protect against undefined and '*' value
|
||||||
if (isFinite(this.input_prompt_number)) {
|
if (isFinite(this.input_prompt_number)) {
|
||||||
data.prompt_number = this.input_prompt_number;
|
data.prompt_number = this.input_prompt_number;
|
||||||
|
@ -276,7 +276,6 @@ var IPython = (function (IPython) {
|
|||||||
*/
|
*/
|
||||||
TextCell.prototype.toJSON = function () {
|
TextCell.prototype.toJSON = function () {
|
||||||
var data = IPython.Cell.prototype.toJSON.apply(this);
|
var data = IPython.Cell.prototype.toJSON.apply(this);
|
||||||
data.cell_type = this.cell_type;
|
|
||||||
data.source = this.get_text();
|
data.source = this.get_text();
|
||||||
if (data.source == this.placeholder) {
|
if (data.source == this.placeholder) {
|
||||||
data.source = "";
|
data.source = "";
|
||||||
@ -357,7 +356,7 @@ var IPython = (function (IPython) {
|
|||||||
var that = this;
|
var that = this;
|
||||||
this.element.focusout(
|
this.element.focusout(
|
||||||
function() { that.auto_highlight(); }
|
function() { that.auto_highlight(); }
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
RawCell.options_default = {
|
RawCell.options_default = {
|
||||||
|
Loading…
Reference in New Issue
Block a user