From 658296ab9f537037176727350f34a0ec3f2f9bc6 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sat, 2 Oct 2010 20:07:34 +0200 Subject: Remove trailing whitespace in the link wizard FS#1760 --- lib/scripts/linkwiz.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/scripts') diff --git a/lib/scripts/linkwiz.js b/lib/scripts/linkwiz.js index 225868592..779c4d704 100644 --- a/lib/scripts/linkwiz.js +++ b/lib/scripts/linkwiz.js @@ -201,6 +201,13 @@ var linkwiz = { if(sel.start == 0 && sel.end == 0) sel = linkwiz.selection; var stxt = sel.getText(); + + // don't include trailing space in selection + if(stxt.charAt(stxt.length - 1) == ' '){ + sel.end--; + stxt = sel.getText(); + } + if(!stxt && !DOKU_UHC) stxt=title; // prepend colon inside namespaces for non namespace pages -- cgit v1.2.3 From 34c350b273b2b5046b7dbd7ba852fcd3e137a6f7 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sat, 2 Oct 2010 20:34:35 +0200 Subject: Link wizard starts with the last opened namespace FS#1989 --- lib/scripts/linkwiz.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/scripts') diff --git a/lib/scripts/linkwiz.js b/lib/scripts/linkwiz.js index 779c4d704..e4e92cdd2 100644 --- a/lib/scripts/linkwiz.js +++ b/lib/scripts/linkwiz.js @@ -225,6 +225,8 @@ var linkwiz = { pasteText(sel,link,{startofs: so, endofs: eo}); linkwiz.hide(); + // reset the entry to the parent namespace and remove : at the beginning + linkwiz.entry.value = linkwiz.entry.value.replace(/(^:)?[^:]*$/, ''); }, /** -- cgit v1.2.3