Monotone-Parent: 673b05009820fc5ced4357cc9f1e8582b31301cb

Monotone-Revision: 600e156688324637e9fcc6c445ab1c78a04e29ae

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-08-27T22:50:12
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-08-27 22:50:12 +00:00
parent 03c2f77839
commit 4082b90b53

View File

@@ -226,8 +226,8 @@ function onAttachmentChange(event) {
this.removeClassName("currentAttachment");
var list = $("attachments");
createAttachment(this, list);
clickedEditorAttach(null)
}
clickedEditorAttach(null);
}
}
function createAttachment(node, list) {
@@ -270,6 +270,36 @@ function onTextFocus() {
input.parentNode.removeChild(input);
}
function onTextKeyDown(event) {
if (event.keyCode == 9) {
if (event.shiftKey) {
var nodes = $("subjectRow").childNodesWithTag("input");
var objectInput = $(nodes[0]);
objectInput.focus();
objectInput.selectText(0, objectInput.value.length);
preventDefault(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;
}
else if (this.selectionRange) // IE
this.selectionRange.text = " ";
else { // others ?
}
preventDefault(event);
}
}
}
}
function onTextIEUpdateCursorPos(event) {
this.selectionRange = document.selection.createRange().duplicate();
}
function onTextFirstFocus() {
var content = this.getValue();
if (content.lastIndexOf("--") == 0) {
@@ -496,6 +526,13 @@ function initMailEditor() {
textarea.observe("focus", onTextFocus);
// textarea.observe("contextmenu", onTextContextMenu);
textarea.observe("mousedown", onTextMouseDown, true);
textarea.observe("keydown", onTextKeyDown);
if (Prototype.Browser.IE) {
var ieEvents = [ "click", "select", "keyup" ];
for (var i = 0; i < ieEvents.length; i++)
textarea.observe(ieEvents[i], onTextIEUpdateCursorPos, false);
}
initTabIndex($("addressList"), $$("div#subjectRow input").first(), textarea);
onWindowResize(null);