Monotone-Parent: b3b6f425c01979bb9afdf39c7034dfd2131f4dd3

Monotone-Revision: 24c2f8206b434e2894e6aa447358893a06cc7dc7

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-08-29T02:49:43
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-08-29 02:49:43 +00:00
parent 943b77d12f
commit 8e9e8fc803
2 changed files with 13 additions and 5 deletions
+2 -1
View File
@@ -205,7 +205,8 @@ Element.addMethods(
setCaretTo: function(element, pos) {
element = $(element);
if (element.selectionStart) { // For Mozilla and Safari
if (typeof(element.selectionStart)
!= "undefined") { // For Mozilla and Safari
element.focus();
element.setSelectionRange(pos, pos);
}
+11 -4
View File
@@ -283,10 +283,17 @@ function onTextKeyDown(event) {
}
else {
if (!(event.shiftKey || event.metaKey || event.ctrlKey)) {
if (this.selectionStart) { // FF
var startText = this.value.substr(0, this.selectionStart);
var endText = this.value.substr(this.selectionStart);
this.value = startText + " " + endText;
if (typeof(this.selectionStart)
!= "undefined") { // For Mozilla and Safari
var cursor = this.selectionStart;
var startText = ((cursor > 0)
? this.value.substr(0, cursor)
: "");
var endText = this.value.substr(cursor);
var newText = startText + " " + endText;
this.value = newText;
cursor += 3;
this.setSelectionRange(cursor, cursor);
}
else if (this.selectionRange) // IE
this.selectionRange.text = " ";