From 808ea6313e888e55f38248dcc9f7d83bc4c26f17 2014-03-19 19:21:03 From: Min RK Date: 2014-03-19 19:21:03 Subject: [PATCH] Merge pull request #5310 from ivanov/fix-5238 remove raw cell placeholder on focus, closes #5238 --- diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index 6bd13fb..3daad41 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -281,8 +281,8 @@ var IPython = (function (IPython) { }; RawCell.options_default = { - placeholder : "Write raw LaTeX or other formats here, for use with nbconvert.\n" + - "It will not be rendered in the notebook.\n" + + placeholder : "Write raw LaTeX or other formats here, for use with nbconvert. " + + "It will not be rendered in the notebook. " + "When passing through nbconvert, a Raw Cell's content is added to the output unmodified." }; @@ -294,7 +294,10 @@ var IPython = (function (IPython) { var that = this; this.element.focusout(function() { that.auto_highlight(); + that.render(); }); + + this.code_mirror.on('focus', function() { that.unrender(); }); }; /** @@ -307,13 +310,14 @@ var IPython = (function (IPython) { /** @method render **/ RawCell.prototype.render = function () { - // Make sure that this cell type can never be rendered - if (this.rendered) { - this.unrender(); + var cont = IPython.TextCell.prototype.render.apply(this); + if (cont){ + var text = this.get_text(); + if (text === "") { text = this.placeholder; } + this.set_text(text); + this.element.removeClass('rendered'); } - var text = this.get_text(); - if (text === "") { text = this.placeholder; } - this.set_text(text); + return cont; };