From 8de583a6cdfd3abfc22a3dc5b38ec52b5c584f66 Mon Sep 17 00:00:00 2001 From: MinRK Date: Tue, 28 Feb 2012 14:21:05 -0800 Subject: [PATCH] include heading level in JSON adds level-including to/fromJSON methods to HeadingCell --- .../frontend/html/notebook/static/js/textcell.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/IPython/frontend/html/notebook/static/js/textcell.js b/IPython/frontend/html/notebook/static/js/textcell.js index f48f452fa..4ee76b1d1 100644 --- a/IPython/frontend/html/notebook/static/js/textcell.js +++ b/IPython/frontend/html/notebook/static/js/textcell.js @@ -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) {