diff --git a/IPython/frontend/html/notebook/static/js/cell.js b/IPython/frontend/html/notebook/static/js/cell.js
index 2667ec0a2..2bf2e7176 100644
--- a/IPython/frontend/html/notebook/static/js/cell.js
+++ b/IPython/frontend/html/notebook/static/js/cell.js
@@ -30,18 +30,8 @@ var IPython = (function (IPython) {
this.cell_id = utils.uuid();
};
-
- Cell.prototype.select = function () {
- this.element.addClass('ui-widget-content ui-corner-all');
- this.selected = true;
- };
-
-
- Cell.prototype.unselect = function () {
- this.element.removeClass('ui-widget-content ui-corner-all');
- this.selected = false;
- };
-
+ // Subclasses must implement create_element.
+ Cell.prototype.create_element = function () {};
Cell.prototype.bind_events = function () {
var that = this;
@@ -58,6 +48,55 @@ var IPython = (function (IPython) {
});
};
+ // typeset with MathJax if MathJax is available
+ Cell.prototype.typeset = function () {
+ if (window.MathJax){
+ MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
+ }
+ };
+
+
+ Cell.prototype.select = function () {
+ this.element.addClass('ui-widget-content ui-corner-all');
+ this.selected = true;
+ };
+
+
+ Cell.prototype.unselect = function () {
+ this.element.removeClass('ui-widget-content ui-corner-all');
+ this.selected = false;
+ };
+
+
+ Cell.prototype.get_text = function () {
+ };
+
+
+ Cell.prototype.set_text = function (text) {
+ };
+
+
+ Cell.prototype.refresh = function () {
+ this.code_mirror.refresh();
+ };
+
+
+ Cell.prototype.edit = function () {
+ };
+
+
+ Cell.prototype.render = function () {
+ };
+
+
+ Cell.prototype.toJSON = function () {
+ };
+
+
+ Cell.prototype.fromJSON = function (data) {
+ };
+
+
Cell.prototype.grow = function(element) {
// Grow the cell by hand. This is used upon reloading from JSON, when the
// autogrow handler is not called.
@@ -85,16 +124,6 @@ var IPython = (function (IPython) {
}
};
- // Subclasses must implement create_element.
- Cell.prototype.create_element = function () {};
-
- // typeset with MathJax if MathJax is available
- Cell.prototype.typeset = function () {
- if (window.MathJax){
- MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
- }
- };
-
IPython.Cell = Cell;
return IPython;
diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js
index 35c87961c..ad4c7977b 100644
--- a/IPython/frontend/html/notebook/static/js/codecell.js
+++ b/IPython/frontend/html/notebook/static/js/codecell.js
@@ -754,12 +754,12 @@ var IPython = (function (IPython) {
};
- CodeCell.prototype.get_code = function () {
+ CodeCell.prototype.get_text = function () {
return this.code_mirror.getValue();
};
- CodeCell.prototype.set_code = function (code) {
+ CodeCell.prototype.set_text = function (code) {
return this.code_mirror.setValue(code);
};
@@ -787,7 +787,7 @@ var IPython = (function (IPython) {
CodeCell.prototype.fromJSON = function (data) {
if (data.cell_type === 'code') {
if (data.input !== undefined) {
- this.set_code(data.input);
+ this.set_text(data.input);
}
if (data.prompt_number !== undefined) {
this.set_input_prompt(data.prompt_number);
@@ -809,7 +809,7 @@ var IPython = (function (IPython) {
CodeCell.prototype.toJSON = function () {
var data = {};
- data.input = this.get_code();
+ data.input = this.get_text();
data.cell_type = 'code';
if (this.input_prompt_number !== ' ') {
data.prompt_number = this.input_prompt_number;
diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js
index c61574a6d..5939cac2b 100644
--- a/IPython/frontend/html/notebook/static/js/notebook.js
+++ b/IPython/frontend/html/notebook/static/js/notebook.js
@@ -516,11 +516,11 @@ var IPython = (function (IPython) {
source_cell instanceof IPython.MarkdownCell) {
this.insert_code_cell_below(i);
var target_cell = this.cells()[i+1];
- var text = source_cell.get_source();
+ var text = source_cell.get_text();
if (text === source_cell.placeholder) {
text = '';
}
- target_cell.set_code(text);
+ target_cell.set_text(text);
source_element.remove();
target_cell.select();
};
@@ -537,20 +537,20 @@ var IPython = (function (IPython) {
if (source_cell instanceof IPython.CodeCell) {
this.insert_markdown_cell_below(i);
target_cell = this.cells()[i+1];
- var text = source_cell.get_code();
+ var text = source_cell.get_text();
} else if (source_cell instanceof IPython.HTMLCell) {
this.insert_markdown_cell_below(i);
target_cell = this.cells()[i+1];
- var text = source_cell.get_source();
+ var text = source_cell.get_text();
if (text === source_cell.placeholder) {
text = target_cell.placeholder;
}
}
if (target_cell !== null) {
if (text === "") {text = target_cell.placeholder;};
- // The edit must come before the set_source.
+ // The edit must come before the set_text.
target_cell.edit();
- target_cell.set_source(text);
+ target_cell.set_text(text);
source_element.remove();
target_cell.select();
}
@@ -567,18 +567,18 @@ var IPython = (function (IPython) {
if (source_cell instanceof IPython.CodeCell) {
this.insert_html_cell_below(i);
target_cell = this.cells()[i+1];
- var text = source_cell.get_code();
+ var text = source_cell.get_text();
} else if (source_cell instanceof IPython.MarkdownCell) {
this.insert_html_cell_below(i);
target_cell = this.cells()[i+1];
- var text = source_cell.get_source();
+ var text = source_cell.get_text();
if (text === source_cell.placeholder) {
text = target_cell.placeholder;
}
}
if (target_cell !== null) {
if (text === "") {text = target_cell.placeholder;};
- target_cell.set_source(text);
+ target_cell.set_text(text);
source_element.remove();
target_cell.edit();
}
@@ -689,9 +689,9 @@ var IPython = (function (IPython) {
var textb = cell.code_mirror.getRange(cursor, end);
texta = texta.replace(/^\n+/, '').replace(/\n+$/, '');
textb = textb.replace(/^\n+/, '').replace(/\n+$/, '');
- cell.set_code(texta);
+ cell.set_text(texta);
var new_cell = this.insert_code_cell_below();
- new_cell.set_code(textb);
+ new_cell.set_text(textb);
};
};
@@ -704,9 +704,9 @@ var IPython = (function (IPython) {
upper_cell = this.cells()[index-1];
lower_cell = this.cells()[index];
if (upper_cell instanceof IPython.CodeCell && lower_cell instanceof IPython.CodeCell) {
- upper_text = upper_cell.get_code();
- lower_text = lower_cell.get_code();
- lower_cell.set_code(upper_text+'\n'+lower_text);
+ upper_text = upper_cell.get_text();
+ lower_text = lower_cell.get_text();
+ lower_cell.set_text(upper_text+'\n'+lower_text);
this.delete_cell(index-1);
};
};
@@ -721,9 +721,9 @@ var IPython = (function (IPython) {
upper_cell = this.cells()[index];
lower_cell = this.cells()[index+1];
if (upper_cell instanceof IPython.CodeCell && lower_cell instanceof IPython.CodeCell) {
- upper_text = upper_cell.get_code();
- lower_text = lower_cell.get_code();
- upper_cell.set_code(upper_text+'\n'+lower_text);
+ upper_text = upper_cell.get_text();
+ lower_text = lower_cell.get_text();
+ upper_cell.set_text(upper_text+'\n'+lower_text);
this.delete_cell(index+1);
};
};
@@ -875,7 +875,7 @@ var IPython = (function (IPython) {
} else if (payload[i].source === 'IPython.zmq.zmqshell.ZMQInteractiveShell.set_next_input') {
var index = this.find_cell_index(cell);
var new_cell = this.insert_code_cell_below(index);
- new_cell.set_code(payload[i].text);
+ new_cell.set_text(payload[i].text);
this.dirty = true;
}
};
@@ -1000,8 +1000,8 @@ var IPython = (function (IPython) {
cell.clear_output(true, true, true);
cell.set_input_prompt('*');
cell.element.addClass("running");
- var code = cell.get_code();
- var msg_id = that.kernel.execute(cell.get_code());
+ var code = cell.get_text();
+ var msg_id = that.kernel.execute(cell.get_text());
that.msg_cell_map[msg_id] = cell.cell_id;
} else if (cell instanceof IPython.HTMLCell) {
cell.render();
diff --git a/IPython/frontend/html/notebook/static/js/textcell.js b/IPython/frontend/html/notebook/static/js/textcell.js
index 382f1e29d..d8403342e 100644
--- a/IPython/frontend/html/notebook/static/js/textcell.js
+++ b/IPython/frontend/html/notebook/static/js/textcell.js
@@ -99,8 +99,8 @@ var IPython = (function (IPython) {
this.code_mirror.focus();
that.code_mirror.refresh();
this.rendered = false;
- if (this.get_source() === this.placeholder) {
- this.set_source('');
+ if (this.get_text() === this.placeholder) {
+ this.set_text('');
}
}
};
@@ -120,12 +120,12 @@ var IPython = (function (IPython) {
};
- TextCell.prototype.get_source = function() {
+ TextCell.prototype.get_text = function() {
return this.code_mirror.getValue();
};
- TextCell.prototype.set_source = function(text) {
+ TextCell.prototype.set_text = function(text) {
this.code_mirror.setValue(text);
this.code_mirror.refresh();
};
@@ -162,7 +162,7 @@ var IPython = (function (IPython) {
TextCell.prototype.fromJSON = function (data) {
if (data.cell_type === this.cell_type) {
if (data.source !== undefined) {
- this.set_source(data.source);
+ this.set_text(data.source);
this.set_rendered(data.rendered || '');
this.rendered = false;
this.render();
@@ -174,7 +174,7 @@ var IPython = (function (IPython) {
TextCell.prototype.toJSON = function () {
var data = {};
data.cell_type = this.cell_type;
- data.source = this.get_source();
+ data.source = this.get_text();
return data;
};
@@ -193,7 +193,7 @@ var IPython = (function (IPython) {
HTMLCell.prototype.render = function () {
if (this.rendered === false) {
- var text = this.get_source();
+ var text = this.get_text();
if (text === "") { text = this.placeholder; }
this.set_rendered(text);
this.typeset();
@@ -218,7 +218,7 @@ var IPython = (function (IPython) {
MarkdownCell.prototype.render = function () {
if (this.rendered === false) {
- var text = this.get_source();
+ var text = this.get_text();
if (text === "") { text = this.placeholder; }
var html = IPython.markdown_converter.makeHtml(text);
this.set_rendered(html);
@@ -256,7 +256,7 @@ var IPython = (function (IPython) {
RSTCell.prototype.render = function () {
if (this.rendered === false) {
- var text = this.get_source();
+ var text = this.get_text();
if (text === "") { text = this.placeholder; }
var settings = {
processData : false,