Fixed: cursor not positioned correctly when using wiki toolbar buttons under IE (Balazs Dan).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@654 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-08-17 12:58:01 +00:00
parent d1780270da
commit f601d5fb9e
1 changed files with 6 additions and 2 deletions

View File

@ -259,8 +259,12 @@ jsToolBar.prototype = {
subst = prefix + res + suffix;
if (typeof(document["selection"]) != "undefined") {
var range = document.selection.createRange().text = subst;
this.textarea.caretPos -= suffix.length;
document.selection.createRange().text = subst;
var range = this.textarea.createTextRange();
range.collapse(false);
range.move('character', -suffix.length);
range.select();
// this.textarea.caretPos -= suffix.length;
} else if (typeof(this.textarea["setSelectionRange"]) != "undefined") {
this.textarea.value = this.textarea.value.substring(0, start) + subst +
this.textarea.value.substring(end);