在车把模板中使用 TinyMCE

Dis*_*ame 5 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>
Run Code Online (Sandbox Code Playgroud)

在我将代码传递到 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>
Run Code Online (Sandbox Code Playgroud)

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

Dis*_*ame 1

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

<tr repeat="{{#each Details}}">
</tr repeat="{{/each}}">
Run Code Online (Sandbox Code Playgroud)

  • 哇,我花了 10 个小时才找到完全相同问题的解决方案。请提供更详细的答案,我们将不胜感激。 (3认同)