[Rt-commit] rt branch, 4.2/ckeditor-text-wrapping, created. rt-4.2.5-158-g59c16b8

Alex Vandiver alexmv at bestpractical.com
Mon Jul 7 16:04:48 EDT 2014


The branch, 4.2/ckeditor-text-wrapping has been created
        at  59c16b898fe12690284628dda12aa1dd3bcef1f9 (commit)

- Log -----------------------------------------------------------------
commit 59c16b898fe12690284628dda12aa1dd3bcef1f9
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 7 15:48:31 2014 -0400

    Fix line wrapping of text → HTML in ckeditor
    
    While 2a2198bc fixed the display of the HTML → text conversion for
    text/plain embedded in an HTML template, it failed to address the
    ckeditor, which suffered from a similar problem.
    
    Notably, the ckeditor formatted <pre><div>...</div></pre> as
    <pre></pre><div>...</div>; while the <div> maintained its style, all
    whitespace had been compressed from its original value, leaving the
    style pointless.
    
    This table shows the previous states of this code, and its failures:
    
       MARKUP           |     MUA      |  HTML->TEXT   |   CKEDITOR
      ------------------+--------------+---------------+---------------
       <pre>            | doesn't wrap | GOOD          | GOOD
         75cdfc91       | long lines   |               |
      ------------------+--------------+---------------+---------------
       <div style>      | GOOD         | whitespace    | whitespace
         6b117af0       |              | not preserved | not preserved
      ------------------+--------------+---------------+---------------
       <pre><div style> | GOOD         | GOOD          | whitespace
         2a2198bc       |              |               | not preserved
      ------------------+--------------+---------------+---------------
       <pre style>      | GOOD         | GOOD          | GOOD
         (this commit)  |              |               |
    
    Swap to using <pre style="...">...</pre>, which MUAs and ckeditor render
    acceptably, and the stock HTML → text conversion preserves whitespace
    in.
    
    Fixes: I#30198

diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index 68c7cd2..a021c0a 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -368,7 +368,7 @@ sub Content {
                 $content =~ s/&/&/g;
                 $content =~ s/</</g;
                 $content =~ s/>/>/g;
-                $content = "<pre><div style='white-space: pre-wrap; font-family: monospace;'>$content</div></pre>";
+                $content = qq|<pre style="white-space: pre-wrap; font-family: monospace;">$content</pre>|;
             }
         }
     }

-----------------------------------------------------------------------


More information about the rt-commit mailing list