From b0c902622352713a481088104ad9adfe4a06b18e Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Sun, 25 Jan 2015 12:01:04 -0500
Subject: [PATCH] Fix bug where signature could have been inserted twice after plain-to-html switch (#1490239)

---
 CHANGELOG            |    1 +
 program/js/editor.js |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 17abd14..464bd9b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -16,6 +16,7 @@
 - Fix bug where drafts list wasn't refreshed after draft message was sent from another window (#1490238)
 - Fix keyboard navigation and css in datepicker widget across many Firefox versions
 - Fix false warning when opening attached text/plain files (#1490241)
+- Fix bug where signature could have been inserted twice after plain-to-html switch (#1490239)
 
 RELEASE 1.1-rc
 --------------
diff --git a/program/js/editor.js b/program/js/editor.js
index 2fc3429..9216534 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -213,8 +213,10 @@
       content = input.val();
 
       // replace current text signature with temp mark
-      if (is_sig)
-        content = content.replace(signature.text, sig_mark);
+      if (is_sig) {
+        content = content.replace(/\r\n/, "\n");
+        content = content.replace(signature.text.replace(/\r\n/, "\n"), sig_mark);
+      }
 
       var init_editor = function(data) {
         // replace signature mark with html version of the signature

--
Gitblit v1.9.1