include heading level in JSON

adds level-including to/fromJSON methods to HeadingCell
This commit is contained in:
MinRK 2012-02-28 14:21:05 -08:00
parent 7ad2568d53
commit 8de583a6cd

View File

@ -296,6 +296,21 @@ var IPython = (function (IPython) {
HeadingCell.prototype = new TextCell();
HeadingCell.prototype.fromJSON = function (data) {
if (data.level != undefined){
this.level = data.level;
}
IPython.TextCell.prototype.fromJSON.apply(this, arguments);
};
HeadingCell.prototype.toJSON = function () {
var data = IPython.TextCell.prototype.toJSON.apply(this);
data.level = this.get_level();
return data;
};
HeadingCell.prototype.set_level = function (level) {
this.level = level;
if (this.rendered) {