diff options
author | Andreas Gohr <gohr@cosmocode.de> | 2009-12-15 14:06:34 +0100 |
---|---|---|
committer | Andreas Gohr <gohr@cosmocode.de> | 2009-12-15 14:06:34 +0100 |
commit | 8ac0b3ca36f11ee19ebcd0183b5db36ba34a7896 (patch) | |
tree | 913fa23c68b06e5cd8ce70eb5e5f5c1bcfd1af55 | |
parent | 0bda03632fea147f862c813751f59535d5a01072 (diff) | |
download | rpg-8ac0b3ca36f11ee19ebcd0183b5db36ba34a7896.tar.gz rpg-8ac0b3ca36f11ee19ebcd0183b5db36ba34a7896.tar.bz2 |
get text selection early in linkwizard FS#1820
Ignore-this: 47573bdaf0c547971bb3013c90c4c037
Fixes a problem with the link wizard in MSIE6
darcs-hash:20091215130634-6e07b-d9da628897912a086c0fe5ea5aad49b505fe1a1e.gz
-rw-r--r-- | lib/scripts/linkwiz.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/scripts/linkwiz.js b/lib/scripts/linkwiz.js index ea3ee0cbe..d687ebbeb 100644 --- a/lib/scripts/linkwiz.js +++ b/lib/scripts/linkwiz.js @@ -11,6 +11,7 @@ var linkwiz = { sack: null, textArea: null, selected: -1, + selection: null, /** * Initialize the linkwizard by creating the needed HTML @@ -194,7 +195,10 @@ var linkwiz = { */ insertLink: function(title){ if(!linkwiz.entry.value) return; - var sel = getSelection(linkwiz.textArea); + + var sel = getSelection(linkwiz.textArea); + if(sel.start == 0 && sel.end == 0) sel = linkwiz.selection; + var stxt = sel.getText(); if(!stxt && !DOKU_UHC) stxt=title; @@ -250,6 +254,7 @@ var linkwiz = { * Show the linkwizard */ show: function(){ + linkwiz.selection = getSelection(linkwiz.textArea); linkwiz.wiz.style.marginLeft = '0px'; linkwiz.entry.focus(); linkwiz.autocomplete(); |