From 927f44b9af5837b82bca550a8265baff19b15341 2011-07-21 03:42:31
From: Brian Granger <ellisonbg@gmail.com>
Date: 2011-07-21 03:42:31
Subject: [PATCH] Added placeholder text for TextCell.

---

diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js
index d8abd40..8396834 100644
--- a/IPython/frontend/html/notebook/static/js/notebook.js
+++ b/IPython/frontend/html/notebook/static/js/notebook.js
@@ -281,6 +281,7 @@ Notebook.prototype.code_to_text = function (index) {
         this.insert_text_cell_after(i);
         var target_cell = this.cells()[i+1];
         var text = source_element.find("textarea.input_area").val();
+        if (text === "") {text = target_cell.placeholder;};
         target_cell.element.find("textarea.text_cell_input").val(text);
         target_cell.element.find("textarea.text_cell_input").html(text);
         target_cell.element.find("div.text_cell_render").html(text);
@@ -430,6 +431,7 @@ CodeCell.prototype.set_output_prompt = function (number) {
 
 var TextCell = function (notebook) {
     Cell.apply(this, arguments);
+    this.placeholder = "Type <strong>HTML</strong> and LaTeX: $\\alpha^2$"
 };
 
 
@@ -437,9 +439,9 @@ TextCell.prototype = new Cell();
 
 
 TextCell.prototype.create_element = function () {
-    var cell = $('<div></div').addClass('cell text_cell').
+    var cell = $("<div>").addClass('cell text_cell').
                append(
-                   $('<textarea>Type HTML/LaTex content here</textarea>').
+                   $("<textarea>" + this.placeholder + "</textarea>").
                    addClass('text_cell_input').
                    attr('rows',1).
                    attr('cols',80).