javascripthtmljquerytinymcetinymce-plugins

Why Tinymce removes some of my inline style?


I'm using tinymce on an email template. Here is an example of the template I add through the template plugin. (see below)

1-The issue is that tinymce deletes the background-color of the first level td and I don't understand why..If I add the background-color on the next table tag, it works. As I don't want to change all my templates, what is the best way to allow background color and other css properties on td ? I tried class="mceTmpl" on the tr or td, it doesn't change anything.

<tr>
   <td>
    <div class="content">
     <table role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto;">
      <tr>
        <td align="center"  style="font-size:0;background-color: #23004C;">
            <table cellpadding="0" cellspacing="0" border="0" role="presentation" style="width:100%;font-size:0;line-height:0;">
                <tr>
                    <td align="left" valign="top" dir="rtl">

And here is what I get. It's removing a entire tr > td > table

<tr>
     <td>
       <div class="content mce-content-body" id="mce_3" contenteditable="true" spellcheck="false">
         <table cellpadding="0" cellspacing="0" border="0" role="presentation" style="width: 100%; font-size: 0; line-height: 0;" data-mce-style="width: 100%; font-size: 0; line-height: 0;" class="mce-item-table">
            <tbody>
                <tr>
                    <td align="left" valign="top" dir="rtl">

Solution

  • EDIT AND ANSWER: finaly the only solution I found was to modify the begining of my template, following the docs. Instead of starting directly with a tr>td I add a div with the mceTmpl class, and then a table tag:

    <div class="mceTmpl"><table role="presentation" border="0" cellspacing="0" cellpadding="0" width="680"> 
    

    and in the html file to create the space where the template should be called, I removed the table tag and replaced it by a div with the selector Id :

    <tr>
       <td>
        <div id="banner"  role="presentation" cellspacing="0" cellpadding="0" border="0" width="100%" style="margin: auto;"></div>                
       </td>
    </tr>