r8 - 29 Apr 2006 - 13:40:43 - SamHaslerYou are here: TWiki >  Codev Web > TWikiVsOtherProducts > TikiWiki > TWikiAndTikiUserExperiences > EditOnPreviewPage
Tags:
, create new tag

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.

implementation

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

templates

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 1.1.2.5
diff -r1.1.2.5 UI.pm
2969c2969
<     $qc->options(qw(topic skin submitChangeForm dontnotify cmd topicparent formtemplate text));
---
>     $qc->options(qw(topic skin submitChangeForm dontnotify cmd topicparent formtemplate text rawtext));
2983a2984,3003
>     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;
> 
3074a3095,3097
> 
>     # the raw edit text has to be (close to) the last substitution on the page
>     $tmpl =~ s/%RAWTEXT%/$rawText/;

discussion

 
Topic attachments
I Attachment Action Size Date Who Comment
txttxt preview.tmpl.txt manage 1.7 K 12 Aug 2004 - 19:42 WillNorris modifications for preview template to support editting on same page
Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r8 < r7 < r6 < r5 < r4 | More topic actions
 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback SourceForge.net Logo