From cd381814387c94457b0ee6046816cc52758160ba Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Sun, 9 Mar 2014 11:41:25 -0700 Subject: [PATCH 1/3] remove raw cell placeholder on focus, closes #5238 --- IPython/html/static/notebook/js/textcell.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index 4eab761dc..f44affc4a 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -390,6 +390,8 @@ var IPython = (function (IPython) { this.element.focusout(function() { that.auto_highlight(); }); + + this.code_mirror.on('focus', function() { that.unrender(); }); }; /** @@ -402,13 +404,13 @@ 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); } - var text = this.get_text(); - if (text === "") { text = this.placeholder; } - this.set_text(text); + return cont; }; From 37852baa6da461231a982dbc33ca29f2a3e902ec Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Wed, 19 Mar 2014 10:37:59 -0700 Subject: [PATCH 2/3] render on focus out, always pad raw cells --- IPython/html/static/notebook/js/textcell.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index f44affc4a..8dc1d5522 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -389,6 +389,7 @@ var IPython = (function (IPython) { var that = this; this.element.focusout(function() { that.auto_highlight(); + that.render(); }); this.code_mirror.on('focus', function() { that.unrender(); }); @@ -409,6 +410,7 @@ var IPython = (function (IPython) { var text = this.get_text(); if (text === "") { text = this.placeholder; } this.set_text(text); + this.element.removeClass('rendered'); } return cont; }; From 2e4036fd4f14783bb403f82b39d64e6a84ba6387 Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Wed, 19 Mar 2014 10:42:11 -0700 Subject: [PATCH 3/3] raw cell placeholder text as one line --- IPython/html/static/notebook/js/textcell.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/html/static/notebook/js/textcell.js b/IPython/html/static/notebook/js/textcell.js index 8dc1d5522..e57d99094 100644 --- a/IPython/html/static/notebook/js/textcell.js +++ b/IPython/html/static/notebook/js/textcell.js @@ -376,8 +376,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." };