diff options
Diffstat (limited to 'lib/scripts')
-rw-r--r-- | lib/scripts/hotkeys.js | 6 | ||||
-rw-r--r-- | lib/scripts/linkwiz.js | 9 | ||||
-rw-r--r-- | lib/scripts/media.js | 10 |
3 files changed, 12 insertions, 13 deletions
diff --git a/lib/scripts/hotkeys.js b/lib/scripts/hotkeys.js index 356b691ea..ad608b227 100644 --- a/lib/scripts/hotkeys.js +++ b/lib/scripts/hotkeys.js @@ -208,7 +208,7 @@ function Hotkeys() { /** * @property isMac */ - this.isMac = (navigator.userAgent.indexOf('Mac') != -1); + this.isMac = is_macos; /** * Apply function cb on each element of o in the namespace of s @@ -272,9 +272,7 @@ function Hotkeys() { } t.each(t.shortcuts, function(o) { - if (t.isMac && o.ctrl != e.metaKey) - return; - else if (!t.isMac && o.ctrl != e.ctrlKey) + if (o.ctrl != e.ctrlKey) return; if (o.alt != e.altKey) 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(/(^:)?[^:]*$/, ''); }, /** diff --git a/lib/scripts/media.js b/lib/scripts/media.js index f30c2cc7b..974b2864c 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -8,7 +8,7 @@ // * remame all the variables starting with $ once the port is over /** - * JavaScript functionalitiy for the media management popup + * JavaScript functionality for the media management popup * * @author Andreas Gohr <andi@splitbrain.org> * @author Pierre Spring <pierre.spring@caillou.ch> @@ -141,14 +141,6 @@ popup.appendChild(btnp); btnp.setAttribute('class','btnlbl'); - var cls = document.createElement('input'); - cls.type = 'button'; - cls.setAttribute('class','button'); - cls.value = LANG['mediaclose']; - btnp.appendChild(cls); - - $(cls).click(function () {$(popup).hide();}); - var btn = document.createElement('input'); btn.type = 'button'; btn.id = 'media__sendbtn'; |