为什么Tinymce消除了我的一些内联风格?

发布于 2025-02-06 09:37:27 字数 1262 浏览 3 评论 0原文

我在电子邮件模板上使用Tinymce。这是我通过模板插件添加的模板的示例。 (请参见下文)

1-问题是Tinymce删除了第一级TD的背景色,而我不明白为什么..如果我在下一个表标签上添加背景色,则可以正常工作。由于我不想更改所有模板,允许TD上允许背景颜色和其他CSS属性的最佳方法是什么?我在TR或TD上尝试了class =“ mcetmpl”,它不会更改任何内容。

<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">

这就是我得到的。它正在删除整个tr&gt; TD&GT;桌子

<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">

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">

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七禾 2025-02-13 09:37:28

编辑和答案: finaly我发现的唯一解决方案是在文档之后修改模板的开始。我不是直接使用tr&gt; td开始使用mcetmpl类添加一个div,然后是一个表标签:

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

在html文件中以创建应调用模板的空间,而是删除了表标签并用一个带有选择器ID的DIV:

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

                        
 

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>

                        
 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文