Skip to content

Commit

Permalink
Merge pull request ipython#5310 from ivanov/fix-5238
Browse files Browse the repository at this point in the history
remove raw cell placeholder on focus, closes ipython#5238
  • Loading branch information
minrk committed Mar 19, 2014
2 parents fee57f7 + 793ae35 commit c693140
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions IPython/html/static/notebook/js/textcell.js
Original file line number Diff line number Diff line change
Expand Up @@ -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."
};

Expand All @@ -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(); });
};

/**
Expand All @@ -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;
};


Expand Down

0 comments on commit c693140

Please sign in to comment.