[pmwiki-users] Edit anchor or JumpTop

Patrick R. Michaud pmichaud at pobox.com
Fri Mar 3 08:57:11 CST 2006

On Fri, Mar 03, 2006 at 07:38:26AM -0700, pmwiki at ben-amotz.com wrote:
> Objective: to cause an edit screen to jump to an anchor.
> Example: an edit of  a cookbook page jumps directly to the comment
> section.
> Possible approaches:
> 1.  Modify the existing edit action to interpret and act on a url that
> includes an anchor, e.g.
> Groupname/Pagename#anchor?action=edit
> 2.  Modify the default behavior of the existing edit action to look for,
> and jump to, a special editing anchor, if it exists.

In the general case this will be somewhat difficult, and require some
Javascript support.  (This isn't to say it can't be done.)

In particular, a url like  Groupname/Pagename#anchor won't work
for this, because the "#anchor" part is an instruction to the browser
to scroll the *entire page* to #anchor.  There's not a built-in 
universal mechanism for browsers to scroll the editing textarea.

So, it'd have to be something like Groupname/Pagename?action=edit&jumpto=xyz,
which would allow the edit action to generate javascript to (hopefully)
get the browser to find the location of the "[[#xyz]]" anchor in the markup
text and scroll the edit textarea element to that location.  And 
since the textarea scrollTop property (used to scroll the textarea)
is given in *pixels*, and not lines or characters, it'd be very difficult 
to get Javascript to be able to figure out exactly how far to scroll
the textarea to be able to pre-position it at the anchor text.


More information about the pmwiki-users mailing list