tinymce - 在 Handlebars 模板中使用 TinyMCE

标签 tinymce handlebars.js tinymce-4

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

这是我的 Handlebars 模板的良好 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>

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

最佳答案

我刚刚遇到了这个问题...我有一封订单确认电子邮件,我需要使用表格中的订单项目列表对其进行配置;同样的问题。
我刚刚意识到我可能不应该使用表格,因为它们没有响应,但我最终能够用 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>

关于tinymce - 在 Handlebars 模板中使用 TinyMCE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28554437/

相关文章:

javascript - 自定义颜色选择器 TinyMCE

javascript - Handlebars 不会在我的 Backbone.js 集合上循环

javascript - 内容未被从被覆盖的元素内部删除

javascript - TinyMCE4 - 无法在编辑器底部设置工具栏

javascript - 如何在tinymce中添加多个插件?

wordpress - TinyMCE 可视化编辑器超链接按钮在 WordPress 3.5 中不起作用

javascript - Handlebars : Access has been denied to resolve the property "from" because it is not an "own property" of its parent

tinymce - 如何在 TinyMCE 中处理图像链接转换

javascript - TinyMCE 4 有没有办法在编辑时自动附加字符?

tinymce - 在 TinyMCE 4 上禁用拖动图像