[evolution/gnome-41] I#1679 - e-convert.js: Do not re-wrap gmail_quote paragraphs



commit c53c8aeeeaf670aaf6baccbb5da8247fe267df64
Author: Milan Crha <mcrha redhat com>
Date:   Mon Nov 8 15:29:25 2021 +0100

    I#1679 - e-convert.js: Do not re-wrap gmail_quote paragraphs
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1679

 data/webkit/e-convert.js | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
---
diff --git a/data/webkit/e-convert.js b/data/webkit/e-convert.js
index a2cb7e10ac..a1fe4a4422 100644
--- a/data/webkit/e-convert.js
+++ b/data/webkit/e-convert.js
@@ -912,7 +912,26 @@ EvoConvert.processNode = function(node, normalDivWidth, quoteLevel)
                                useDefaultWidth = true;
                        }
 
-                       if (useDefaultWidth && normalDivWidth > 0) {
+                       var childrenWillWrap = true;
+                       if (!node.classList.contains("gmail_quote")) {
+                               childrenWillWrap = node.childNodes.length > 0 && liText == "";
+                               var ii;
+                               for (ii = 0; childrenWillWrap && ii < node.childNodes.length; ii++) {
+                                       var child = node.childNodes.item(ii);
+                                       childrenWillWrap = (child.nodeType == child.ELEMENT_NODE &&
+                                                          ((child.tagName == "DIV" && 
!child.getAttribute("x-evo-li-text")) ||
+                                                           child.tagName == "P" ||
+                                                           child.tagName == "PRE" ||
+                                                           child.tagName == "BLOCKQUOTE" ||
+                                                           child.tagName == "BR")) ||
+                                                          (child.nodeType == child.TEXT_NODE &&
+                                                           EvoConvert.RemoveInsignificantNewLines(child, 
true).trim().length == 0);
+                               }
+                       }
+
+                       if (childrenWillWrap) {
+                               width = -1;
+                       } else if (useDefaultWidth && normalDivWidth > 0) {
                                width = normalDivWidth - (quoteLevel * 2);
 
                                if (width < EvoConvert.MIN_PARAGRAPH_WIDTH)


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