Question
Twiki in preview mode does not allow to click on links (only after page is saved) which makes sense. But
CommentPlugin does not, and if accidentally you click on "Add commnent" button in preview mode, your edited changes are lost, and obviously no comments are added.
I know I should switch to a skin without preview

and I might. But I want to fix this bug. How to detect in plugin that I am in preview mode? In preview, I might even return '' and do not render COMMENTS at all - it is fine too
- TWiki version:
- Perl version:
- Web server & version:
- Server OS:
- Web browser & version:
- Client OS:
--
PeterMasiar - 11 Jul 2003
Answer
There is currently no API to check for that.
A (possibly not so portable) way is to check for the
SCRIPT_NAME env variable, which is for example
/cgi-bin/preview.cgi.
--
PeterThoeny - 12 Jul 2003
Thank you. If it will work for me, it's portable enough

. Another portable way could be to use skin without preview and
CgiSaveMulti
--
PeterMasiar - 13 Jul 2003
It's worth noting that this is a general "problem" with forms in TWiki content - whilst user inserted links are redirected user inserted forms are not. Personally I find this
useful - it makes it easier to test that the form is right (hence the quotes around problem

)
The comment plugin is one aspect of a form embedded in the page. Another is where you have a form designed for creating pages - eg applications using TWiki, using
TWikiForms, using URLPARAM based variables to populate pages
etc. Eg
a bug report form, a
to do list etc.
--
TWikiGuest - 16 Jul 2003
Why does it make sense to disable the links in Preview mode? Here's a user case in which I'd prefer the links were there: in a TWiki page with headings, I want to obtain the anchor URL pointing to a heading long enough that not all the words will be included in the anchor part of the URL. To know what URL TWiki generates for that header, I'd edit the page, add
%TOC% at the beginning, then copy/paste the URL of the heading. If links are disabled, I can't do that.
--
DanDascalescu - 18 Dec 2007