Feature Proposal: Enable links in edit previews
Motivation
It's useful to see where a link would point to while previewing a page. Let's add a target=_blank attribute to prevent clicks that would lose the edit.
Description and Documentation
Right now, the Preview page (from Raw edit) disables hyperlinks and only styles the link attributes (e.g. underlined blue text). This is done to avoid accidental clicks on links that may lose the user's edits.
However, this makes it impossible to see where links would lead to by hovering the mouse over them.
An alternative that would both show link targets and prevent loss of edit text is to generate links in the Preview page with a target=_blank attribute which would cause them to be opened in a new browser tab.
Examples
Impact
Implementation
--
Contributors: DanDascalescu - 15 Apr 2010
Discussion
In what circumstances would this be useful? I would just go
back
in the browser and check the link targets there. Please add some examples.
- that doesn't help for external links nor in the raw edit mode. -- WillNorris - 07 Sep 2010
- Say that you are creating a link to some less trivial location, i.e. not just a wikiword, but instead using a plugin or some sort of
%MACRO{foo}%
to have the final target of the link resolved on-the-fly when viewing the page. Another example is when using this sort of link: [[MyCoolPage][that cool page]]
. What is percieved as an unneccecary extra layer of implicity is the fact that you'll never be fully assured that generated links will point to their correct location until you have actually clicked "Save" and can view the results.
-- TWiki:Main.ConnyBrunnkvist - 09 Feb 2003
If you limit the problem to "Make sure I create a correct link in edit mode", you can create a link to a pop-up window where you can browse the topics in the web, or maybe other webs as well. See for instance the pop-up in http://www.visiblearea.com/cgi-bin/twiki/edit/Patterns/Test_page (link "List of all topic names").
-- ArthurClemens - 09 Jun 2003 TWiki:Codev.PurposeOfPreview
--
TorbenGB - 06 Aug 2010
We could just add the target as a
title
attribute, which would show as a tooltip on mouse over. For example:
<span class="foswikiEmulatedLink" title="http://foswiki.org/Main/TorbenGB">TorbenGB</span>
Renders as:
TorbenGB
What do you think?
--
AndrewJones - 06 Aug 2010
I recon this is a worthwhile, simple change - it means you don't need to hit back&forth to eyeball, and looks more normal
we
could add to this a little more -
foswikiEmulatedTopicLink
,
foswikiEmulatedMissingTopicLink
,
foswikiEmulatedExternalLink
,
foswikiEmulatedAttachmentLink
etc
and similarly do a little more in view mode too
--
SvenDowideit - 06 Aug 2010
i agree with this proposal and originally submitted
this patch in 2003 :/
--- savemulti.orig 2003-09-30 04:24:19.000000000 -0400
+++ savemulti 2003-09-30 04:24:38.000000000 -0400
@@ -247,7 +247,7 @@
$ptext = &TWiki::getRenderedVersion( $ptext );
# do not allow click on link before save:
- $ptext =~ s@(href=".*?")@href="%SCRIPTURLPATH%/oops%SCRIPTSUFFIX%/%WEB%/%UNSPACEDTOPIC%\?template=oopspreview"@goi;
+ $ptext =~ s@(href=".*?")@$1 target="_blank"@goi;
$ptext = &TWiki::handleCommonTags( $ptext, $topic );
$tmpl = &TWiki::handleCommonTags( $tmpl, $topic );
emulated links don't really help me, as i often want to text links external to the wiki. so, just rendering back what i already typed in (either as an explicit
http://... link or an
InterWiki link) doesn't help me in any way to actually *test*/preview that link.
so, there are 2 use cases to consider: internal and external links. most people have been thinking in terms of internal wiki links, whereas i have been thinking primarily of external wiki links (in the preview link context).
adding the
target="_blank"
to preview links seems like a simple and quick path forward. this could be further enhanced in additional change proposals to provide hover thumbnails of the target page and various other bits of UI goodness (both in preview and edit mode). let's start with this simple step first, though, eh?
--
WillNorris - 07 Sep 2010
Adding
target="_blank"
seems like a good and easy solution.
AcceptedBy14DayRule...?
--
AndrewJones - 03 May 2011
very
--
SvenDowideit - 04 May 2011
It's a bit more complex. the link might already have a target. I've implemented, along with unit tests.
--
GeorgeClark - 27 May 2012