[geary: 1/2] Don't add Geary-flavored markdown to plain text messages



commit 67d819565e3af294f0639081d495aa05110a1482
Author: Alex Henrie <alexhenrie24 gmail com>
Date:   Fri Feb 8 23:16:01 2019 -0700

    Don't add Geary-flavored markdown to plain text messages
    
    Fixes #201

 ui/composer-web-view.js | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/ui/composer-web-view.js b/ui/composer-web-view.js
index 97f2aa18..31fda273 100644
--- a/ui/composer-web-view.js
+++ b/ui/composer-web-view.js
@@ -489,7 +489,9 @@ ComposerPageState.htmlToText = function(root) {
                 }
                 break;
             case "a":
-                if (node.textContent == node.href) {
+                if (node.closest("body.plain")) {
+                    text += ComposerPageState.htmlToText(node);
+                } else if (node.textContent == node.href) {
                     text += "<" + node.href + ">";
                 } else {
                     text += ComposerPageState.htmlToText(node);
@@ -498,7 +500,11 @@ ComposerPageState.htmlToText = function(root) {
                 break;
             case "b":
             case "strong":
-                text += "*" + ComposerPageState.htmlToText(node) + "*";
+                if (node.closest("body.plain")) {
+                    text += ComposerPageState.htmlToText(node);
+                } else {
+                    text += "*" + ComposerPageState.htmlToText(node) + "*";
+                }
                 break;
             case "blockquote":
                 let bqText = ComposerPageState.htmlToText(node);
@@ -515,10 +521,18 @@ ComposerPageState.htmlToText = function(root) {
                 break;
             case "i":
             case "em":
-                text += "/" + ComposerPageState.htmlToText(node) + "/";
+                if (node.closest("body.plain")) {
+                    text += ComposerPageState.htmlToText(node);
+                } else {
+                    text += "/" + ComposerPageState.htmlToText(node) + "/";
+                }
                 break;
             case "u":
-                text += "_" + ComposerPageState.htmlToText(node) + "_";
+                if (node.closest("body.plain")) {
+                    text += ComposerPageState.htmlToText(node);
+                } else {
+                    text += "_" + ComposerPageState.htmlToText(node) + "_";
+                }
                 break;
             case "#comment":
                 break;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]