We are using TinyMCE (6) as a WYSIWYG Editor so our users can enter in HTML content into Templates that we will use later. We are injecting certain variables, using the Mustache Templating Library, which are then replaced by our backend. We are finding that some Mustache variables are being re-written by TinyMCE when it is loaded into the editor, or when saved from the code plugin. How can we stop this from happening, and what is the ramifications?
An example is the following code block:
<p>
<strong>Scope of Services</strong>
</p>
<ul>
{{#jobs}}
<li>{{short_description}}</li>
{{/jobs}}
{{^jobs}}
<li><em style="color: red;">NO SERVICES HAVE BEEN ADDED TO THIS ENGAGEMENT</em></li>
{{/jobs}}
</ul>
This will loop through a Mustache variable called Jobs, and create a line item in the UL for each job that exists.
But Mustache takes this code, and turns it into this:
<p><strong>Scope of Services</strong></p>
<ul>
<li>{{#jobs}}</li>
<li>{{short_description}}</li>
<li>{{/jobs}} {{^jobs}}</li>
<li><em style="color: red;">NO SERVICES HAVE BEEN ADDED TO THIS ENGAGEMENT</em></li>
<li>{{/jobs}}</li>
</ul>
Notice how it wrapped the mustache variables into LI elements.
How can we make it not do that, and ignore things that are in double or triple braces like {{variable}} and {{{variable}}}