--- loncom/homework/edit.pm	2003/10/24 21:09:24	1.68
+++ loncom/homework/edit.pm	2003/10/30 20:52:54	1.70
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # edit mode helpers
 #
-# $Id: edit.pm,v 1.68 2003/10/24 21:09:24 albertel Exp $
+# $Id: edit.pm,v 1.70 2003/10/30 20:52:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -273,6 +273,11 @@ sub handle_insertafter {
     return $result;
 }
 
+sub insert_img {
+    return '
+    <img />';
+}
+
 sub insert_responseparam {
     return '
     <responseparam />';
@@ -477,7 +482,7 @@ sub editfield {
 }
 
 sub modifiedfield {
-    my ($token) = @_;
+    my ($endtag,$parser) = @_;
     my $result;
 #  foreach my $envkey (sort keys %ENV) {
 #    &Apache::lonxml::debug("$envkey ---- $ENV{$envkey}");
@@ -485,6 +490,9 @@ sub modifiedfield {
 #  &Apache::lonxml::debug("I want homework_edit_$Apache::lonxml::curdepth");
 #  &Apache::lonxml::debug($ENV{"form.homework_edit_$Apache::lonxml::curdepth"});
     $result=$ENV{"form.homework_edit_$Apache::lonxml::curdepth"};
+    my $bodytext=&Apache::lonxml::get_all_text($endtag,$parser);
+    # textareas throw away intial \n 
+    if ($bodytext=~/^\n/) { $result="\n".$result; }
     return $result;
 }