##// END OF EJS Templates
Adding new HeadingCell.
Brian Granger -
Show More
@@ -286,6 +286,44 b' var IPython = (function (IPython) {'
286 286 };
287 287
288 288
289 // HTMLCell
290
291 var HeadingCell = function (notebook) {
292 this.placeholder = "Type Heading Here";
293 IPython.TextCell.apply(this, arguments);
294 this.cell_type = 'heading';
295 this.level = 1;
296 };
297
298
299 HeadingCell.prototype = new TextCell();
300
301
302 HeadingCell.prototype.set_rendered = function (text) {
303 var r = this.element.find("div.text_cell_render");
304 r.empty();
305 r.append($('<h1/>').html(text));
306 }
307
308
309 HeadingCell.prototype.get_rendered = function () {
310 var r = this.element.find("div.text_cell_render");
311 return r.children().first().html();
312 }
313
314
315 HeadingCell.prototype.render = function () {
316 if (this.rendered === false) {
317 var text = this.get_text();
318 if (text === "") { text = this.placeholder; }
319 this.set_rendered(text);
320 this.typeset();
321 this.element.find('div.text_cell_input').hide();
322 this.element.find("div.text_cell_render").show();
323 this.rendered = true;
324 }
325 };
326
289 327 IPython.TextCell = TextCell;
290 328 IPython.HTMLCell = HTMLCell;
291 329 IPython.MarkdownCell = MarkdownCell;
General Comments 0
You need to be logged in to leave comments. Login now