使用TinyMCE与把手模板

时间:2015-02-17 04:05:09

标签: tinymce handlebars.js tinymce-4

我正在尝试使用TinyMCE来允许我的用户修改车把报告模板。该模板包含几个对TinyMCE无效的元素,它们正被移动。请参阅{{#each data}}和{{/ each}}

以下是我的手柄模板的优秀HTML代码:

<table class="table table-bordered">
     <thead>
          <tr>
               <th><h4>Item</h4></th>
               <th><h4 class="text-right">Quantity</h4></th>
               <th><h4 class="text-right">Rate/Price</h4></th>
               <th><h4 class="text-right">Sub Total</h4></th>
          </tr>
    </thead>
    <tbody>
        {{#each Details}}
           <tr>
                <td>{{Item}}<br><small>{{Description}}</small></td>
                <td class="text-right">{{Quantity}}</td>
                <td class="text-right">{{Rate}} {{UnitOfMeasure}}</td>
                <td class="text-right">{{Amount}}</td>
          </tr>
        {{/each}}  
     </tbody>
</table>

将代码传递给TinyMCE后,结果如下:

{{#each Details}}{{/each}}
<table class="table table-bordered">
<thead>
<tr><th>
<h4>Item</h4>
</th><th>
<h4 class="text-right">Quantity</h4>
</th><th>
<h4 class="text-right">Rate/Price</h4>
</th><th>
<h4 class="text-right">Sub Total</h4>
</th></tr>
</thead>
<tbody>
<tr>
<td>{{Item}}<br /><small>{{Description}}</small></td>
<td class="text-right">{{Quantity}}</td>
<td class="text-right">{{Rate}} {{UnitOfMeasure}}</td>
<td class="text-right">{{Amount}}</td>
</tr>
</tbody>
</table>

有没有人遇到过可能对我有帮助的插件或其他内容?

2 个答案:

答案 0 :(得分:1)

我刚遇到这个问题...我有一个订单确认电子邮件,我需要使用表中的订单项列表进行配置;同样的问题。

我只是意识到我可能不应该使用表,因为它们没有响应,但是我最终能够用HTML注释解决问题,如下所示:

<tr style="font-weight: bold;">
  <td style="width: 145px;">Qty</td>
  <td>Item</td>
  <td>Unit Price</td>
  <td>Total</td>
</tr>
<!--{{#order.line_items}} -->
<tr repeat="">
  <td style="width: 145px;">{{quantity}}</td>
  <td>{{product.name}}</td>
  <td>{{currency unit_price}}</td>
  <td>{{currency total}}</td>
</tr>
<!--{{/order.line_items}} -->
<tr>
  <td style="width: 145px;">&nbsp;</td>
  <td>&nbsp;</td>
  <td><strong>Subtotal:</strong></td>
  <td>{{currency order.subtotal}}</td>
</tr>

答案 1 :(得分:0)

我能够在我的元素上使用自定义属性并使用:

<tr repeat="{{#each Details}}">
</tr repeat="{{/each}}">