# HG changeset patch # User Atul Varma # Date 1233521155 28800 # Node ID dd457cc7c59699d175d2ab80c12243bf8741623f # Parent 2e5a6f077df2b05ec8c5ed00665eac430b9cbb0b Improved setting of size of textarea. diff -r 2e5a6f077df2 -r dd457cc7c596 wiki.css --- a/wiki.css Sun Feb 01 12:17:08 2009 -0800 +++ b/wiki.css Sun Feb 01 12:45:55 2009 -0800 @@ -15,4 +15,5 @@ courier new, monospace; font-size: 10pt; width: 640px; + overflow: hidden; } diff -r 2e5a6f077df2 -r dd457cc7c596 wiki.html --- a/wiki.html Sun Feb 01 12:17:08 2009 -0800 +++ b/wiki.html Sun Feb 01 12:45:55 2009 -0800 @@ -11,6 +11,7 @@

Yo.

Hi there dude.
+
I am gud.
diff -r 2e5a6f077df2 -r dd457cc7c596 wiki.js --- a/wiki.js Sun Feb 01 12:17:08 2009 -0800 +++ b/wiki.js Sun Feb 01 12:45:55 2009 -0800 @@ -1,18 +1,25 @@ function makeEditable() { var item = this; var newItem = $(''); - console.log($(item).height()); - $(newItem).css({height: $(item).height()}); $(newItem).attr("value", $(item).html()); + + function setScrollHeight() { + var scrollHeight = $(newItem).get(0).scrollHeight; + $(newItem).height(scrollHeight); + } + $(newItem).blur( function() { var html = $(newItem).attr("value"); - console.log(html); $(item).html(html); $(item).click(makeEditable); $(newItem).replaceWith(item); }); + + $(newItem).keyup(setScrollHeight); $(item).replaceWith(newItem); + setScrollHeight(); + $(newItem).focus(); }