From 8a25d89438103f6f3c099f9927de26411e5974aa Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 20 Nov 2007 19:15:22 +0000 Subject: [PATCH] Monotone-Parent: 80314eb2f15e5d1fc369f56a8001f005ba7e0f5f Monotone-Revision: 3bc573b09449f0efea891e5e11a232520f51205c Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-11-20T19:15:22 Monotone-Branch: ca.inverse.sogo --- UI/WebServerResources/UIxMailEditor.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/UI/WebServerResources/UIxMailEditor.js b/UI/WebServerResources/UIxMailEditor.js index 686d5bdc0..d4c972d70 100644 --- a/UI/WebServerResources/UIxMailEditor.js +++ b/UI/WebServerResources/UIxMailEditor.js @@ -242,8 +242,11 @@ function clickedEditorSave(sender) { } function onTextFocus() { - this.insertBefore(document.createTextNode("\r\n"), - this.lastChild); + var content = this.getValue(); + if (content.lastIndexOf("--") == 0) { + this.insertBefore(document.createTextNode("\r\n"), + this.lastChild); + } if (signatureLength > 0) { var length = this.getValue().length - signatureLength - 1; this.setSelectionRange(length, length); @@ -272,8 +275,8 @@ function initMailEditor() { var sigLimit = textContent.lastIndexOf("--"); if (sigLimit > -1) signatureLength = (textContent.length - sigLimit); - Event.observe(textarea, "focus", - onTextFocus.bindAsEventListener(textarea)); + textarea.observe("focus", onTextFocus); + textarea.scrollTop = textarea.offsetHeight; onWindowResize(null); Event.observe(window, "resize", onWindowResize);