From 8ac0b3ca36f11ee19ebcd0183b5db36ba34a7896 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 15 Dec 2009 14:06:34 +0100 Subject: 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 --- lib/scripts/linkwiz.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/scripts') 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(); -- cgit v1.2.3