Monotone-Parent: 3f1c47ada6e8d67d362b8af1e503366526919d45

Monotone-Revision: be71096e4701678c38f432b7c7ceb5d87bfd349f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-11-20T17:00:08
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-11-20 17:00:08 +00:00
parent 9f20f967a6
commit ab0308931a
2 changed files with 20 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
var contactSelectorAction = 'mailer-contacts';
var signatureLength = 0;
function onContactAdd() {
var selector = null;
@@ -240,6 +241,16 @@ function clickedEditorSave(sender) {
return false;
}
function onTextFocus() {
this.insertBefore(document.createTextNode("\r\n"),
this.lastChild);
if (signatureLength > 0) {
var length = this.getValue().length - signatureLength - 1;
this.setSelectionRange(length, length);
}
Event.stopObserving(this, "focus", onTextFocus);
}
function initMailEditor() {
var list = $("attachments");
$(list).attachMenu("attachmentsMenu");
@@ -256,6 +267,14 @@ function initMailEditor() {
var list = $("addressList");
TableKit.Resizable.init(list, {'trueResize' : true, 'keepWidth' : true});
var textarea = $("text");
var textContent = textarea.getValue();
var sigLimit = textContent.lastIndexOf("--");
if (sigLimit > -1)
signatureLength = (textContent.length - sigLimit);
Event.observe(textarea, "focus",
onTextFocus.bindAsEventListener(textarea));
onWindowResize(null);
Event.observe(window, "resize", onWindowResize);
Event.observe(window, "beforeunload", onMailEditorClose);