From f951a474978baea95a0f880b5651605aad09997e Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 6 May 2008 22:50:11 +0200 Subject: jump to edited section after editing FS#643 This patch adds a mecanism that tries to scroll down to the section that was just edited when using section editing. The approach used is not failsafe, but should work in most cases. It will not work correctly when: * multiple sections on the page have the same headline * the edited section no longer starts with a headline darcs-hash:20080506205011-7ad00-9d213d4436c4f01840d3f62277c3fee9e316d447.gz --- inc/actions.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/actions.php b/inc/actions.php index 24516e5d5..45c067657 100644 --- a/inc/actions.php +++ b/inc/actions.php @@ -301,9 +301,22 @@ function act_save($act){ //delete draft act_draftdel($act); + + $go = wl($ID,'',true); + + //get section name when coming from section edit + if($PRE && preg_match('/^\s*==+([^=\n]+)/',$TEXT,$match)){ + #FIXME duplicates code from xhtml renderer + $title = $match[0]; + $title = str_replace(':','',cleanID($title)); + $title = ltrim($title,'0123456789._-'); + if(empty($title)) $title='section'; + $go .= '#'.$title; + } + //show it session_write_close(); - header("Location: ".wl($ID,'',true)); + header("Location: $go"); exit(); } -- cgit v1.2.3