ok, so we don't want to re-load page content into the form on preview..
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Thu, 16 Mar 2006 21:43:30 +0000 (21:43 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Thu, 16 Mar 2006 21:43:30 +0000 (21:43 +0000)
ikiwiki

diff --git a/ikiwiki b/ikiwiki
index 0463ba15db48d442e94ca972b1d5838a2cab896b..de7c60cc9d20c45fe3fe1a6b09c410f050beea79 100755 (executable)
--- a/ikiwiki
+++ b/ikiwiki
@@ -1079,14 +1079,16 @@ sub cgi_editpage ($$) { #{{{
                        $form->title("creating $page");
                }
                elsif ($form->field("do") eq "edit") {
-                       my $content="";
-                       if (exists $pagesources{lc($page)}) {
-                               $content=readfile("$config{srcdir}/$pagesources{lc($page)}");
-                               $content=~s/\n/\r\n/g;
+                       if (! length $form->field('content')) {
+                               my $content="";
+                               if (exists $pagesources{lc($page)}) {
+                                               $content=readfile("$config{srcdir}/$pagesources{lc($page)}");
+                                       $content=~s/\n/\r\n/g;
+                               }
+                               $form->field(name => "content", value => $content,
+                                       force => 1);
                        }
                        $form->tmpl_param("page_select", 0);
-                       $form->field(name => "content", value => $content,
-                               force => 1);
                        $form->field(name => "page", type => 'hidden');
                        $form->title("editing $page");
                }