create new tag
, view all tags

feature description

to provide editting facilities on the preview page

whilst this is not WYSIWYG, it does make it easier to corrolate and correct your source with the generated page because you can see both at the same time. this is a common feature supported by many (most?) other wikis engines.


i'm posting the changes i've made to my local installation in the hope that other people may find them useful.

-- WillNorris - 12 Aug 2004


in order to support editting on the preview page, the following changes need to be made to a skin's preview template:

  1. add a textarea with a name of rawtext
  2. add a preview button

preview.tmpl (add a preview button)

i had a more complete patch here, but twiki ate part of it and the rest of the page (text was chopped at a textarea tag); i'll attach the sample preview template modifications instead

code changes

Index: UI.pm
RCS file: /home/cvs/cvsroot/projects/owiki/system/lib/Owiki/Attic/UI.pm,v
retrieving revision
diff -r1.1.2.5 UI.pm
<     $qc->options(qw(topic skin submitChangeForm dontnotify cmd topicparent formtemplate text));
>     $qc->options(qw(topic skin submitChangeForm dontnotify cmd topicparent formtemplate text rawtext));
>     my $rawText = $qc->{rawtext};
>     if ( $rawText )
>     {
>       # if rawtext, show that in the preview instead of original text
>       # (replacing the original text, it has been editted)
>       $qc->{text} = $rawText;
>     }
>     else
>     {
>       # no rawtext; must be the first time into preview
>       # (or, if this code ends up being (re)used more generally,
>       #      no rawtext field support on this page)
>       $rawText = $qc->{text};
>     }
>     $rawText =~ s/&/&amp\;/go;
>     $rawText =~ s/</&lt\;/go;
>     $rawText =~ s/>/&gt\;/go;
>     $rawText =~ s/\t/   /go;
>     # the raw edit text has to be (close to) the last substitution on the page
>     $tmpl =~ s/%RAWTEXT%/$rawText/;


Topic attachments
I Attachment History Action Size Date Who Comment
Texttxt preview.tmpl.txt r1 manage 1.7 K 2004-08-12 - 19:42 WillNorris modifications for preview template to support editting on same page
Edit | Attach | Watch | Print version | History: r8 < r7 < r6 < r5 < r4 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r8 - 2006-04-29 - SamHasler
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.