diff options
Diffstat (limited to 'lib/scripts/linkwiz.js')
-rw-r--r-- | lib/scripts/linkwiz.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/scripts/linkwiz.js b/lib/scripts/linkwiz.js index 225868592..e4e92cdd2 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 @@ -218,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(/(^:)?[^:]*$/, ''); }, /** |