##// END OF EJS Templates
Move todos into set_rendered
Jonathan Frederic -
Show More
@@ -245,7 +245,9 b' var IPython = (function (IPython) {'
245 * @method set_rendered
245 * @method set_rendered
246 */
246 */
247 TextCell.prototype.set_rendered = function(text) {
247 TextCell.prototype.set_rendered = function(text) {
248 this.element.find('div.text_cell_render').text(text);
248 // TODO: This HTML needs to be treated as potentially dangerous
249 // user input.
250 this.element.find('div.text_cell_render').html(text);
249 };
251 };
250
252
251 /**
253 /**
@@ -353,17 +355,12 b' var IPython = (function (IPython) {'
353 // Links in markdown cells should open in new tabs.
355 // Links in markdown cells should open in new tabs.
354 html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
356 html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
355 try {
357 try {
356 // TODO: This HTML needs to be treated as potentially dangerous
358 this.set_rendered(html);
357 // user input.
358 rendered.html(html);
359 } catch (e) {
359 } catch (e) {
360 console.log("Error running Javascript in Markdown:");
360 console.log("Error running Javascript in Markdown:");
361 console.log(e);
361 console.log(e);
362 rendered.empty();
362 this.set_rendered($("<div/>").addClass("js-error").html(
363 rendered.append(
363 "Error rendering Markdown!<br/>" + e.toString())
364 $("<div/>")
365 .append($("<div/>").text('Error rendering Markdown!').addClass("js-error"))
366 .append($("<div/>").text(e.toString()).addClass("js-error"))
367 );
364 );
368 }
365 }
369 this.element.find('div.text_cell_input').hide();
366 this.element.find('div.text_cell_input').hide();
@@ -509,6 +506,13 b' var IPython = (function (IPython) {'
509 };
506 };
510
507
511
508
509 HeadingCell.prototype.set_rendered = function (html) {
510 // TODO: This HTML needs to be treated as potentially dangerous
511 // user input.
512 this.element.find("div.text_cell_render").html(html);
513 };
514
515
512 HeadingCell.prototype.get_rendered = function () {
516 HeadingCell.prototype.get_rendered = function () {
513 var r = this.element.find("div.text_cell_render");
517 var r = this.element.find("div.text_cell_render");
514 return r.children().first().html();
518 return r.children().first().html();
@@ -538,13 +542,11 b' var IPython = (function (IPython) {'
538 .attr('href', '#' + hash)
542 .attr('href', '#' + hash)
539 .text('¶')
543 .text('¶')
540 );
544 );
541 // TODO: This HTML needs to be treated as potentially dangerous
545
542 // user input.
546 this.set_rendered(h);
543 var rendered = this.element.find("div.text_cell_render");
544 rendered.html(h);
545 this.typeset();
547 this.typeset();
546 this.element.find('div.text_cell_input').hide();
548 this.element.find('div.text_cell_input').hide();
547 rendered.show();
549 this.element.find("div.text_cell_render").show();
548
550
549 };
551 };
550 return cont;
552 return cont;
General Comments 0
You need to be logged in to leave comments. Login now