CRM-17726 Body tag hidden in message template source even if it contains markup.

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.6
    • Fix Version/s: Unscheduled
    • Component/s: None
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      The problem is: if the body tag contains markup, then the message template is saved, when it is reopened only the things inside the body tag are shown.

      This means that a user can easily break their template by having an element like <body style='text-color: #000; background-color: #000'>

      When the message template is opened, only the elements inside body, but not including body, will be shown. This means that the user is unable to change it back.underlined text

        Attachments

          Activity

          [CRM-17726] Body tag hidden in message template source even if it contains markup.
          John Kirk added a comment -

          On subsequent saves it appears to overwrite the body element with the default which contains margin: 20px.

          Coleman Watts added a comment -

          Thanks for submitting this.
          As a non-critical issue, we can prioritize this if:

          1. It gets submitted to the paid issue queue, or
          2. A pull-request is submitted for us to review on github.
          Peter Davis added a comment -

          I recently found a situation where the Body of CiviMail was all being centred because they had a Header set up where the logo was centred.

          Is this a similar issue or should i open as separate?

          John Kirk added a comment - - edited

          Peter Davis Potentially the same issue, particularly if it breaks after saving.

          Peter Davis added a comment -

          John - I will assign this to Jitendra to sort. can you pls add a really simple recipe to follow for replicating. and i will track down that header on too

          Peter Davis added a comment -

          jitendra - pls drop this in to a header - add some body that is NOT centred. then set up a CiviMail and send to yourself as both test and final. I believe you will find in one or both scenarios you will find the body ends up centred. Note I did not observe this by clicking Preview in civimail.

          <table width="100%" border="0" cellspacing="0" cellpadding="0" class="bg1">
             <tr>
          
                <td align="center">
                   
                   <table width="600" border="0" cellspacing="0" cellpadding="0" class="bg2">
                      <tr>
                         <td class="header" align="left">
                            <img src="https://civicrm.org/sites/civicrm.org/themes/civicrm_bootstrap/logo.png" alt="Header" width="600" height="150" />
                         </td>
                      </tr></table>
          
          John Kirk added a comment -

          Repro steps are in the description - markup in body element is removed. Good luck!

          Jitendra Purohit added a comment -

          For the issue mentioned in the description, doesn't seem to be a core issue, instead an extra setting which you can configure for ckeditor.

          Navigate to Administer -> Customize Data and Screens -> Display Preferences and click on Configure CKEditor Button.

          Path - civicrm/admin/ckeditor?reset=1.

          Add fullPage setting in the Advanced Option and set it to true. You can then find html/head/body tags in CKEditor at every place in civi.

          Thanks.

          Chris Burgess added a comment - - edited

          I understand that this is leading to user confusion so can be worthwhile to address.

          Until resolved, can it be worked around by just not using a styled body tag in your message template? (Substituting div for body should work OK?)

          Permitting body in all rich text inputs through Civi may not be an ideal outcome, since for the majority of rich text inputs it would not be a valid context for that element. (Probably not a major issue unless people actually use it.)

            People

            • Assignee:
              Jitendra Purohit
              Reporter:
              John Kirk

              Dates

              • Created:
                Updated:
                Resolved: